MediaWiki:Gadget-DotsSyntaxHighlighter.js

(function{"use strict";function a(e){return new RegExp("("+e+")|"+u,"gm")}function x{function k(e,n){e=e.replace(/\n/g,"\\A ");if(n==T){b+=e}else{if(E&&(/[!"#%&)*+,-.:;=\?>\\\]\|\}~]$/.test(b)&&/^[<\[\{]/.test(e)||b.substring(-1)=="-"&&e.substring(0,2)=="\\'")){e="​"+e}if(N){C="s"+S;if(S>s){t.appendChild(document.createElement("span")).id=C;s++}b+="'}#"+C+":before"}else{b+="'}#"+C+":after";S++}b+="{background-color:"+n+";content:'"+e;N=!N;T=n}}function L(t,n){n.lastIndex=u;var r;while(r=n.exec(e)){if(r[1]){k(e.substring(u,n.lastIndex),t);u=n.lastIndex;return}var i=e.substring(u,n.lastIndex-r[0].length);if(i!=""){k(i,t)}u=n.lastIndex;switch(r[0].charAt(0)){case"[":if(r[0].charAt(1)=="["){k("[[",syntaxHighlighterConfig.wikilinkColor||t);L(syntaxHighlighterConfig.wikilinkColor||t,l)}else{k(r[0],syntaxHighlighterConfig.externalLinkColor||t);L(syntaxHighlighterConfig.externalLinkColor||t,c)}break;case"{":if(r[0].charAt(1)=="{"){if(r[0].charAt(2)=="{"){k("{{{",syntaxHighlighterConfig.parameterColor||t);L(syntaxHighlighterConfig.parameterColor||t,h)}else{k("{{",syntaxHighlighterConfig.templateColor||t);L(syntaxHighlighterConfig.templateColor||t,p)}}else{k("{|",syntaxHighlighterConfig.tableColor||t);L(syntaxHighlighterConfig.tableColor||t,d)}break;case"<":if(r[0].charAt(1)=="!"){k(r[0],syntaxHighlighterConfig.commentColor||t);break}else{var s=e.indexOf(">",u)+1;if(s==0){k("<");u=u-r[0].length+1;break}if(e.charAt(s-2)=="/"){k(e.substring(u-r[0].length,s),syntaxHighlighterConfig.tagColor||t);u=s}else{var o=r[0].substring(1);var f="";if(/nowiki|pre|math|syntaxhighlight|source|timeline|hiero/.test(o)){var b=e.indexOf(f,u);if(b==-1){b=e.length}else{b+=f.length}k(e.substring(u-r[0].length,b),syntaxHighlighterConfig.tagColor||t);u=b}else{k(e.substring(u-r[0].length,s),syntaxHighlighterConfig.tagColor||t);u=s;if(!y[o]){y[o]=a(f)}L(syntaxHighlighterConfig.tagColor||t,y[o])}}}break;case"h":case"f":case"m":k(r[0],syntaxHighlighterConfig.externalLinkColor||t);break;case"=":if(/[^=]=+$/.test(e.substring(u,e.indexOf("\n",u)))){k("=",syntaxHighlighterConfig.headingColor||t);L(syntaxHighlighterConfig.headingColor||t,v)}else{k("=",t)}break;case"*":case"#":case":":k(r[0],syntaxHighlighterConfig.listAndIndentColor||t);break;case";":k(";",syntaxHighlighterConfig.headingColor||t);L(syntaxHighlighterConfig.headingColor||t,v);break;case"-":k(r[0],syntaxHighlighterConfig.hrColor);break;case"\\":if(r[0].length==6){k("\\'\\'\\'",syntaxHighlighterConfig.boldColor||t);L(syntaxHighlighterConfig.boldColor||t,m)}else{k("\\'\\'",syntaxHighlighterConfig.italicColor||t);L(syntaxHighlighterConfig.italicColor||t,g)}break;case"~":k(r[0],syntaxHighlighterConfig.signatureColor||t);break;case"&":k(r[0],syntaxHighlighterConfig.entityColor||t)}n.lastIndex=u}}i=n.value;var e=i.replace(/['\\]/g,"\\$&")+"\n";var u=0;var b="";var S=0;var T;var N=true;var C;if(w){e+=(new Array(n.scrollWidth)).join(" ")}var A=Date.now;L("inherit",f);k(e.substring(u),"inherit");r.textContent=b.substring(2)+"'}";var O=Date.now;if(O-A>100){clearInterval(o);r.textContent="";n.removeEventListener("input",x);var M={};M["ca"]='S\'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè tu ordinador es massa lent. El temps màxim permès per a remarcar és 100ms, i el teu ordinador ha trigat $1ms. Si utilitzes Chrome o Safari, això potser a causa de què el remarcador ha de treballar voltant WebKit bug 17427. 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.';M["en"]='Syntax highlighting on this page was disabled because your computer is too slow. The maximum allowed highlighting time is 100ms, and your computer took $1ms. If you are using Chrome or Safari, this could be because the syntax highlighter has to work around WebKit bug 17427. 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.';M["es"]='Se desactivó el resaltar de sintaxis en esta página porque tu ordenador es demasiado lento. El tiempo máximum permitido para resaltar es 100ms, y tu ordenador tardó $1ms. Si usas Chrome o Safari, esto puede ser a causa de que el resaltador tiene que trabajar alrededor de WebKit bug 17427. 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.';M["io"]='Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke tua ordinatro es tro lenta. La maxima permisata hailaitala tempo es 100ms, e tua ordinatro konsumis $1ms. Se tu uzas Chrome o Safari, co povas esar pro ke la sintaxo-hailaitero mustas laborar cirkum WebKit bug 17427. 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.';M=M[wgUserLanguage]||M[wgUserLanguage.substring(0,wgUserLanguage.indexOf("-"))]||M["en"];n.style.backgroundColor="";n.style.position="";t.style.color="red";t.style.fontFamily="";t.style.fontWeight="bold";t.style.height="";t.appendChild(document.createRange.createContextualFragment(M.replace("$1",O-A)))}}function T{t.scrollLeft=n.scrollLeft}function N{t.scrollTop=n.scrollTop}function C{if(n.value!=i){x}if(n.scrollLeft!=t.scrollLeft){T}if(n.scrollTop!=t.scrollTop){N}}function k{function i(e,t){if(syntaxHighlighterConfig[e]=="normal"){syntaxHighlighterConfig[e]=t}else if(syntaxHighlighterConfig[e]){return}else if(typeof syntaxHighlighterConfig.defaultColor!="undefined"){syntaxHighlighterConfig[e]=syntaxHighlighterConfig.defaultColor}else{syntaxHighlighterConfig[e]=t}}window.syntaxHighlighterConfig=window.syntaxHighlighterConfig||{};i("commentColor","#E6FFE6");i("boldColor","#E5E5E5");i("entityColor","#E6FFE6");i("externalLinkColor","#E6FFFF");i("italicColor","#E5E5E5");i("headingColor","#E5E5E5");i("hrColor","#E5E5E5");i("listAndIndentColor","#E6FFE6");i("parameterColor","#FFCC66");i("signatureColor","#FFCC66");i("tagColor","#FFE6FF");i("tableColor","#FFFFCC");i("templateColor","#FFFFCC");i("wikilinkColor","#E6E6FF");e=document.createElement("div");t=document.createElement("div");n=document.getElementById("wpTextbox1");r=document.createElement("style");t.style.backgroundColor=window.getComputedStyle(n).backgroundColor;if(t.style.backgroundColor=="transparent"){t.style.backgroundColor="white"}t.style.border="1px solid transparent";t.style.boxSizing="border-box";t.style.MozBoxSizing="border-box";t.style.WebkitBoxSizing="border-box";t.style.color="transparent";t.style.fontFamily=window.getComputedStyle(n).fontFamily;t.style.fontSize=window.getComputedStyle(n).fontSize;t.style.lineHeight="normal";t.style.overflowX="auto";t.style.overflowY="scroll";t.style.whiteSpace="pre-wrap";t.style.width="100%";t.style.wordWrap="normal";n.style.backgroundColor="transparent";n.style.border="1px inset gray";n.style.boxSizing="border-box";n.style.MozBoxSizing="border-box";n.style.WebkitBoxSizing="border-box";n.style.lineHeight="normal";n.style.margin=0;n.style.overflowX="auto";n.style.overflowY="scroll";n.style.padding=0;n.style.position="absolute";n.style.resize="none";n.style.left=0;n.style.top=0;n.style.width="100%";n.style.wordWrap="normal";t.style.height=n.offsetHeight+"px";if(b){t.style.paddingLeft="1px";t.style.paddingRight="1px"}else if(w){n.style.overflowX="scroll"}e.style.position="relative";n.parentNode.insertBefore(e,n);e.appendChild(n);e.appendChild(t);$(".tool-select *").css({zIndex:5});document.head.appendChild(r);n.addEventListener("input",x);n.addEventListener("scroll",T);n.addEventListener("scroll",N);o=setInterval(C,500);x}var e;var t;var n;var r;var i;var s=-1;var o;var u="\\[(?:\\[|(?:https?:|ftp:)?//|mailto:)|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�][:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�-\\.0-9·̀-ͯ‿-‿-⁀]*|!--[^]*?-->)|(?:https?://|ftp://|mailto:)[^\\s\"<>[\\]|]*[^\\s\",\\.:;<>[\\]|]|^(?:=|[*#:;]+|-{4,})|\\\\'\\\\'(?:\\\\')?|~{3,5}|&(?:[a-z]+|#(?:\\d+|[xX][0-9a-fA-F]+));";var f=new RegExp(u,"gm");var l=a("]][a-zA-Z]*");var c=a("]");var h=a("}}}");var p=a("}}");var d=a("\\|}");var v=a("\n");var m=a("\\\\'\\\\'\\\\'");var g=a("\\\\'\\\\'");var y={};var b=$.client.profile.layout=="gecko";var w=$.client.profile.layout=="presto";var E=$.client.profile.layout=="webkit";var S=$.client.profile.layout=="trident";if((wgAction=="edit"||wgAction=="submit")&&!((wgNamespaceNumber==2||wgNamespaceNumber==8)&&/\.(css|js)$/.test(wgTitle))&&!S){if(document.readyState=="complete"){k}else{$(window).load(k)}}})