MediaWiki:Common.js: Difference between revisions

From Alundra
Created page with "→Any JavaScript here will be loaded for all users on every page load.: mw.hook('wikipage.content').add(function () { var number = Math.floor(Math.random() * 20) + 1; var image = "Map" + String(number).padStart(3, "0") + ".png"; var url = mw.util.getUrl("Special:FilePath/" + image); document.body.style.backgroundImage = 'url("' + url + '")'; });"
 
No edit summary
 
Line 5: Line 5:
     var url = mw.util.getUrl("Special:FilePath/" + image);
     var url = mw.util.getUrl("Special:FilePath/" + image);


     document.body.style.backgroundImage = 'url("' + url + '")';
     document.querySelector("#mw-content-container").style.backgroundImage = 'url("' + url + '")';
});
});

Latest revision as of 19:16, 9 October 2026

/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.content').add(function () {
    var number = Math.floor(Math.random() * 20) + 1;
    var image = "Map" + String(number).padStart(3, "0") + ".png";
    var url = mw.util.getUrl("Special:FilePath/" + image);

    document.querySelector("#mw-content-container").style.backgroundImage = 'url("' + url + '")';
});