Toggle menu
2
16
17
151
The My Singing Monsters Modding Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
Content added Content deleted
(simple syntax highlighter (probably works))
 
m (fix?)
Line 1: Line 1:
// syntax highlighter
// syntax highlighter
var syntaxCode = document.querySelectorAll("pre");
var syntaxCode = document.querySelectorAll("pre");
syntaxCode.forEach(code => {
syntaxCode.forEach((code) => {
if (syntaxCode.indexOf('game.') > -1) // if the keyword exists in the code
if (code.indexOf('game.') > -1) // if the keyword exists in the code
{
{
syntaxCode.replace("game", "<span style='color: #9cdcfe;'>game</span>"); // insert element (technically) that colors the keyword
code.replace("game", "<span style='color: #9cdcfe;'>game</span>"); // insert element (technically) that colors the keyword
syntaxCode.replace(".", "<span style='color: #b1ac8b;'>.</span>"); // ditto
code.replace(".", "<span style='color: #b1ac8b;'>.</span>"); // ditto
}
}
});
});

Revision as of 14:24, 3 November 2023

// syntax highlighter
var syntaxCode = document.querySelectorAll("pre");
syntaxCode.forEach((code) => {
	if (code.indexOf('game.') > -1) // if the keyword exists in the code
	{
		code.replace("game", "<span style='color: #9cdcfe;'>game</span>"); // insert element (technically) that colors the keyword
		code.replace(".", "<span style='color: #b1ac8b;'>.</span>"); // ditto
	}
});
Cookies help us deliver our services. By using our services, you agree to our use of cookies.