User:Shirayuki/Syntax highlighter.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (â-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (â-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
//forked from [[User:Remember the dot/Syntax highlighter.js]]
//Syntax highlighter with various advantages
//See [[User:Remember the dot/Syntax highlighter]] for more information
/* This file may be used under the terms of any of the following
licenses, as well as any later version of the same licenses:
GNU General Public License 2.0
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
Creative Commons Attribution-ShareAlike 3.0 Unported License
<https://creativecommons.org/licenses/by-sa/3.0/>
GNU Free Documentation License 1.2
<https://www.gnu.org/licenses/old-licenses/fdl-1.2.html>
*/
mw.loader.using("jquery.client", function() {
"use strict";
//variables that are preserved between function calls
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;
var attributeObserver;
var parentObserver;
/* 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.
Supported 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 ---- 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).
Newlines are sucked up into ending tokens (including comments, bare
external links, lists, horizontal lines, signatures, entities, etc.) to
avoid creating spans with nothing but newlines in them.
Flags: g for global search, m for make ^ match the beginning of each line
and $ the end of each line
*/
var wgUrlProtocols = mw.config.get("wgUrlProtocols");
var entityRegexBase = "&(?:(?: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*";
var breakerRegexBase = "\\[(?:\\[|(?:" + wgUrlProtocols + "))|\\{(?:\\{\\{?|\\|)|<(?:[: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]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:" + wgUrlProtocols.replace("|\\/\\/", "") + ")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|" + entityRegexBase;
function breakerRegexWithPrefix(prefix)
{
//the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.
return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");
}
function nowikiTagBreakerRegex(tagName)
{
return new RegExp("(</" + tagName + ">)\n*|" + entityRegexBase, "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 = {};
var nowikiTagBreakerRegexCache = {};
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;
//writes text into to-be-created span elements of wpTextbox0 using ::after pseudo-elements
function writeText(text, color)
{
//no need to use another span if using the same color
if (color != lastColor)
{
css += "'}";
//whitespace is omitted in the hope of increasing performance
if (color)
{
//"background-color" is 6 characters longer than "background" but the browser processes it faster
css += "#s" + spanNumber + "{background-color:" + color + "}";
}
css += "#s" + spanNumber + "::after{content:'"; //spans will be created with IDs s0 through sN
lastColor = color;
++spanNumber;
}
css += text;
}
/* About assumedBold and assumedItalic:
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.
To permit ''The best<ref>''Reference Title''</ref> book ever'',
assumedBold and assumedItalic are saved on the stack and reset to
undefined (essentially, false) when recursing into a new block. */
// Upd start
// function highlightBlock(color, breakerRegex, assumedBold, assumedItalic)
function highlightBlock(color, breakerRegex, assumedBold, assumedItalic, endTag)
// Upd end
{
var match;
for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)
{
if (match[1])
{
//end token found
// Upd start
// writeText(text.substring(i, breakerRegex.lastIndex), color);
if (!endTag) {
writeText(text.substring(i, breakerRegex.lastIndex), color);
} else {
var pos = text.substring(i, breakerRegex.lastIndex).indexOf(endTag);
if (pos == -1) {
writeText(text.substring(i, breakerRegex.lastIndex), color);
} else {
//content
writeText(text.substring(i, i + pos), color);
//end tag
writeText(text.substring(i + pos, breakerRegex.lastIndex), syntaxHighlighterConfig.tagColor || color);
}
}
// Upd end
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) != "/")
{
var tagName = match[0].substring(1);
if (syntaxHighlighterConfig.voidTags.indexOf(tagName) == -1)
{
if (syntaxHighlighterConfig.sourceTags.indexOf(tagName) != -1)
{
//tag that contains text in a different programming language
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 if (syntaxHighlighterConfig.nowikiTags.indexOf(tagName) != -1)
{
//tag that can contain only HTML entities
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);
i = tagEnd;
highlightBlock(syntaxHighlighterConfig.tagColor || color, nowikiTagBreakerRegexCache[tagName]);
}
else
{
//ordinary tag
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);
i = tagEnd;
if (!tagBreakerRegexCache[tagName])
{
tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");
}
// Upd start
// highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);
if (syntaxHighlighterConfig.ignoreTags.indexOf(tagName) == -1) {
highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);
} else {
//specify end tag
highlightBlock(color, tagBreakerRegexCache[tagName], undefined, undefined, "</" + tagName + ">");
}
// Upd end
}
break;
}
}
//empty tag
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);
i = tagEnd;
}
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);
// Del start
// disable to avoid bugs on translatable pages
// highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);
// Del end
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
if (assumedItalic)
{
//end of bold part of bold-italic block
//block is now italic-only
assumedBold = false;
}
else
{
//end of bold block
return;
}
}
else
{
//start tag
if (assumedItalic)
{
//start of bold part of previously italic-only block
//block is now bold-italic
assumedBold = true;
}
else
{
//start of bold block
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, true, false);
}
}
}
else
{
//italic
if (assumedItalic)
{
//end tag
if (assumedBold)
{
//end of italic part of bold-italic block
//block is now bold-only
assumedItalic = false;
}
else
{
//end of italic block
return;
}
}
else
{
//start tag
if (assumedBold)
{
//start of italic part of previously bold-only block
//block is now bold-italic
assumedItalic = true;
}
else
{
//start of italic block
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, false, true);
}
}
}
break;
case "&":
//entity
writeText(match[0], syntaxHighlighterConfig.entityColor || color);
break;
case "~":
//username, signature, timestamp
writeText(match[0], syntaxHighlighterConfig.signatureColor || color);
break;
default:
//bare external link
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || 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), "");
}
//if highlighting took too long, disable it.
var endTime = Date.now();
/*if (typeof(bestTime) == "undefined")
{
window.bestTime = endTime - startTime;
document.title = bestTime;
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);
}
else
{
if (endTime - startTime < bestTime)
{
bestTime = endTime - startTime;
document.title = bestTime;
}
}//*/
if (endTime - startTime > syntaxHighlighterConfig.timeout)
{
clearInterval(highlightSyntaxIfNeededIntervalID);
wpTextbox1.removeEventListener("input", highlightSyntax);
wpTextbox1.removeEventListener("scroll", syncScrollX);
wpTextbox1.removeEventListener("scroll", syncScrollY);
attributeObserver.disconnect();
parentObserver.disconnect();
syntaxStyleTextNode.nodeValue = "";
var errorMessage = {
ar: "ŘšŮء٠تŮ
ŮŮز بŮاإ اŮŘŹŮ
ŮŘŠ ŮŮ Ůذ٠اŮŘľŮŘŘŠ ŮŘŁŮ٠استغع٠ŮŮŘŞŮا ءŮŮŮŮا. اŮŘŘŻ اŮŘŁŮؾ٠اŮŮ
ŘłŮ
ŮŘ Ř¨Ů ŮŮŮŘŞ اŮŘŞŮ
ŮŮز ŮŮ $1 Ů
ŮŮ٠؍اŮŮŘŠ Ř Ůاستغع٠؏Ůاز اŮŮŮ
بŮŮŘŞŘą اŮ؎اؾ ب٠$2 Ů
ŮŮ٠؍اŮŮŘŠ. ŘاŮŮ ŘĽŘşŮا٠بؚ؜ ŘšŮاŮ
ات اŮتبŮŮب ŮاŮبعاŮ
ŘŹ ŮاŮŮŮŘą ŮŮ٠ؼظŮاع اŮŮ
ؚاŮŮŘŠÂť أ٠ؼظŮاع اŮŘŞŘşŮŮعات. ؼذا ŮŮ
ŮŮŮŘ Ř°ŮŮ Ř Ů؏عب Ů
ŘŞŘľŮŘ ŮŮب Ů
ŘŽŘŞŮŮŘ§Ř Ůؼذا ŮŮ
ŮŮŘŹŘ Ř°ŮŮŘ Ů؏عب ŘŹŮاز ŮŮ
بŮŮŘŞŘą أسعؚ",
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 زŮ
ا٠ŮŰاز داشت. Ů
ŰâŘŞŮاŮŰŘŻ Ř¨ŘłŘŞŮ Ř¨ŘąŘŽŰ ŘłŘąŘ¨ŘąÚŻâŮا ٠بعŮاŮ
ŮâŮا ٠سٞس ÚŠŮŰÚŠâڊعد٠دڊŮ
ŮŮ ÂŤŮžŰŘ´âŮŮ
اŰŘ´Âť Űا ÂŤŮŮ
اŰŘ´ ŘŞŘşŰŰعات عا بŰازŮ
اŰŰŘŻ. اگع ŘŹŮاب Ůداد Ů
ŘąŮŘąÚŻŘą ŘŻŰÚŻŘąŰ ŘąŘ§ اŮ
ŘŞŘا٠ڊŮŰŘŻŘ Ů Ř§ÚŻŘą باز ŮŮ
ŘŹŮاب ŮŘŻŘ§ŘŻŘ ŘąŘ§ŰاŮŮ٠سعŰŘšâŘŞŘąŰ ŘąŘ§ بŰازŮ
اŰŰŘŻ.",
fi: "Syntaksin korostus on pois käytÜstä tällä sivulla, koska siinä kesti liian kauan. Suurin sallittu korostukseen käytetty aika on $1ms, ja tietokoneellasi kesti $2ms. Kokeile sulkea joitain välilehtiä tai ohjelmia ja paina \"Esikatsele\" tai \"Näytä muutokset\". Jos se ei toimi, kokeile toista selainta, ja jos se ei toimi, kokeile nopeampaa tietokonetta.",
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.",
hu: "A szintaxiskiemelĂŠs ezen az oldalon le lett tiltva, mert tĂşl sokĂĄig tartott. A maximĂĄlis engedĂŠlyezett kiemelĂŠsi idĹ $1 ms, ĂŠs a gĂŠped $2 ms-ig dolgozott. PrĂłbĂĄlj meg bezĂĄrni nĂŠhĂĄny fĂźlet ĂŠs programot, ĂŠs klikkelj az âElĹnĂŠzet megtekintĂŠseâ vagy a âVĂĄltoztatĂĄsok megtekintĂŠseâ gombra. Ha ez nem mĹąkĂśdik, prĂłbĂĄlj meg egy mĂĄsik bĂśngĂŠszĹt, ĂŠs ha ez sem mĹąkĂśdik, prĂłbĂĄld meg egy gyorsabb gĂŠpen.",
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.",
ja: "ăăŽăăźă¸ă§ăŽć§ćăŽĺźˇčŞżčĄ¨ç¤şăŻăćéăăăăăăăăăçĄĺšăŤăŞăăžăăă訹厚ăăăćéăŽć大ĺ¤ăŻ$1ăăŞç§ă§ăăĺŠç¨ăŽăłăłăăĽăźăżăźă§ăŻ$2ăăŞç§ăăăăžăăăăăă¤ăăŽăżăăăăă°ăŠă ăéăăŚăăăăŹăăĽăźă襨示ăăžăăŻă塎ĺă襨示ăăăŻăŞăăŻăăŚăżăŚăă ăăăăăăćŠč˝ăăŞăĺ ´ĺăŻăĺĽăŽWebăăŠăŚăśăźăă芌ăăă ăăăăăăćŠč˝ăăŞăĺ ´ĺăŻăăăéŤéăŞăłăłăăĽăźăżăźă§ă芌ăăă ăăă",
ko: "ě´ ëŹ¸ěěěě ëŹ¸ë˛ ę°ěĄ°ę° ë돴 ě¤ë 깸ëŹě í´ě ëěěľëë¤. ěľëëĄ í ëšë ę°ěĄ° ěę°ě $1msě¸ë°, ëšě ě ěť´í¨í°ë $2msě´ë ęą¸ë ¸ěľëë¤. íęłź íëĄęˇ¸ë¨ě ěźëś ëŤěźě íě \"미댏 보기\"ë \"ě°¨ě´ ëł´ę¸°\"뼟 í´ëŚíě기 ë°ëëë¤. ë§ě˝ ěëíě§ ěěźëŠ´ ë¤ëĽ¸ ěš ë¸ëźě°ě ëĄ ěëí´ëł´ěęł , ꡸ëë ěë늴 ë ëš ëĽ¸ ěť´í¨í°ëĽź ě´ěŠíěěě¤",
pl: "PodĹwietlanie skĹadni na tej stronie zostaĹo wyĹÄ
czone, poniewaĹź wczytywanie trwaĹo zbyt dĹugo. Maksymalny dozwolony czas wynosi $1ms, Twojemu komputerowi zajÄĹo to $2ms. SprĂłbuj zamknÄ
Ä kilka zakĹadek lub programĂłw w tle, a nastÄpnie kliknij âPokaĹź podglÄ
dâ lub âPodglÄ
d zmianâ. JeĹli to nie zadziaĹa, wyprĂłbuj innÄ
przeglÄ
darkÄ internetowÄ
lub szybszy komputer.",
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. ĐОкŃŃĐ°ŃŃĐľ СаŃвОŃиŃи ноко каŃŃиŃĐľ и ĐżŃОгŃаПо иНи кНикниŃĐľ на âĐŃикаМи ĐżŃĐľŃĐżŃогНодâ иНи âĐŃикаМи иСПоноâ. ĐкО ŃĐž но Ńади, пОкŃŃĐ°ŃŃĐľ ŃĐ° Đ´ŃŃгиП вой-ĐżŃогНодаŃоП, Đ° акО и ŃĐ°Đ´Đ° но Ńади, пОкŃŃĐ°ŃŃĐľ ŃĐ° ĐąŃМиП ŃĐ°ŃŃнаŃОП.",
vec: "L'evidensiasion de Ĺe sintasi so sta voxe Ĺa xe dexabiĹitada par che Ĺa ga dimandĂ masa tenpo. El tenpo mĂ semo par l'evidensiasion Ĺa xe de $1ms e al to dispoxidivo a ghene xe cadesti $2ms. Proa a sarar calche scheda e programa e recarga Ĺa pĂ jina schiciando so \"Varda Ĺa anteprima\" o \"Mostra canbiaminti\". Se no el funsiona oncora, proa co on altro navegador web difarente e, cofĂ Ăšltema alternadiva, proa a doparar on dispoxidivo pĂŹ sèĹero.",
zh: "ć¤é é˘ä¸çčŞćłçŞĺşéĄŻç¤şč˘ŤçŚç¨ďźĺ çşĺŽčąč˛ťçćé太éˇăĺ
訹ççŞĺşéĄŻç¤şćéćéˇçş$1母ç§ďźčć¨çč¨çŽćŠĺçş$2母ç§ăčŤĺ芌ééä¸äşć¨çą¤ĺç¨ĺşďźçśĺžĺŽćâ饯示é 茽âćâ饯示ć´ćšâăĺŚćä¸čľˇä˝ç¨ďźčŤĺ芌使ç¨ĺ
śäťçś˛é ç茽ĺ¨ďźĺŚćčżä¸čľˇä˝ç¨ďźčŤĺ芌使ç¨é庌ć´ĺżŤçč¨çŽćŠă",
};
var wgUserLanguage = mw.config.get("wgUserLanguage");
errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage.en;
wpTextbox1.style.backgroundColor = "";
wpTextbox1.style.marginTop = "0";
wpTextbox0.removeAttribute("dir");
wpTextbox0.removeAttribute("lang");
wpTextbox0.setAttribute("style", "color:red; font-size:small");
wpTextbox0.textContent = errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime);
return;
}
//do we have enough span elements to match the generated CSS?
//this step isn't included in the above benchmark because it takes a highly variable amount of time
if (maxSpanNumber < spanNumber)
{
var fragment = document.createDocumentFragment();
do
{
fragment.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;
}
while (maxSpanNumber < spanNumber);
wpTextbox0.appendChild(fragment);
}
/* 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 */
css = css.substring(2).replace(/\n/g, "\\A ") + "'}";
//visibility:hidden prevents the background text from being picked up during in-page search in Firefox
css += "#wpTextbox0>span::after{visibility:hidden}";
syntaxStyleTextNode.nodeValue = css;
}
function syncScrollX()
{
wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;
}
function syncScrollY()
{
wpTextbox0.scrollTop = wpTextbox1.scrollTop;
}
function syncTextDirection()
{
wpTextbox0.dir = wpTextbox1.dir;
}
function syncParent()
{
if (wpTextbox1.previousSibling != wpTextbox0)
{
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);
parentObserver.disconnect();
parentObserver.observe(wpTextbox1.parentNode, {childList: true});
}
}
//this function runs once every 500ms to detect changes to wpTextbox1 that the input event does not catch
//for example, 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();
}
var wpTextbox0Height = window.getComputedStyle(wpTextbox0).height;
//if wpTextbox1 is hidden, its offsetHeight is 0 even though its style says something else
var wpTextbox1Height = wpTextbox1.offsetHeight ? window.getComputedStyle(wpTextbox1).height : "0px";
if (wpTextbox0Height != wpTextbox1Height)
{
wpTextbox0.style.height = wpTextbox1Height;
wpTextbox1.style.marginTop = "-" + wpTextbox1Height;
}
}
function setup()
{
wpTextbox1 = document.getElementById("wpTextbox1");
if (!wpTextbox1) return; //another script (such as the Visual Editor) has removed the edit box
//ensure that the highlighter has not already been loaded
//this prevents a browser freeze if a user had it installed in their personal JavaScript and then it was added to the site-wide JavaScript
if (document.getElementById("wpTextbox0")) return;
function configureColor(parameterName, hardcodedFallback, defaultOk)
{
if (typeof(syntaxHighlighterConfig[parameterName]) == "undefined")
{
syntaxHighlighterConfig[parameterName] = syntaxHighlighterSiteConfig[parameterName];
}
if (syntaxHighlighterConfig[parameterName] == "normal")
{
syntaxHighlighterConfig[parameterName] = hardcodedFallback;
}
else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")
{
return;
}
else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined" && defaultOk)
{
syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;
}
else
{
syntaxHighlighterConfig[parameterName] = hardcodedFallback;
}
}
window.syntaxHighlighterSiteConfig = window.syntaxHighlighterSiteConfig || {};
window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};
//use 3-digit colors instead of 6-digit colors for performance
configureColor("backgroundColor", "#FFF", false); //white
configureColor("foregroundColor", "#000", false); //black
configureColor("boldOrItalicColor", "#EEE", true); //gray
configureColor("commentColor", "#EFE", true); //green
configureColor("entityColor", "#DFD", true); //green
configureColor("externalLinkColor", "#EFF", true); //cyan
configureColor("headingColor", "#EEE", true); //gray
configureColor("hrColor", "#EEE", true); //gray
configureColor("listOrIndentColor", "#EFE", true); //green
configureColor("parameterColor", "#FC6", true); //orange
configureColor("signatureColor", "#FC6", true); //orange
configureColor("tagColor", "#FEF", true); //pink
configureColor("tableColor", "#FFC", true); //yellow
configureColor("templateColor", "#FFC", true); //yellow
configureColor("wikilinkColor", "#EEF", true); //blue
//tag lists are ordered from most common to least common
syntaxHighlighterConfig.nowikiTags = syntaxHighlighterConfig.nowikiTags || syntaxHighlighterSiteConfig.nowikiTags || ["nowiki", "pre"];
syntaxHighlighterConfig.sourceTags = syntaxHighlighterConfig.sourceTags || syntaxHighlighterSiteConfig.sourceTags || ["math", "syntaxhighlight", "source", "timeline", "hiero"];
//voidTags is for people who really don't want to use a slash to close certain tags, although other empty tags require the slash
syntaxHighlighterConfig.voidTags = syntaxHighlighterConfig.voidTags || syntaxHighlighterSiteConfig.voidTags || [];
syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || syntaxHighlighterSiteConfig.timeout || 20;
// Add start
syntaxHighlighterConfig.ignoreTags = syntaxHighlighterConfig.ignoreTags || syntaxHighlighterSiteConfig.ignoreTags || ["tvar", "translate"];
// Add end
syntaxHighlighterConfig.nowikiTags.forEach(function(tagName) {
nowikiTagBreakerRegexCache[tagName] = nowikiTagBreakerRegex(tagName);
});
wpTextbox0 = document.createElement("div");
var syntaxStyleElement = document.createElement("style");
syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));
//the styling of the textbox and the background div must be kept very similar
var wpTextbox1Style = window.getComputedStyle(wpTextbox1);
//horizontal resize would look horribly choppy, better to make the user resize the browser window instead
var resize = (wpTextbox1Style.resize == "vertical" || wpTextbox1Style.resize == "both" ? "vertical" : "none");
wpTextbox0.dir = wpTextbox1.dir;
wpTextbox0.id = "wpTextbox0";
wpTextbox0.lang = wpTextbox1.lang; //lang determines which font "monospace" is
wpTextbox0.style.backgroundColor = syntaxHighlighterConfig.backgroundColor;
wpTextbox0.style.borderBottomLeftRadius = wpTextbox1Style.borderBottomLeftRadius;
wpTextbox0.style.borderBottomRightRadius = wpTextbox1Style.borderBottomRightRadius;
wpTextbox0.style.borderBottomStyle = wpTextbox1Style.borderBottomStyle;
wpTextbox0.style.borderBottomWidth = wpTextbox1Style.borderBottomWidth;
wpTextbox0.style.borderColor = "transparent";
wpTextbox0.style.borderLeftStyle = wpTextbox1Style.borderLeftStyle;
wpTextbox0.style.borderLeftWidth = wpTextbox1Style.borderLeftWidth;
wpTextbox0.style.borderRightStyle = wpTextbox1Style.borderRightStyle;
wpTextbox0.style.borderRightWidth = wpTextbox1Style.borderRightWidth;
wpTextbox0.style.borderTopLeftRadius = wpTextbox1Style.borderTopLeftRadius;
wpTextbox0.style.borderTopRightRadius = wpTextbox1Style.borderTopRightRadius;
wpTextbox0.style.borderTopStyle = wpTextbox1Style.borderTopStyle;
wpTextbox0.style.borderTopWidth = wpTextbox1Style.borderTopWidth;
wpTextbox0.style.boxSizing = "border-box";
wpTextbox0.style.clear = wpTextbox1Style.clear;
wpTextbox0.style.fontFamily = wpTextbox1Style.fontFamily;
wpTextbox0.style.fontSize = wpTextbox1Style.fontSize;
wpTextbox0.style.lineHeight = "normal";
wpTextbox0.style.marginBottom = "0";
wpTextbox0.style.marginLeft = "0";
wpTextbox0.style.marginRight = "0";
wpTextbox0.style.marginTop = "0";
wpTextbox0.style.overflowX = "auto";
wpTextbox0.style.overflowY = "scroll";
wpTextbox0.style.resize = resize;
wpTextbox0.style.tabSize = wpTextbox1Style.tabSize;
wpTextbox0.style.whiteSpace = "pre-wrap";
wpTextbox0.style.width = "100%";
wpTextbox0.style.wordWrap = "normal"; //see below
wpTextbox1.style.backgroundColor = "transparent";
wpTextbox1.style.borderBottomLeftRadius = wpTextbox1Style.borderBottomLeftRadius;
wpTextbox1.style.borderBottomRightRadius = wpTextbox1Style.borderBottomRightRadius;
wpTextbox1.style.borderBottomStyle = wpTextbox1Style.borderBottomStyle;
wpTextbox1.style.borderBottomWidth = wpTextbox1Style.borderBottomWidth;
wpTextbox1.style.borderLeftStyle = wpTextbox1Style.borderLeftStyle;
wpTextbox1.style.borderLeftWidth = wpTextbox1Style.borderLeftWidth;
wpTextbox1.style.borderRightStyle = wpTextbox1Style.borderRightStyle;
wpTextbox1.style.borderRightWidth = wpTextbox1Style.borderRightWidth;
wpTextbox1.style.borderTopLeftRadius = wpTextbox1Style.borderTopLeftRadius;
wpTextbox1.style.borderTopRightRadius = wpTextbox1Style.borderTopRightRadius;
wpTextbox1.style.borderTopStyle = wpTextbox1Style.borderTopStyle;
wpTextbox1.style.borderTopWidth = wpTextbox1Style.borderTopWidth;
wpTextbox1.style.boxSizing = "border-box";
wpTextbox1.style.clear = wpTextbox1Style.clear;
wpTextbox1.style.color = syntaxHighlighterConfig.foregroundColor;
wpTextbox1.style.fontFamily = wpTextbox1Style.fontFamily;
wpTextbox1.style.fontSize = wpTextbox1Style.fontSize;
wpTextbox1.style.lineHeight = "normal";
wpTextbox1.style.marginLeft = "0";
wpTextbox1.style.marginRight = "0";
wpTextbox1.style.marginTop = "-" + wpTextbox1Style.height;
wpTextbox1.style.overflowX = "auto";
wpTextbox1.style.overflowY = "scroll";
wpTextbox1.style.padding = "0";
wpTextbox1.style.resize = resize;
wpTextbox1.style.tabSize = wpTextbox1Style.tabSize;
wpTextbox1.style.whiteSpace = "pre-wrap";
wpTextbox1.style.width = "100%";
wpTextbox1.style.wordWrap = "normal"; //overall more visually appealing
//insert wpTextbox0 underneath wpTextbox1
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);
document.head.appendChild(syntaxStyleElement);
wpTextbox1.addEventListener("input", highlightSyntax);
wpTextbox1.addEventListener("scroll", syncScrollX);
wpTextbox1.addEventListener("scroll", syncScrollY);
attributeObserver = new MutationObserver(syncTextDirection);
attributeObserver.observe(wpTextbox1, {attributes: true});
parentObserver = new MutationObserver(syncParent);
parentObserver.observe(wpTextbox1.parentNode, {childList: true});
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);
highlightSyntax();
}
//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 and Edge, they're just too broken
var wgAction = mw.config.get("wgAction");
var layoutEngine = $.client.profile().layout;
if ((wgAction == "edit" || wgAction == "submit") && mw.config.get("wgPageContentModel") == "wikitext" && layoutEngine != "trident" && layoutEngine != "edge")
{
//give other scripts an opportunity to set syntaxHighlighterConfig
if (document.readyState == "complete")
{
setup();
}
else
{
window.addEventListener("load", setup);
}
}
});