MediaWiki:Gadget-DotsSyntaxHighlighter.js: Porovnání verzí

 
Řádek 1: Řádek 1:
//Syntax highlighter with various advantages
+
mw.loader.using("jquery.client",function(){"use strict";var g,h,m,f,p,y,C,x=-1,e=mw.config.get("wgUrlProtocols"),r="&(?:(?: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]+);\n*",t="\\[(?:\\[|(?:"+e+"))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a--ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-][:\\-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ--\\.·̀-ͯ‿--]*(?=/?>| |\n)|!--[^]*?--\x3e\n*)|(?:"+e.replace("|\\/\\/","")+")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|"+r;function b(e){return new RegExp("("+e+")\n*|"+t,"gm")}var v=new RegExp(t,"gm"),w=b("]][a-zA-Z]*"),H=b("]"),k=b("}}}"),z=b("}}"),E=b("\\|}"),S=b("\n"),T={},L={};function F(){var i,d=(f=h.value).replace(/['\\]/g,"\\$&")+"\n",u=0,o="",r=0,n=!0;function c(e,t){t!=i&&(o+="'}#s"+r,n?(o+=":before{",n=!1):(o+=":after{",n=!0,++r),t&&(o+="background-color:"+t+";"),o+="content:'",i=t),o+=e}var e=Date.now();!function e(t,i,o,r){var n;for(i.lastIndex=u;n=i.exec(d);i.lastIndex=u){if(n[1])return c(d.substring(u,i.lastIndex),t),void(u=i.lastIndex);var a=i.lastIndex-n[0].length;switch(u<a&&c(d.substring(u,a),t),u=i.lastIndex,n[0].charAt(0)){case"[":"["==n[0].charAt(1)?(c("[[",syntaxHighlighterConfig.wikilinkColor||t),e(syntaxHighlighterConfig.wikilinkColor||t,w)):(c(n[0],syntaxHighlighterConfig.externalLinkColor||t),e(syntaxHighlighterConfig.externalLinkColor||t,H));break;case"{":"{"==n[0].charAt(1)?3==n[0].length?(c("{{{",syntaxHighlighterConfig.parameterColor||t),e(syntaxHighlighterConfig.parameterColor||t,k)):(c("{{",syntaxHighlighterConfig.templateColor||t),e(syntaxHighlighterConfig.templateColor||t,z)):(c("{|",syntaxHighlighterConfig.tableColor||t),e(syntaxHighlighterConfig.tableColor||t,E));break;case"<":if("!"==n[0].charAt(1)){c(n[0],syntaxHighlighterConfig.commentColor||t);break}var s=d.indexOf(">",u)+1;if(0==s){c("<",t),u=u-n[0].length+1;break}if("/"==d.charAt(s-2))c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s;else{var l=n[0].substring(1);if(-1!=syntaxHighlighterConfig.sourceTags.indexOf(l)){var g="</"+l+">",h=d.indexOf(g,u);-1==h?h=d.length:h+=g.length,c(d.substring(u-n[0].length,h),syntaxHighlighterConfig.tagColor||t),u=h}else-1!=syntaxHighlighterConfig.nowikiTags.indexOf(l)?(c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s,e(syntaxHighlighterConfig.tagColor||t,L[l])):(c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s,T[l]||(T[l]=b("</"+l+">")),e(syntaxHighlighterConfig.tagColor||t,T[l]))}break;case"=":/[^=]=+$/.test(d.substring(u,d.indexOf("\n",u)))?(c("=",syntaxHighlighterConfig.headingColor||t),e(syntaxHighlighterConfig.headingColor||t,S)):c("=",t);break;case"*":case"#":case":":c(n[0],syntaxHighlighterConfig.listOrIndentColor||t);break;case";":c(";",syntaxHighlighterConfig.headingColor||t),e(syntaxHighlighterConfig.headingColor||t,S);break;case"-":c(n[0],syntaxHighlighterConfig.hrColor||t);break;case"\\":if(c(n[0],syntaxHighlighterConfig.boldOrItalicColor||t),6==n[0].length)if(o){if(!r)return;o=!1}else r?o=!0:e(syntaxHighlighterConfig.boldOrItalicColor||t,v,!0,!1);else if(r){if(!o)return;r=!1}else o?r=!0:e(syntaxHighlighterConfig.boldOrItalicColor||t,v,!1,!0);break;case"&":c(n[0],syntaxHighlighterConfig.entityColor||t);break;case"~":c(n[0],syntaxHighlighterConfig.signatureColor||t);break;default:c(n[0],syntaxHighlighterConfig.externalLinkColor||t)}}}("",v),u<d.length&&c(d.substring(u),"");var t=Date.now();if(t-e>syntaxHighlighterConfig.timeout){clearInterval(p),h.removeEventListener("input",F),h.removeEventListener("scroll",I),h.removeEventListener("scroll",O),y.disconnect(),C.disconnect(),m.nodeValue="";var a={be:"Падсьветка сынтаксісу на гэтай старонцы была адключаная, бо заняла шмат часу. Максымальна дапушчальны час апэрацыі — $1мс, а на вашым кампутары яна заняла $2мс. Паспрабуйце зачыніць нейкія закладкі і праграмы і націснуць «Праглядзець» або «Паказаць зьмены». Калі гэта не дапаможа, паспрабуйце іншы броўзэр; калі й гэта не дапаможа, выкарыстайце магутнейшы кампутар.",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áximo 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.',fa:"از آنجایی که زمان زیادی صرف آن می‌شد، برجسته‌سازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجسته‌سازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. می‌توانید بستن برخی سربرگ‌ها و برنامه‌ها و سپس کلیک‌کردن دکمهٔ «پیش‌نمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریع‌تری را بیازمایید.",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.',hy:"Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",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.',it:'L\'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l\'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su "Visualizza anteprima" o "Mostra modifiche". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.',ko:'이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 "미리 보기""차이 보기"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오',pt:'O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em "Mostrar previsão" ou "Mostrar alterações". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.',ru:"Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",sr:"Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром."},s=mw.config.get("wgUserLanguage");return a=a[s]||a[s.substring(0,s.indexOf("-"))]||a.en,h.style.backgroundColor="",h.style.marginTop="0",g.removeAttribute("dir"),g.removeAttribute("lang"),g.setAttribute("style","color:red; font-size:small"),void(g.textContent=a.replace("$1",syntaxHighlighterConfig.timeout).replace("$2",t-e))}if(x<r){for(var l=document.createDocumentFragment();l.appendChild(document.createElement("span")).id="s"+ ++x,x<r;);g.appendChild(l)}m.nodeValue=o.substring(2).replace(/\n/g,"\\A ")+"'}"}function I(){g.scrollLeft=h.scrollLeft}function O(){g.scrollTop=h.scrollTop}function n(){g.dir=h.dir}function a(){h.previousSibling!=g&&(h.parentNode.insertBefore(g,h),C.disconnect(),C.observe(h.parentNode,{childList:!0}))}function s(){if(h.value!=f&&F(),h.scrollLeft!=g.scrollLeft&&I(),h.scrollTop!=g.scrollTop&&O(),h.offsetHeight!=g.offsetHeight){var e=h.offsetHeight+"px";g.style.height=e,h.style.marginTop="-"+e}}function i(){function e(e,t,i){if(void 0===syntaxHighlighterConfig[e]&&(syntaxHighlighterConfig[e]=syntaxHighlighterSiteConfig[e]),"normal"==syntaxHighlighterConfig[e])syntaxHighlighterConfig[e]=t;else{if(void 0!==syntaxHighlighterConfig[e])return;void 0!==syntaxHighlighterConfig.defaultColor&&i?syntaxHighlighterConfig[e]=syntaxHighlighterConfig.defaultColor:syntaxHighlighterConfig[e]=t}}window.syntaxHighlighterSiteConfig=window.syntaxHighlighterSiteConfig||{},window.syntaxHighlighterConfig=window.syntaxHighlighterConfig||{},e("backgroundColor","#FFF",!1),e("foregroundColor","#000",!1),e("boldOrItalicColor","#EEE",!0),e("commentColor","#EFE",!0),e("entityColor","#DFD",!0),e("externalLinkColor","#EFF",!0),e("headingColor","#EEE",!0),e("hrColor","#EEE",!0),e("listOrIndentColor","#EFE",!0),e("parameterColor","#FC6",!0),e("signatureColor","#FC6",!0),e("tagColor","#FEF",!0),e("tableColor","#FFC",!0),e("templateColor","#FFC",!0),e("wikilinkColor","#EEF",!0),syntaxHighlighterConfig.nowikiTags=syntaxHighlighterConfig.nowikiTags||syntaxHighlighterSiteConfig.nowikiTags||["nowiki","pre"],syntaxHighlighterConfig.sourceTags=syntaxHighlighterConfig.sourceTags||syntaxHighlighterSiteConfig.sourceTags||["math","syntaxhighlight","source","timeline","hiero"],syntaxHighlighterConfig.timeout=syntaxHighlighterConfig.timeout||syntaxHighlighterSiteConfig.timeout||50,syntaxHighlighterConfig.nowikiTags.forEach(function(e){L[e]=new RegExp("(</"+e+">)\n*|"+r,"gm")}),g=document.createElement("div"),h=document.getElementById("wpTextbox1");var t=document.createElement("style");m=t.appendChild(document.createTextNode(""));var i=window.getComputedStyle(h),o="vertical"==i.resize||"both"==i.resize?"vertical":"none";g.dir=h.dir,g.id="wpTextbox0",g.lang=h.lang,g.style.backgroundColor=syntaxHighlighterConfig.backgroundColor,g.style.border="1px solid transparent",g.style.boxSizing="border-box",g.style.clear=i.clear,g.style.color="transparent",g.style.fontFamily=i.fontFamily,g.style.fontSize=i.fontSize,g.style.lineHeight="normal",g.style.marginBottom="0",g.style.marginLeft="0",g.style.marginRight="0",g.style.marginTop="0",g.style.overflowX="auto",g.style.overflowY="scroll",g.style.resize=o,g.style.tabSize=i.tabSize,g.style.whiteSpace="pre-wrap",g.style.width="100%",g.style.wordWrap="normal",h.style.backgroundColor="transparent",h.style.border="1px inset gray",h.style.boxSizing="border-box",h.style.color=syntaxHighlighterConfig.foregroundColor,h.style.fontSize=i.fontSize,h.style.lineHeight="normal",h.style.marginBottom=i.marginBottom,h.style.marginLeft="0",h.style.marginRight="0",h.style.overflowX="auto",h.style.overflowY="scroll",h.style.padding="0",h.style.resize=o,h.style.width="100%",h.style.wordWrap="normal",h.style.height=g.style.height=h.offsetHeight+"px",h.style.marginTop=-h.offsetHeight+"px",h.parentNode.insertBefore(g,h),document.head.appendChild(t),h.addEventListener("input",F),h.addEventListener("scroll",I),h.addEventListener("scroll",O),(y=new MutationObserver(n)).observe(h,{attributes:!0}),(C=new MutationObserver(a)).observe(h.parentNode,{childList:!0}),p=setInterval(s,500),F()}var o=mw.config.get("wgAction"),l=$.client.profile().layout;"edit"!=o&&"submit"!=o||"wikitext"!=mw.config.get("wgPageContentModel")||"trident"==l||"edge"==l||("complete"==document.readyState?i():window.addEventListener("load",i))});
//See [[User:Remember the dot/Syntax highlighter]] for more information
 
 
(function () {
 
    "use strict";
 
 
    //variables that are preserved between function calls
 
    var textboxContainer;
 
    var wpTextbox0;
 
    var wpTextbox1;
 
    var syntaxStyleTextNode;
 
    var lastText;
 
    var maxSpanNumber = -1; //the number of the last span available, used to tell if creating additional spans is necessary
 
    var highlightSyntaxIfNeededIntervalID;
 
 
    /* Define context-specific regexes, one for every common token that ends the
 
      current context.
 
 
      An attempt has been made to search for the most common syntaxes first,
 
      thus maximizing performance. Syntaxes that begin with the same character
 
      are searched for at the same time.
 
 
      Wiki syntaxes from most common to least common:
 
          [[internal link]] [http:// named external link]
 
          {{template}} {{{template parameter}}} {| table |}
 
          <tag> <!-- comment -->
 
          http:// bare external link
 
          =Heading= * unordered list # ordered list : indent ; small heading  pre ---- horizontal line
 
          ''italic'' '''bold'''
 
          three tildes username four tildes signature five tildes timestamp
 
          &entity;
 
 
      The tag-matching regex follows the XML standard closely so that users
 
      won't feel like they have to escape sequences that MediaWiki will never
 
      consider to be tags.
 
 
      Only entities for characters which need to be escaped or cannot be
 
      unambiguously represented in a monospace font are highlighted, such as
 
      Greek letters that strongly resemble Latin letters. Use of other entities
 
      is discouraged as a matter of style. For the same reasons, numeric
 
      entities should be in hexadecimal (giving character codes in decimal only
 
      adds confusion).
 
 
      Flags: g for global search, m for make ^ match the beginning of each line
 
      and $ the end of each line
 
    */
 
    var breakerRegexBase = "\\[(?:\\[|(?:https?:|ftp:)?//|mailto:)|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| )|!--[^]*?-->)|(?: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}";
 
    function breakerRegexWithPrefix(prefix)
 
    {
 
        //the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.
 
        //suck up newlines into the end token to avoid creating spans with nothing but newlines in them
 
        return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");
 
    }
 
    var defaultBreakerRegex          = new RegExp(breakerRegexBase, "gm");
 
    var wikilinkBreakerRegex          = breakerRegexWithPrefix("]][a-zA-Z]*");
 
    var namedExternalLinkBreakerRegex = breakerRegexWithPrefix("]");
 
    var parameterBreakerRegex        = breakerRegexWithPrefix("}}}");
 
    var templateBreakerRegex          = breakerRegexWithPrefix("}}");
 
    var tableBreakerRegex            = breakerRegexWithPrefix("\\|}");
 
    var headingBreakerRegex          = breakerRegexWithPrefix("\n");
 
    var tagBreakerRegexCache          = {};
 
 
    //browser workaround triggers
 
    var gecko  = ($.client.profile().layout == "gecko");
 
    var presto  = ($.client.profile().layout == "presto");
 
    var trident = ($.client.profile().layout == "trident");
 
    var webkit  = ($.client.profile().layout == "webkit") && ($.client.profile().platform != "win");
 
 
    function highlightSyntax()
 
    {
 
        lastText = wpTextbox1.value;
 
        /* Backslashes and apostrophes are CSS-escaped at the beginning and all
 
          parsing regexes and functions are designed to match. On the other hand,
 
          newlines are not escaped until written so that in the regexes ^ and $
 
          work for both newlines and the beginning or end of the string. */
 
        var text = lastText.replace(/['\\]/g, "\\$&") + "\n"; //add a newline to fix scrolling and parsing issues
 
        var i = 0; //the location of the parser as it goes through var text
 
 
        var css = "";
 
        var spanNumber = 0;
 
        var lastColor;
 
        var before = true;
 
 
        /* Highlighting bold or italic markup presents a special challenge
 
          because the actual MediaWiki parser uses multiple passes to determine
 
          which ticks represent start tags and which represent end tags.
 
          Because that would be too slow for us here, we instead keep track of
 
          what kinds of unclosed opening ticks have been encountered and use
 
          that to make a good guess as to whether the next ticks encountered
 
          are an opening tag or a closing tag.
 
 
          The major downsides to this method are that '''apostrophe italic''
 
          and ''italic apostrophe''' are not highlighted correctly, and bold
 
          and italic are both highlighted in the same color. */
 
        var assumedBold = false;
 
        var assumedItalic = false;
 
 
        //workaround for Opera
 
        //there are two problems here:
 
        //  <textarea>.scrollLeft is automatically scrolled beyond the value limit that http://www.w3.org/TR/cssom-view/#scroll-an-element specifies
 
        //  <div> will hide a character or two underneath the scrollbar instead of adding a scrollbar
 
        //this workaround forces wpTextbox0 to allow scrolling arbitrarily
 
        if (presto)
 
        {
 
            text += new Array(wpTextbox1.scrollWidth).join(" ");
 
        }
 
 
        //writes text into to-be-created span elements of wpTextbox0 using :before and :after pseudo-elements
 
        //both :before and :after are used because using two pseudo-elements per span is significantly faster than doubling the number of spans required
 
        function writeText(text, color)
 
        {
 
            //workaround for Chromium on Linux breaking before spaces in the div but after spaces in the textarea
 
            if (webkit)
 
            {
 
                text = text.replace(/ +/g, "$&\u200B");
 
            }
 
 
            //no need to use another span if using the same color
 
            if (color != lastColor)
 
            {
 
                //whitespace is omitted in the hope of increasing performance
 
                css += "'}#s" + spanNumber; //spans will be created with IDs s0 through sN
 
                if (before)
 
                {
 
                    css += ":before{";
 
                    before = false;
 
                }
 
                else
 
                {
 
                    css += ":after{";
 
                    before = true;
 
                    ++spanNumber;
 
                }
 
                if (color)
 
                {
 
                    //"background-color" is 6 characters longer than "background" but the browser processes it faster
 
                    css += "background-color:" + color + ";";
 
                }
 
                css += "content:'";
 
                lastColor = color;
 
            }
 
            css += text;
 
        }
 
 
        function highlightBlock(color, breakerRegex)
 
        {
 
            var match;
 
 
            for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)
 
            {
 
                if (match[1])
 
                {
 
                    //end token found
 
                    writeText(text.substring(i, breakerRegex.lastIndex), color);
 
                    i = breakerRegex.lastIndex;
 
                    return;
 
                }
 
 
                var endIndexOfLastColor = breakerRegex.lastIndex - match[0].length;
 
                if (i < endIndexOfLastColor) //avoid calling writeText with text == "" to improve performance
 
                {
 
                    writeText(text.substring(i, endIndexOfLastColor), color);
 
                }
 
 
                i = breakerRegex.lastIndex;
 
 
                switch (match[0].charAt(0)) //cases in this switch should be arranged from most common to least common
 
                {
 
                    case "[":
 
                        if (match[0].charAt(1) == "[")
 
                        {
 
                            //wikilink
 
                            writeText("[[", syntaxHighlighterConfig.wikilinkColor || color);
 
                            highlightBlock(syntaxHighlighterConfig.wikilinkColor || color, wikilinkBreakerRegex);
 
                        }
 
                        else
 
                        {
 
                            //named external link
 
                            writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);
 
                            highlightBlock(syntaxHighlighterConfig.externalLinkColor || color, namedExternalLinkBreakerRegex);
 
                        }
 
                        break;
 
                    case "{":
 
                        if (match[0].charAt(1) == "{")
 
                        {
 
                            if (match[0].length == 3)
 
                            {
 
                                //parameter
 
                                writeText("{{{", syntaxHighlighterConfig.parameterColor || color);
 
                                highlightBlock(syntaxHighlighterConfig.parameterColor || color, parameterBreakerRegex);
 
                            }
 
                            else
 
                            {
 
                                //template
 
                                writeText("{{", syntaxHighlighterConfig.templateColor || color);
 
                                highlightBlock(syntaxHighlighterConfig.templateColor || color, templateBreakerRegex);
 
                            }
 
                        }
 
                        else //|
 
                        {
 
                            //table
 
                            writeText("{|", syntaxHighlighterConfig.tableColor || color);
 
                            highlightBlock(syntaxHighlighterConfig.tableColor || color, tableBreakerRegex);
 
                        }
 
                        break;
 
                    case "<":
 
                        if (match[0].charAt(1) == "!")
 
                        {
 
                            //comment tag
 
                            writeText(match[0], syntaxHighlighterConfig.commentColor || color);
 
                            break;
 
                        }
 
                        else
 
                        {
 
                            //some other kind of tag, search for its end
 
                            //the search is made easier because XML attributes may not contain the character ">"
 
                            var tagEnd = text.indexOf(">", i) + 1;
 
                            if (tagEnd == 0)
 
                            {
 
                                //not a tag, just a "<" with some text after it
 
                                writeText("<", color);
 
                                i = i - match[0].length + 1;
 
                                break;
 
                            }
 
 
                            if (text.charAt(tagEnd - 2) == "/")
 
                            {
 
                                //empty tag
 
                                writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);
 
                                i = tagEnd;
 
                            }
 
                            else
 
                            {
 
                                var tagName = match[0].substring(1);
 
 
                                //again, cases are ordered from most common to least common
 
                                if (/^(?:nowiki|pre|math|syntaxhighlight|source|timeline|hiero)$/.test(tagName))
 
                                {
 
                                    //tag that can contain only plain text
 
                                    var stopAfter = "</" + tagName + ">";
 
                                    var endIndex = text.indexOf(stopAfter, i);
 
                                    if (endIndex == -1)
 
                                    {
 
                                        endIndex = text.length;
 
                                    }
 
                                    else
 
                                    {
 
                                        endIndex += stopAfter.length;
 
                                    }
 
                                    writeText(text.substring(i - match[0].length, endIndex), syntaxHighlighterConfig.tagColor || color);
 
                                    i = endIndex;
 
                                }
 
                                else
 
                                {
 
                                    //ordinary tag
 
                                    writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);
 
                                    i = tagEnd;
 
                                    if (!tagBreakerRegexCache[tagName])
 
                                    {
 
                                        tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");
 
                                    }
 
                                    highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);
 
                                }
 
                            }
 
                        }
 
                        break;
 
                    case "h":
 
                    case "f":
 
                    case "m":
 
                        //bare external link
 
                        writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);
 
                        break;
 
                    case "=":
 
                        if (/[^=]=+$/.test(text.substring(i, text.indexOf("\n", i)))) //the line begins and ends with an equals sign and has something else in the middle
 
                        {
 
                            //heading
 
                            writeText("=", syntaxHighlighterConfig.headingColor || color);
 
                            highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);
 
                        }
 
                        else
 
                        {
 
                            writeText("=", color); //move on, process this line as regular wikitext
 
                        }
 
                        break;
 
                    case "*":
 
                    case "#":
 
                    case ":":
 
                        //unordered list, ordered list, indent, small heading
 
                        //just highlight the marker
 
                        writeText(match[0], syntaxHighlighterConfig.listOrIndentColor || color);
 
                        break;
 
                    case ";":
 
                        //small heading
 
                        writeText(";", syntaxHighlighterConfig.headingColor || color);
 
                        highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);
 
                        break;
 
                    case "-":
 
                        //horizontal line
 
                        writeText(match[0], syntaxHighlighterConfig.hrColor || color);
 
                        break;
 
                    case "\\":
 
                        writeText(match[0], syntaxHighlighterConfig.boldOrItalicColor || color);
 
                        if (match[0].length == 6)
 
                        {
 
                            //bold
 
                            if (assumedBold)
 
                            {
 
                                //end tag
 
                                assumedBold = false;
 
                                return;
 
                            }
 
                            else
 
                            {
 
                                //start tag
 
                                assumedBold = true;
 
                                highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex);
 
                            }
 
                        }
 
                        else
 
                        {
 
                            //italic
 
                            if (assumedItalic)
 
                            {
 
                                //end tag
 
                                assumedItalic = false;
 
                                return;
 
                            }
 
                            else
 
                            {
 
                                //start tag
 
                                assumedItalic = true;
 
                                highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex);
 
                            }
 
                        }
 
                        break;
 
                    case "&":
 
                        //entity
 
                        writeText(match[0], syntaxHighlighterConfig.entityColor || color);
 
                        break;
 
                    case "~":
 
                        //username, signature, timestamp
 
                        writeText(match[0], syntaxHighlighterConfig.signatureColor || color);
 
                }
 
            }
 
        }
 
 
 
        //start!
 
        var startTime = Date.now();
 
        highlightBlock("", defaultBreakerRegex);
 
 
        //output the leftovers (if any) to make sure whitespace etc. matches
 
        if (i < text.length)
 
        {
 
            writeText(text.substring(i), "");
 
        }
 
 
        //do we have enough span elements to match the generated CSS?
 
        while (maxSpanNumber < spanNumber)
 
        {
 
            wpTextbox0.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;
 
        }
 
 
        /* finish CSS: move the extra '} from the beginning to the end and CSS-
 
          escape newlines. CSS ignores the space after the hex code of the
 
          escaped character */
 
        syntaxStyleTextNode.nodeValue = css.substring(2).replace(/\n/g, "\\A ") + "'}";
 
 
        //if highlighting took too long, disable it.
 
        var endTime = Date.now();
 
        /*if (typeof(bestTime) == "undefined")
 
        {
 
            window.bestTime = 10000;
 
            highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);
 
        }
 
        else
 
        {
 
            if (endTime - startTime < bestTime)
 
            {
 
                bestTime = endTime - startTime;
 
                document.title = bestTime;
 
            }
 
        }//*/
 
        if (endTime - startTime > syntaxHighlighterConfig.timeout)
 
        {
 
            clearInterval(highlightSyntaxIfNeededIntervalID);
 
            syntaxStyleTextNode.nodeValue = "";
 
            wpTextbox1.removeEventListener("input", highlightSyntax);
 
 
            var errorMessage = {};
 
            errorMessage["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.";
 
            errorMessage["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.";
 
            errorMessage["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.";
 
            errorMessage["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.";
 
            errorMessage["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.";
 
 
            errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage["en"];
 
 
            wpTextbox1.style.backgroundColor = "";
 
            wpTextbox1.style.position = "";
 
            wpTextbox0.style.color = "red";
 
            wpTextbox0.style.fontFamily = "";
 
            wpTextbox0.style.fontWeight = "bold";
 
            wpTextbox0.style.height = "";
 
 
            var range = document.createRange();
 
            range.selectNode(wpTextbox0); //chrome can't live without this
 
            wpTextbox0.appendChild(range.createContextualFragment(errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime)));
 
        }
 
    }
 
 
    function syncScrollX()
 
    {
 
        wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;
 
    }
 
 
    function syncScrollY()
 
    {
 
        wpTextbox0.scrollTop = wpTextbox1.scrollTop;
 
    }
 
 
    //this function runs once every 500ms to detect changes to wpTextbox1's text that the input event does not catch
 
    //this happens when another script changes the text without knowing that the syntax highlighter needs to be informed
 
    function highlightSyntaxIfNeeded()
 
    {
 
        if (wpTextbox1.value != lastText)
 
        {
 
            highlightSyntax();
 
        }
 
        if (wpTextbox1.scrollLeft != wpTextbox0.scrollLeft)
 
        {
 
            syncScrollX();
 
        }
 
        if (wpTextbox1.scrollTop != wpTextbox0.scrollTop)
 
        {
 
            syncScrollY();
 
        }
 
    }
 
 
    function setup()
 
    {
 
        function configureColor(parameterName, hardcodedFallback)
 
        {
 
            if (syntaxHighlighterConfig[parameterName] == "normal")
 
            {
 
                syntaxHighlighterConfig[parameterName] = hardcodedFallback;
 
            }
 
            else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")
 
            {
 
                return;
 
            }
 
            else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined")
 
            {
 
                syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;
 
            }
 
            else
 
            {
 
                syntaxHighlighterConfig[parameterName] = hardcodedFallback;
 
            }
 
        }
 
 
        window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};
 
 
        //use 3-digit colors instead of 6-digit colors for performance
 
        configureColor("boldOrItalicColor",  "#EEE"); //gray
 
        configureColor("commentColor",       "#EFE"); //green
 
        configureColor("entityColor",       "#DFD"); //green
 
        configureColor("externalLinkColor",  "#EFF"); //cyan
 
        configureColor("headingColor",      "#EEE"); //gray
 
        configureColor("hrColor",            "#EEE"); //gray
 
        configureColor("listOrIndentColor""#EFE"); //green
 
        configureColor("parameterColor",     "#FC6"); //orange
 
        configureColor("signatureColor",     "#FC6"); //orange
 
        configureColor("tagColor",           "#FEF"); //pink
 
        configureColor("tableColor",        "#FFC"); //yellow
 
        configureColor("templateColor",     "#FFC"); //yellow
 
        configureColor("wikilinkColor",     "#EEF"); //blue
 
 
        syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || 100;
 
 
        textboxContainer = document.createElement("div");
 
        wpTextbox0 = document.createElement("div");
 
        wpTextbox1 = document.getElementById("wpTextbox1");
 
 
        var syntaxStyleElement = document.createElement("style");
 
        syntaxStyleElement.type = "text/css";
 
        syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));
 
 
        //the styling of the textbox and the background div must be kept very similar
 
        wpTextbox0.style.backgroundColor = window.getComputedStyle(wpTextbox1).backgroundColor;
 
        if (wpTextbox0.style.backgroundColor == "transparent")
 
        {
 
            //Opera and perhaps others return "transparent" instead of "white" if the background color is not specified
 
            //http://www.w3.org/TR/1998/REC-CSS2-19980512/cascade.html#computed-value is ambiguous as to what should happen
 
            wpTextbox0.style.backgroundColor = "white";
 
        }
 
        wpTextbox0.style.border          = "1px solid transparent";
 
        wpTextbox0.style.boxSizing      = "border-box";
 
        wpTextbox0.style.MozBoxSizing    = "border-box";
 
        wpTextbox0.style.color          = "transparent"; //makes it look just a little bit smoother
 
        wpTextbox0.style.direction      = window.getComputedStyle(wpTextbox1).direction; //because your UI language set in Preferences may have a different direction than the edit box
 
        wpTextbox0.style.fontFamily      = window.getComputedStyle(wpTextbox1).fontFamily;
 
        wpTextbox0.style.fontSize        = window.getComputedStyle(wpTextbox1).fontSize;
 
        wpTextbox0.style.lineHeight      = "normal";
 
        wpTextbox0.style.overflowX      = "auto";
 
        wpTextbox0.style.overflowY      = "scroll";
 
        wpTextbox0.style.whiteSpace      = "pre-wrap";
 
        wpTextbox0.style.width          = "100%";
 
        wpTextbox0.style.wordWrap        = "normal"; //see below
 
 
        wpTextbox1.style.backgroundColor = "transparent";
 
        wpTextbox1.style.border          = "1px inset gray";
 
        wpTextbox1.style.boxSizing      = "border-box";
 
        wpTextbox1.style.MozBoxSizing    = "border-box";
 
        wpTextbox1.style.lineHeight      = "normal";
 
        wpTextbox1.style.margin          = "0"; //firefox wants to put a 1px margin on the top and bottom of the textbox, which throws it out of alignment with wpTextbox0
 
        wpTextbox1.style.overflowX      = "auto";
 
        wpTextbox1.style.overflowY      = "scroll";
 
        wpTextbox1.style.padding        = "0";
 
        wpTextbox1.style.position        = "absolute";
 
        wpTextbox1.style.resize          = "none";
 
        wpTextbox1.style.left            = "0";
 
        wpTextbox1.style.top            = "0";
 
        wpTextbox1.style.width          = "100%";
 
        wpTextbox1.style.wordWrap        = "normal"; //overall more visually appealing, and essential for Opera
 
 
        //lock both heights to pixel values so that the browser zoom feature works better
 
        wpTextbox0.style.height          = wpTextbox1.offsetHeight + "px";
 
        wpTextbox1.style.height          = wpTextbox0.style.height;
 
 
        if (gecko) //workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=157846
 
        {
 
            wpTextbox0.style.paddingLeft = "1px";
 
            wpTextbox0.style.paddingRight = "1px";
 
        }
 
        else if (presto) //workaround for Opera
 
        {
 
            //wpTextbox0 must allow arbitrary scrolling on Opera (see above), so wpTextbox1 must also be given a horizontal scrollbar
 
            //also, if overflowX is auto then when the window is resized the standard line breaking algorithm is not followed
 
            wpTextbox1.style.overflowX = "scroll";
 
        }
 
 
        textboxContainer.style.position = "relative";
 
        wpTextbox1.parentNode.insertBefore(textboxContainer, wpTextbox1);
 
        textboxContainer.appendChild(wpTextbox1);
 
        textboxContainer.appendChild(wpTextbox0);
 
 
        //fix drop-downs in editing toolbar
 
        $('.tool-select *').css({zIndex: 5});
 
 
        document.head.appendChild(syntaxStyleElement);
 
 
        wpTextbox1.addEventListener("input", highlightSyntax);
 
        wpTextbox1.addEventListener("scroll", syncScrollX);
 
        wpTextbox1.addEventListener("scroll", syncScrollY);
 
        highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);
 
        highlightSyntax();
 
    }
 
 
    function queueSetup()
 
    {
 
        setTimeout(setup, 0);
 
    }
 
 
 
    //enable the highlighter only when editing wikitext pages
 
    //in the future a separate parser could be added for CSS and JS pages
 
    //blacklist Internet Explorer, it's just too broken
 
    if ((wgAction == "edit" || wgAction == "submit") && wgPageContentModel == "wikitext" && !trident)
 
    {
 
        /* The highlighter has to run after any other script (such as the
 
          editing toolbar) that reparents wpTextbox1. We make sure that
 
          everything else has run by waiting for the page to completely load
 
          and then adding a call to the setup function to the end of the event
 
          queue, so that the setup function runs after any other triggers set
 
          on the load event. */
 
        if (document.readyState == "complete")
 
        {
 
            queueSetup();
 
        }
 
        else
 
        {
 
            $(window).load(queueSetup);
 
        }
 
    }
 
})();
 

