Toggle menu
2
16
18
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.
This wiki has had no edits or log actions made within the last 45 days and has been automatically marked as inactive. If you would like to prevent this wiki from being closed, please start showing signs of activity here. If there are no signs of this wiki being used within the next 15 days, this wiki will be closed in accordance to the Dormancy Policy (which all wiki founders accept when requesting a wiki). If this wiki is closed and no one reopens it 135 days from now, this wiki will become eligible for deletion. Note: If you are a bureaucrat, you can go to Special:ManageWiki and uncheck "inactive" yourself.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
Content added Content deleted
(added text highlighter to editor please dont fuck it miraheze)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
var syntaxElements = document.querySelectorAll("pre");
var syntaxElements = document.querySelectorAll("pre");
syntaxElements.forEach(checkSyntax);
syntaxElements.forEach(checkSyntax);
function checkSyntax(code) {
function checkSyntax(code) {
if (code.textContent.indexOf("game.") > -1) {
if (code.textContent.indexOf("game.") > -1) {
code.innerHTML = code.textContent
code.innerHTML = code.textContent
.replace(".", "<span style='color: #b1ac8b;'>.</span>")
.replace(".", "<span style='color: #6f6b53;'>.</span>")
.replace("game", "<span style='color: #9cdcfe;'>game</span>");
.replace("game", "<span style='color: #9cdcfe;'>game</span>");
}
}
var sectionSyntax = document.querySelectorAll('.cm-mw-section-header');
sectionSyntax.forEach(checkSectionSyntax);
function checkSectionSyntax(sectionText) {
if (sectionText.textContent.indexOf("==") > -1) {
var sectionHeader = '<span class="cm-mw-section-header">==</span>';
if (sectionText.textContent == "===") {
var sectionHeader = '<span class="cm-mw-section-header">===</span>';
}
var sectionParent = sectionText.parentElement;
if (sectionText.nextSibling != null) {
sectionParent.innerHTML = sectionHeader + "<span style='color: #d4f2ff;'>" + sectionText.nextSibling.textContent + "</span>" + sectionHeader;
}
}
}
var linkSyntax = document.querySelectorAll('.cm-mw-link-pagename');
linkSyntax.forEach(checkLinkSyntax);
function checkLinkSyntax(linkText) {
if (linkText.textContent.indexOf("File") > -1) {
linkText.innerHTML = "File:<span style='color: #89ddff;'>" + linkText.textContent.slice(5); + "</span>";
}
else {
linkText.innerHTML = "<span style='color: #89ddff;'>" + linkText.textContent + "</span>";
}
var nodes = linkText.parentElement.getElementsByClassName("cm-mw-link-ground");
for (var i = 0; i < nodes.length; i++) {
if (!nodes[i].classList.contains('cm-mw-link-bracket')) {
nodes[i].style.padding = "4px 0 4px 0";
}
}
linkText.parentElement.firstElementChild.style.borderRadius = "0.4em 0 0 0.4em";
linkText.parentElement.lastElementChild.style.borderRadius = "0 0.4em 0.4em 0";
linkText.parentElement.firstElementChild.style.padding = "4px 0 4px 4px";
linkText.parentElement.lastElementChild.style.padding = "4px 4px 4px 0";
}
}
}

Latest revision as of 14:52, 8 November 2023

var syntaxElements = document.querySelectorAll("pre");
syntaxElements.forEach(checkSyntax);
function checkSyntax(code) {
    if (code.textContent.indexOf("game.") > -1) {
        code.innerHTML = code.textContent
            .replace(".", "<span style='color: #6f6b53;'>.</span>")
            .replace("game", "<span style='color: #9cdcfe;'>game</span>");
    }
}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.