MediaWiki:Gadget-DotsSyntaxHighlighter.js

(function{"use strict";function l(e){return new RegExp("("+e+")\n*|"+f,"gm")}function w{function C(e,t){if(t!=b){n+="'}#s"+f;if(x){n+=":before{";x=false}else{n+=":after{";x=true;++f}if(t){n+="background-color:"+t+";"}n+="content:'";b=t}n+=e}function k(n,r){var i;for(r.lastIndex=t;i=r.exec(e);r.lastIndex=t){if(i[1]){C(e.substring(t,r.lastIndex),n);t=r.lastIndex;return}var s=r.lastIndex-i[0].length;if(t<s){C(e.substring(t,s),n)}t=r.lastIndex;switch(i[0].charAt(0)){case"[":if(i[0].charAt(1)=="["){C("[[",syntaxHighlighterConfig.wikilinkColor||n);k(syntaxHighlighterConfig.wikilinkColor||n,h)}else{C(i[0],syntaxHighlighterConfig.externalLinkColor||n);k(syntaxHighlighterConfig.externalLinkColor||n,p)}break;case"{":if(i[0].charAt(1)=="{"){if(i[0].length==3){C("{{{",syntaxHighlighterConfig.parameterColor||n);k(syntaxHighlighterConfig.parameterColor||n,d)}else{C("{{",syntaxHighlighterConfig.templateColor||n);k(syntaxHighlighterConfig.templateColor||n,v)}}else{C("{|",syntaxHighlighterConfig.tableColor||n);k(syntaxHighlighterConfig.tableColor||n,m)}break;case"<":if(i[0].charAt(1)=="!"){C(i[0],syntaxHighlighterConfig.commentColor||n);break}else{var o=e.indexOf(">",t)+1;if(o==0){C("<",n);t=t-i[0].length+1;break}if(e.charAt(o-2)=="/"){C(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}C(e.substring(t-i[0].length,f),syntaxHighlighterConfig.tagColor||n);t=f}else{C(e.substring(t-i[0].length,o),syntaxHighlighterConfig.tagColor||n);t=o;if(!y[u]){y[u]=l("")}k(syntaxHighlighterConfig.tagColor||n,y[u])}}}break;case"h":case"f":case"m":C(i[0],syntaxHighlighterConfig.externalLinkColor||n);break;case"=":if(/[^=]=+$/.test(e.substring(t,e.indexOf("\n",t)))){C("=",syntaxHighlighterConfig.headingColor||n);k(syntaxHighlighterConfig.headingColor||n,g)}else{C("=",n)}break;case"*":case"#":case":":C(i[0],syntaxHighlighterConfig.listOrIndentColor||n);break;case";":C(";",syntaxHighlighterConfig.headingColor||n);k(syntaxHighlighterConfig.headingColor||n,g);break;case"-":C(i[0],syntaxHighlighterConfig.hrColor||n);break;case"\\":C(i[0],syntaxHighlighterConfig.boldOrItalicColor||n);if(i[0].length==6){if(T){T=false;return}else{T=true;k(syntaxHighlighterConfig.boldOrItalicColor||n,c)}}else{if(N){N=false;return}else{N=true;k(syntaxHighlighterConfig.boldOrItalicColor||n,c)}}break;case"&":C(i[0],syntaxHighlighterConfig.entityColor||n);break;case"~":C(i[0],syntaxHighlighterConfig.signatureColor||n)}}}o=i.value;var e=o.replace(/['\\]/g,"\\$&")+"\n";var t=0;var n="";var f=0;var b;var x=true;var T=false;var N=false;var L=Date.now;k("",c);if(tsyntaxHighlighterConfig.timeout){clearInterval(a);i.removeEventListener("input",w);i.removeEventListener("scroll",E);i.removeEventListener("scroll",S);s.nodeValue="";var O={ca:'S\'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha trigat massa temps. El temps màxim permès per a remarcar és $1ms, i el vostre ordinador ha trigat $2ms. Proveu tancar algunes pestanyes i programes i fer clic en "Mostra la previsualització" o "Mostra els canvis". Si no funciona això, proveu un altre navegador web, i si això no funciona, proveu un ordinador més ràpid.',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.',el:"Η έμφαση σύνταξης έχει απενεργοποιηθεί σε αυτήν τη σελίδα γιατί αργούσε πολύ. Ο μέγιστος επιτρεπτός χρόνος για την έμφαση σύνταξης είναι $1ms και ο υπολογιστής σας έκανε $2ms. Δοκιμάστε να κλείσετε μερικές καρτέλες και προγράμματα και να κάνετε κλικ στην «Εμφάνιση προεπισκόπησης» ή στην «Εμφάνιση αλλαγών». Αν αυτό δεν δουλέψει, δοκιμάστε έναν διαφορετικό περιηγητή και αν ούτε αυτό δουλέψει, δοκιμάστε έναν ταχύτερο υπολογιστή.",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.',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.',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.',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.',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.'};var M=mw.config.get("wgUserLanguage");O=O[M]||O[M.substring(0,M.indexOf("-"))]||O.en;i.style.backgroundColor="";i.style.position="";r.style.color="red";r.style.fontFamily="";r.style.fontWeight="bold";r.style.height="";var _=document.createRange;_.selectNode(r);r.appendChild(_.createContextualFragment(O.replace("$1",syntaxHighlighterConfig.timeout).replace("$2",A-L)))}}function E{r.scrollLeft=i.scrollLeft}function S{r.scrollTop=i.scrollTop}function x{if(i.value!=o){w}if(i.scrollLeft!=r.scrollLeft){E}if(i.scrollTop!=r.scrollTop){S}if(i.offsetHeight!=r.offsetHeight){r.style.height=i.offsetHeight+"px"}}function T{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;n=document.createElement("div");r=document.createElement("div");i=document.getElementById("wpTextbox1");var t=document.createElement("style");t.type="text/css";s=t.appendChild(document.createTextNode(""));var o=window.getComputedStyle(i);var u=i.scrollTop;var f=document.activeElement==i;r.lang=i.lang;r.style.backgroundColor=o.backgroundColor;r.style.border="1px solid transparent";r.style.boxSizing="border-box";r.style.color="transparent";r.style.direction=o.direction;r.style.fontFamily=o.fontFamily;r.style.fontSize=o.fontSize;r.style.lineHeight="normal";r.style.overflowX="auto";r.style.overflowY="scroll";r.style.resize=o.resize=="vertical"||o.resize=="both"?"vertical":"none";r.style.tabSize=o.tabSize;r.style.whiteSpace="pre-wrap";r.style.width="100%";r.style.wordWrap="normal";i.style.backgroundColor="transparent";i.style.border="1px inset gray";i.style.boxSizing="border-box";i.style.fontSize=o.fontSize;i.style.lineHeight="normal";i.style.left="0";i.style.margin="0";i.style.overflowX="auto";i.style.overflowY="scroll";i.style.padding="0";i.style.position="absolute";i.style.resize=r.style.resize;i.style.top="0";i.style.width="100%";i.style.wordWrap="normal";r.style.height=i.offsetHeight+"px";i.style.height=r.style.height;n.style.position="relative";i.parentNode.insertBefore(n,i);n.appendChild(i);n.appendChild(r);r.scrollTop=u;i.scrollTop=u;if(f)i.focus;$(".tool-select *").css({zIndex:5});document.head.appendChild(t);i.addEventListener("input",w);i.addEventListener("scroll",E);i.addEventListener("scroll",S);a=setInterval(x,500);w}function N{setTimeout(T,0)}var e=mw.config.get("wgAction");var t=mw.config.get("wgPageContentModel");var n;var r;var i;var s;var o;var u=-1;var a;var f="\\[(?:\\[|(?: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 c=new RegExp(f,"gm");var h=l("]][a-zA-Z]*");var p=l("]");var d=l("}}}");var v=l("}}");var m=l("\\|}");var g=l("\n");var y={};var b=$.client.profile.layout=="trident";if((e=="edit"||e=="submit")&&t=="wikitext"&&!b){if(document.readyState=="complete"){N}else{$(window).load(N)}}})