MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
var launchDayRevId = 22170; | var launchDayRevId = 22170; | ||
if (mw.config.get("wgNamespaceNumber") == 0 && | if (false && mw.config.get("wgNamespaceNumber") == 0 && | ||
mw.config.get("wgRevisionId") < launchDayRevId && | mw.config.get("wgRevisionId") < launchDayRevId && | ||
mw.config.get("wgTitle") != "Main Page") { | mw.config.get("wgTitle") != "Main Page") { |
Revision as of 01:39, 31 July 2023
/* Any JavaScript here will be loaded for all users on every page load. */
// Update this to the latest revision ID on August 3rd:
var launchDayRevId = 22170;
if (false && mw.config.get("wgNamespaceNumber") == 0 &&
mw.config.get("wgRevisionId") < launchDayRevId &&
mw.config.get("wgTitle") != "Main Page") {
var notice = document.getElementById("siteNotice");
notice.style.border = "2px solid var(--bdr-hl)";
notice.style.padding = "5px";
notice.style.fontSize = "1.2em";
notice.innerHTML = "<b>[Test] Warning: This page has not been updated since Early Access. The contents may be outdated.</b>";
}
// Related to centering the content; fix for popups.
$(document).ready(function () {
var body = document.getElementsByTagName("body")[0];
var callback = function(mutList, _obs) {
var mut = mutList[0];
var mutNode = mut.addedNodes;
if (mutNode.length !== 0 && mutNode[0].classList.contains("mwe-popups")) {
var eleLeft = mutNode[0].style.left;
var marginLeft = window.getComputedStyle(body).getPropertyValue("margin-left");
// subtract the left margin from the computed value
mutNode[0].style.left = "calc("+ eleLeft + " - "+ marginLeft + ")";
}
};
var observer = new MutationObserver(callback);
observer.observe(body, { childList: true });
});