Z verze
změnil(a) David Brazda
k 01.02.2021 14:03
Na verzi < 32.1 >
změnil(a) David Brazda
k 01.02.2021 15:31
< >
Popis verze: Update document after refactoring.

Přehled

Rozpis

Na stránce změněno:
Nadpis
... ... @@ -1,1 +1,1 @@
1 -Macro - xcvid
1 +XCVID
Obsah
... ... @@ -7,3 +7,4 @@
7 7  
8 8  
9 9  
10 +
XWiki.JavaScriptExtension[0]
Způsob práce s cache
... ... @@ -1,1 +1,1 @@
1 -long
1 +default
Kód
... ... @@ -1,4 +1,4 @@
1 -function ShortenUrl(url) {
1 +function getAddress(url) {
2 2   const match = /^https:\/\/www.xcontest.org\/[\w\/]+:([-\w.]+\/\d\d?\.\d\d?\.\d{4}\/\d\d:\d\d)($|\?|#)/.exec(url);
3 - return match[1];
3 + return 'https://xcvid.com/embed.php?ident=' + match[1] + '#0';
4 4  }
Jméno
... ... @@ -1,1 +1,1 @@
1 -js regexper
1 +jsext
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -3,11 +3,16 @@
3 3  #set($width = $xcontext.macro.params.get('width'))
4 4  #set($height = $xcontext.macro.params.get('height'))
5 5  #set($flight = $xcontext.macro.params.get('flight'))
6 -#set ($discard = $xwiki.jsx.use('BackEnd.Macro - xcvid'))
7 -##set( $xcvidurl = $url.replaceAll('/^https:\/\/www.xcontest.org\/[\w\/]+:([-\w.]+\/\d\d?\.\d\d?\.\d{4}\/\d\d:\d\d)($|\?|#)/', '$2') )
8 -#set( $xcvidurl = $regextool.find($url, "(?=http*).*\/(.*)|(.*?)\/") )
6 +#set ($discard = $xwiki.jsx.use('BackEnd.XCVID.WebHome'))
7 +#set ($regexResult = $regextool.find($url, '^https:\/\/www.xcontest.org\/[\w\/]+:([-\w.]+\/\d\d?\.\d\d?\.\d{4}\/\d\d:\d\d)($|\?|#)'))
9 9  {{html}}
10 -$xcvidurl
11 - <iframe src="https://xcvid.com/embed.php?ident=$url" id="xcvid" width="$!{escapetool.html($width)}" height="$!{escapetool.xml($height)}">$xcontext.macro.content</iframe>
9 +#if (!$regexResult.isEmpty())
10 + $regexResult
11 + $regexResult.get(1).end
12 + $regexResult.get(1).start
13 + ##$url.substring($regexResult.get(1).start,$regexResult.get(1).end)
14 + #set ($src = "https://xcvid.com/embed.php?ident=" + $url.substring($regexResult.get(1).start,$regexResult.get(1).end))
15 +#end
16 + <iframe src="$src" id="xcvid" width="$!{escapetool.html($width)}" height="$!{escapetool.xml($height)}">$xcontext.macro.content</iframe>
12 12  {{/html}}
13 13  {{/velocity}}
Macro visibility
... ... @@ -1,1 +1,1 @@
1 -Global
1 +Current Wiki