MediaWiki:Gadget-DotsSyntaxHighlighter.js

(function{"use strict";function c(e){return new RegExp("("+e+")\n*|"+l,"gm")}function E{function N(e,t){if(t!=w){r+="'}#s"+l;if(S){r+=":before{";S=false}else{r+=":after{";S=true;++l}if(t){r+="background-color:"+t+";"}r+="content:'";w=t}r+=e}function C(n,r){var i;for(r.lastIndex=t;i=r.exec(e);r.lastIndex=t){if(i[1]){N(e.substring(t,r.lastIndex),n);t=r.lastIndex;return}var s=r.lastIndex-i[0].length;if(t<s){N(e.substring(t,s),n)}t=r.lastIndex;switch(i[0].charAt(0)){case"[":if(i[0].charAt(1)=="["){N("[[",syntaxHighlighterConfig.wikilinkColor||n);C(syntaxHighlighterConfig.wikilinkColor||n,p)}else{N(i[0],syntaxHighlighterConfig.externalLinkColor||n);C(syntaxHighlighterConfig.externalLinkColor||n,d)}break;case"{":if(i[0].charAt(1)=="{"){if(i[0].length==3){N("{{{",syntaxHighlighterConfig.parameterColor||n);C(syntaxHighlighterConfig.parameterColor||n,v)}else{N("{{",syntaxHighlighterConfig.templateColor||n);C(syntaxHighlighterConfig.templateColor||n,m)}}else{N("{|",syntaxHighlighterConfig.tableColor||n);C(syntaxHighlighterConfig.tableColor||n,g)}break;case"<":if(i[0].charAt(1)=="!"){N(i[0],syntaxHighlighterConfig.commentColor||n);break}else{var o=e.indexOf(">",t)+1;if(o==0){N("<",n);t=t-i[0].length+1;break}if(e.charAt(o-2)=="/"){N(e.substring(t-i[0].length,o),syntaxHighlighterConfig.tagColor||n);t=o}else{var u=i[0].substring(1);if(/^(?:nowiki|pre|math|syntaxhighlight|source|timeline|hiero)$/.test(u)){var a="";var f=e.indexOf(a,t);if(f==-1){f=e.length}else{f+=a.length}N(e.substring(t-i[0].length,f),syntaxHighlighterConfig.tagColor||n);t=f}else{N(e.substring(t-i[0].length,o),syntaxHighlighterConfig.tagColor||n);t=o;if(!b[u]){b[u]=c("")}C(syntaxHighlighterConfig.tagColor||n,b[u])}}}break;case"h":case"f":case"m":N(i[0],syntaxHighlighterConfig.externalLinkColor||n);break;case"=":if(/[^=]=+$/.test(e.substring(t,e.indexOf("\n",t)))){N("=",syntaxHighlighterConfig.headingColor||n);C(syntaxHighlighterConfig.headingColor||n,y)}else{N("=",n)}break;case"*":case"#":case":":N(i[0],syntaxHighlighterConfig.listOrIndentColor||n);break;case";":N(";",syntaxHighlighterConfig.headingColor||n);C(syntaxHighlighterConfig.headingColor||n,y);break;case"-":N(i[0],syntaxHighlighterConfig.hrColor||n);break;case"\\":N(i[0],syntaxHighlighterConfig.boldOrItalicColor||n);if(i[0].length==6){if(x){x=false;return}else{x=true;C(syntaxHighlighterConfig.boldOrItalicColor||n,h)}}else{if(T){T=false;return}else{T=true;C(syntaxHighlighterConfig.boldOrItalicColor||n,h)}}break;case"&":N(i[0],syntaxHighlighterConfig.entityColor||n);break;case"~":N(i[0],syntaxHighlighterConfig.signatureColor||n)}}}u=s.value;var e=u.replace(/['\\]/g,"\\$&")+"\n";var t=0;var r="";var l=0;var w;var S=true;var x=false;var T=false;var k=Date.now;C("",h);if(tsyntaxHighlighterConfig.timeout){clearInterval(f);o.nodeValue="";s.removeEventListener("input",E);var A={};A["ca"]='S\'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha tardat massa. El temps màxim permès per a remarcar és $1ms, i el teu ordinador ha trigat $2ms. Prova tancar algunes pestanyes i programes i fer clic en "Mostra la previsualització" o "Mostra els canvis". Si no funciona això, prova altre navegador web, i si això no funciona, prova un ordinador més ràpid.';A["de"]='Die Syntaxhervorhebung wurde auf dieser Seite deaktiviert, da diese zu lange gedauert hat. Die maximal erlaubte Zeit zur Hervorhebung beträgt $1ms und dein Computer benötigte $2ms. Versuche einige Tabs und Programme zu schließen und klicke "Vorschau zeigen" oder "Änderungen zeigen". Wenn das nicht funktioniert, probiere einen anderen Webbrowser und wenn immer noch nicht, probiere einen schnelleren Computer.';A["en"]='Syntax highlighting on this page was disabled because it took too long. The maximum allowed highlighting time is $1ms, and your computer took $2ms. Try closing some tabs and programs and clicking "Show preview" or "Show changes". If that doesn\'t work, try a different web browser, and if that doesn\'t work, try a faster computer.';A["es"]='Se desactivó el resaltar de sintaxis en esta página porque tardó demasiado. El tiempo máximum permitido para resaltar es $1ms, y tu ordenador tardó $2ms. Prueba cerrar algunas pestañas y programas y hacer clic en "Mostrar previsualización" o "Mostrar cambios". Si no funciona esto, prueba otro navegador web, y si eso no funciona, prueba un ordenador más rápido.';A["fr"]='La coloration syntaxique a été désactivée sur cette page en raison d\'un temps de chargement trop important ($2ms). Le temps maximum autorisé est $1ms. Vous pouvez essayer de fermer certains onglets et programmes et cliquez sur "Prévisualisation" ou "Voir mes modifications". Si cela ne fonctionne pas, essayez un autre navigateur web, et si cela ne fonctionne toujours pas, essayez un ordinateur plus rapide.';A["io"]='Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke konsumis tro multa tempo. La maxima permisata hailaitala tempo es $1ms, e tua ordinatro konsumis $2ms. Probez klozar kelka tabi e programi e kliktar "Previdar" o "Montrez chanji". Se to ne funcionas, probez altra brauzero, e se to ne funcionas, probez plu rapida ordinatro.';A["pt"]='O marcador de sintaxe foi desativado nesta pagina porque demorou demais. O tempo máximo permitido para marcar e $1ms, e seu computador demorou $2ms. Tenta sair de alguns programas e clique em "Mostrar previsão" ou "Mostrar alterações". Se isso não funciona, tenta usar uma outra navegador web, e se ainda não funciona, procura um computador mais rápido.';A=A[n]||A[n.substring(0,n.indexOf("-"))]||A["en"];s.style.backgroundColor="";s.style.position="";i.style.color="red";i.style.fontFamily="";i.style.fontWeight="bold";i.style.height="";var O=document.createRange;O.selectNode(i);i.appendChild(O.createContextualFragment(A.replace("$1",syntaxHighlighterConfig.timeout).replace("$2",L-k)))}}function S{i.scrollLeft=s.scrollLeft}function x{i.scrollTop=s.scrollTop}function T{if(s.value!=u){E}if(s.scrollLeft!=i.scrollLeft){S}if(s.scrollTop!=i.scrollTop){x}if(s.offsetHeight!=i.offsetHeight){i.style.height=s.offsetHeight+"px"}}function N{function e(e,t){if(syntaxHighlighterConfig[e]=="normal"){syntaxHighlighterConfig[e]=t}else if(typeof syntaxHighlighterConfig[e]!="undefined"){return}else if(typeof syntaxHighlighterConfig.defaultColor!="undefined"){syntaxHighlighterConfig[e]=syntaxHighlighterConfig.defaultColor}else{syntaxHighlighterConfig[e]=t}}window.syntaxHighlighterConfig=window.syntaxHighlighterConfig||{};e("boldOrItalicColor","#EEE");e("commentColor","#EFE");e("entityColor","#DFD");e("externalLinkColor","#EFF");e("headingColor","#EEE");e("hrColor","#EEE");e("listOrIndentColor","#EFE");e("parameterColor","#FC6");e("signatureColor","#FC6");e("tagColor","#FEF");e("tableColor","#FFC");e("templateColor","#FFC");e("wikilinkColor","#EEF");syntaxHighlighterConfig.timeout=syntaxHighlighterConfig.timeout||100;r=document.createElement("div");i=document.createElement("div");s=document.getElementById("wpTextbox1");var t=document.createElement("style");t.type="text/css";o=t.appendChild(document.createTextNode(""));var n=window.getComputedStyle(s);var u=s.scrollTop;var a=document.activeElement==s;i.style.backgroundColor=n.backgroundColor;i.style.border="1px solid transparent";i.style.boxSizing="border-box";i.style.color="transparent";i.style.direction=n.direction;i.style.fontFamily=n.fontFamily;i.style.fontSize=n.fontSize;i.style.lineHeight="normal";i.style.overflowX="auto";i.style.overflowY="scroll";i.style.tabSize=n.tabSize;i.style.whiteSpace="pre-wrap";i.style.width="100%";i.style.wordWrap="normal";s.style.backgroundColor="transparent";s.style.border="1px inset gray";s.style.boxSizing="border-box";s.style.fontSize=n.fontSize;s.style.lineHeight="normal";s.style.left="0";s.style.margin="0";s.style.overflowX="auto";s.style.overflowY="scroll";s.style.padding="0";s.style.position="absolute";s.style.resize=n.resize=="vertical"||n.resize=="both"?"vertical":"none";s.style.top="0";s.style.width="100%";s.style.wordWrap="normal";i.style.height=s.offsetHeight+"px";s.style.height=i.style.height;r.style.position="relative";s.parentNode.insertBefore(r,s);r.appendChild(s);r.appendChild(i);i.scrollTop=u;s.scrollTop=u;if(a)s.focus;$(".tool-select *").css({zIndex:5});document.head.appendChild(t);s.addEventListener("input",E);s.addEventListener("scroll",S);s.addEventListener("scroll",x);f=setInterval(T,500);E}function C{setTimeout(N,0)}var e=mw.config.get("wgAction");var t=mw.config.get("wgPageContentModel");var n=mw.config.get("wgUserLanguage");var r;var i;var s;var o;var u;var a=-1;var f;var l="\\[(?:\\[|(?:https?:|ftp:)?//|mailto:)|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�][:\\wÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�-\\.·̀-ͯ‿-‿-⁀]*(?=/?>| )|!--[^]*?-->)|(?:https?://|ftp://|mailto:)[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]|^(?:=|[*#:;]+|-{4,})|\\\\'\\\\'(?:\\\\')?|&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);|~{3,5}";var h=new RegExp(l,"gm");var p=c("]][a-zA-Z]*");var d=c("]");var v=c("}}}");var m=c("}}");var g=c("\\|}");var y=c("\n");var b={};var w=$.client.profile.layout=="trident";if((e=="edit"||e=="submit")&&t=="wikitext"&&!w){if(document.readyState=="complete"){C}else{$(window).load(C)}}})