Aktuální verze z 16. 9. 2019, 13:05

mw.loader.using("jquery.client",function(){"use strict";var g,h,m,f,p,y,C,x=-1,e=mw.config.get("wgUrlProtocols"),r="&(?:(?: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]+);\n*",t="\\[(?:\\[|(?:"+e+"))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�][:\\wÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�-\\.·̀-ͯ‿-‿-⁀]*(?=/?>| |\n)|!--[^]*?--\x3e\n*)|(?:"+e.replace("|\\/\\/","")+")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|"+r;function b(e){return new RegExp("("+e+")\n*|"+t,"gm")}var v=new RegExp(t,"gm"),w=b("]][a-zA-Z]*"),H=b("]"),k=b("}}}"),z=b("}}"),E=b("\\|}"),S=b("\n"),T={},L={};function F(){var i,d=(f=h.value).replace(/['\\]/g,"\\$&")+"\n",u=0,o="",r=0,n=!0;function c(e,t){t!=i&&(o+="'}#s"+r,n?(o+=":before{",n=!1):(o+=":after{",n=!0,++r),t&&(o+="background-color:"+t+";"),o+="content:'",i=t),o+=e}var e=Date.now();!function e(t,i,o,r){var n;for(i.lastIndex=u;n=i.exec(d);i.lastIndex=u){if(n[1])return c(d.substring(u,i.lastIndex),t),void(u=i.lastIndex);var a=i.lastIndex-n[0].length;switch(u<a&&c(d.substring(u,a),t),u=i.lastIndex,n[0].charAt(0)){case"[":"["==n[0].charAt(1)?(c("[[",syntaxHighlighterConfig.wikilinkColor||t),e(syntaxHighlighterConfig.wikilinkColor||t,w)):(c(n[0],syntaxHighlighterConfig.externalLinkColor||t),e(syntaxHighlighterConfig.externalLinkColor||t,H));break;case"{":"{"==n[0].charAt(1)?3==n[0].length?(c("{{{",syntaxHighlighterConfig.parameterColor||t),e(syntaxHighlighterConfig.parameterColor||t,k)):(c("{{",syntaxHighlighterConfig.templateColor||t),e(syntaxHighlighterConfig.templateColor||t,z)):(c("{|",syntaxHighlighterConfig.tableColor||t),e(syntaxHighlighterConfig.tableColor||t,E));break;case"<":if("!"==n[0].charAt(1)){c(n[0],syntaxHighlighterConfig.commentColor||t);break}var s=d.indexOf(">",u)+1;if(0==s){c("<",t),u=u-n[0].length+1;break}if("/"==d.charAt(s-2))c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s;else{var l=n[0].substring(1);if(-1!=syntaxHighlighterConfig.sourceTags.indexOf(l)){var g="</"+l+">",h=d.indexOf(g,u);-1==h?h=d.length:h+=g.length,c(d.substring(u-n[0].length,h),syntaxHighlighterConfig.tagColor||t),u=h}else-1!=syntaxHighlighterConfig.nowikiTags.indexOf(l)?(c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s,e(syntaxHighlighterConfig.tagColor||t,L[l])):(c(d.substring(u-n[0].length,s),syntaxHighlighterConfig.tagColor||t),u=s,T[l]||(T[l]=b("</"+l+">")),e(syntaxHighlighterConfig.tagColor||t,T[l]))}break;case"=":/[^=]=+$/.test(d.substring(u,d.indexOf("\n",u)))?(c("=",syntaxHighlighterConfig.headingColor||t),e(syntaxHighlighterConfig.headingColor||t,S)):c("=",t);break;case"*":case"#":case":":c(n[0],syntaxHighlighterConfig.listOrIndentColor||t);break;case";":c(";",syntaxHighlighterConfig.headingColor||t),e(syntaxHighlighterConfig.headingColor||t,S);break;case"-":c(n[0],syntaxHighlighterConfig.hrColor||t);break;case"\\":if(c(n[0],syntaxHighlighterConfig.boldOrItalicColor||t),6==n[0].length)if(o){if(!r)return;o=!1}else r?o=!0:e(syntaxHighlighterConfig.boldOrItalicColor||t,v,!0,!1);else if(r){if(!o)return;r=!1}else o?r=!0:e(syntaxHighlighterConfig.boldOrItalicColor||t,v,!1,!0);break;case"&":c(n[0],syntaxHighlighterConfig.entityColor||t);break;case"~":c(n[0],syntaxHighlighterConfig.signatureColor||t);break;default:c(n[0],syntaxHighlighterConfig.externalLinkColor||t)}}}("",v),u<d.length&&c(d.substring(u),"");var t=Date.now();if(t-e>syntaxHighlighterConfig.timeout){clearInterval(p),h.removeEventListener("input",F),h.removeEventListener("scroll",I),h.removeEventListener("scroll",O),y.disconnect(),C.disconnect(),m.nodeValue="";var a={be:"Падсьветка сынтаксісу на гэтай старонцы была адключаная, бо заняла шмат часу. Максымальна дапушчальны час апэрацыі — $1мс, а на вашым кампутары яна заняла $2мс. Паспрабуйце зачыніць нейкія закладкі і праграмы і націснуць «Праглядзець» або «Паказаць зьмены». Калі гэта не дапаможа, паспрабуйце іншы броўзэр; калі й гэта не дапаможа, выкарыстайце магутнейшы кампутар.",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áximo 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.',fa:"از آنجایی که زمان زیادی صرف آن می‌شد، برجسته‌سازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجسته‌سازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. می‌توانید بستن برخی سربرگ‌ها و برنامه‌ها و سپس کلیک‌کردن دکمهٔ «پیش‌نمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریع‌تری را بیازمایید.",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.',hy:"Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",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.',it:'L\'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l\'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su "Visualizza anteprima" o "Mostra modifiche". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.',ko:'이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 "미리 보기"나 "차이 보기"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오',pt:'O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em "Mostrar previsão" ou "Mostrar alterações". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.',ru:"Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",sr:"Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром."},s=mw.config.get("wgUserLanguage");return a=a[s]||a[s.substring(0,s.indexOf("-"))]||a.en,h.style.backgroundColor="",h.style.marginTop="0",g.removeAttribute("dir"),g.removeAttribute("lang"),g.setAttribute("style","color:red; font-size:small"),void(g.textContent=a.replace("$1",syntaxHighlighterConfig.timeout).replace("$2",t-e))}if(x<r){for(var l=document.createDocumentFragment();l.appendChild(document.createElement("span")).id="s"+ ++x,x<r;);g.appendChild(l)}m.nodeValue=o.substring(2).replace(/\n/g,"\\A ")+"'}"}function I(){g.scrollLeft=h.scrollLeft}function O(){g.scrollTop=h.scrollTop}function n(){g.dir=h.dir}function a(){h.previousSibling!=g&&(h.parentNode.insertBefore(g,h),C.disconnect(),C.observe(h.parentNode,{childList:!0}))}function s(){if(h.value!=f&&F(),h.scrollLeft!=g.scrollLeft&&I(),h.scrollTop!=g.scrollTop&&O(),h.offsetHeight!=g.offsetHeight){var e=h.offsetHeight+"px";g.style.height=e,h.style.marginTop="-"+e}}function i(){function e(e,t,i){if(void 0===syntaxHighlighterConfig[e]&&(syntaxHighlighterConfig[e]=syntaxHighlighterSiteConfig[e]),"normal"==syntaxHighlighterConfig[e])syntaxHighlighterConfig[e]=t;else{if(void 0!==syntaxHighlighterConfig[e])return;void 0!==syntaxHighlighterConfig.defaultColor&&i?syntaxHighlighterConfig[e]=syntaxHighlighterConfig.defaultColor:syntaxHighlighterConfig[e]=t}}window.syntaxHighlighterSiteConfig=window.syntaxHighlighterSiteConfig||{},window.syntaxHighlighterConfig=window.syntaxHighlighterConfig||{},e("backgroundColor","#FFF",!1),e("foregroundColor","#000",!1),e("boldOrItalicColor","#EEE",!0),e("commentColor","#EFE",!0),e("entityColor","#DFD",!0),e("externalLinkColor","#EFF",!0),e("headingColor","#EEE",!0),e("hrColor","#EEE",!0),e("listOrIndentColor","#EFE",!0),e("parameterColor","#FC6",!0),e("signatureColor","#FC6",!0),e("tagColor","#FEF",!0),e("tableColor","#FFC",!0),e("templateColor","#FFC",!0),e("wikilinkColor","#EEF",!0),syntaxHighlighterConfig.nowikiTags=syntaxHighlighterConfig.nowikiTags||syntaxHighlighterSiteConfig.nowikiTags||["nowiki","pre"],syntaxHighlighterConfig.sourceTags=syntaxHighlighterConfig.sourceTags||syntaxHighlighterSiteConfig.sourceTags||["math","syntaxhighlight","source","timeline","hiero"],syntaxHighlighterConfig.timeout=syntaxHighlighterConfig.timeout||syntaxHighlighterSiteConfig.timeout||50,syntaxHighlighterConfig.nowikiTags.forEach(function(e){L[e]=new RegExp("(</"+e+">)\n*|"+r,"gm")}),g=document.createElement("div"),h=document.getElementById("wpTextbox1");var t=document.createElement("style");m=t.appendChild(document.createTextNode(""));var i=window.getComputedStyle(h),o="vertical"==i.resize||"both"==i.resize?"vertical":"none";g.dir=h.dir,g.id="wpTextbox0",g.lang=h.lang,g.style.backgroundColor=syntaxHighlighterConfig.backgroundColor,g.style.border="1px solid transparent",g.style.boxSizing="border-box",g.style.clear=i.clear,g.style.color="transparent",g.style.fontFamily=i.fontFamily,g.style.fontSize=i.fontSize,g.style.lineHeight="normal",g.style.marginBottom="0",g.style.marginLeft="0",g.style.marginRight="0",g.style.marginTop="0",g.style.overflowX="auto",g.style.overflowY="scroll",g.style.resize=o,g.style.tabSize=i.tabSize,g.style.whiteSpace="pre-wrap",g.style.width="100%",g.style.wordWrap="normal",h.style.backgroundColor="transparent",h.style.border="1px inset gray",h.style.boxSizing="border-box",h.style.color=syntaxHighlighterConfig.foregroundColor,h.style.fontSize=i.fontSize,h.style.lineHeight="normal",h.style.marginBottom=i.marginBottom,h.style.marginLeft="0",h.style.marginRight="0",h.style.overflowX="auto",h.style.overflowY="scroll",h.style.padding="0",h.style.resize=o,h.style.width="100%",h.style.wordWrap="normal",h.style.height=g.style.height=h.offsetHeight+"px",h.style.marginTop=-h.offsetHeight+"px",h.parentNode.insertBefore(g,h),document.head.appendChild(t),h.addEventListener("input",F),h.addEventListener("scroll",I),h.addEventListener("scroll",O),(y=new MutationObserver(n)).observe(h,{attributes:!0}),(C=new MutationObserver(a)).observe(h.parentNode,{childList:!0}),p=setInterval(s,500),F()}var o=mw.config.get("wgAction"),l=$.client.profile().layout;"edit"!=o&&"submit"!=o||"wikitext"!=mw.config.get("wgPageContentModel")||"trident"==l||"edge"==l||("complete"==document.readyState?i():window.addEventListener("load",i))});