MediaWiki:Vector.js
Jump to navigation
Jump to search
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.
/* All JavaScript here will be loaded for users of the Vector skin */
/*
* Note that some of the style changes that are applied when enabling ads are
* already applied via MW:Vector.css, but only for anonymous visitors, so apply
* them again in case ads are enabled explicitly, e.g. for testing.
*/
if (mw.config.get("wgUserId") == null) {
bg3wikiEnableAds();
}
function bg3wikiEnableAds () {
bg3wikiEnableSiteNoticeAd();
bg3wikiEnableSidebarAd();
}
function bg3wikiEnableSiteNoticeAd() {
var ad = document.getElementById("bg3wiki-sitenotice-ad");
if (ad == null) {
return;
}
ad.style.display = "block";
var h1 = document.getElementById("firstHeading");
h1.style.maxWidth = "calc(100% - 468px - 16px)";
var indicators = document.getElementsByClassName("mw-indicators")[0];
indicators.style.marginRight = "16px";
}
function bg3wikiEnableSidebarAd() {
var ad = document.querySelector("#p-Advertisement > div");
if (ad == null) {
return;
}
ad.style.width = "160px";
ad.style.height = "600px";
ad.style.marginTop = "5px";
ad.style.border = "2px dotted var(--bdr-color)";
ad.style.boxSizing = "border-box";
ad.style.paddingLeft = "10px";
ad.style.paddingRight = "10px";
ad.style.alignContent = "center";
var sidebarSpecial = document.getElementById("p-Special");
sidebarSpecial.style.display = "none";
var sidebarToolbox = document.getElementById("p-tb");
sidebarToolbox.style.display = "none";
// var p = document.createElement("p");
// p.style.textAlign = "center";
// p.style.lineHeight = "1.5em";
// p.style.fontSize = "0.9em";
// p.style.fontStyle = "italic";
// p.style.color = "var(--fg-dark)";
// p.innerText = "Ad block user?\nNo problem.\n\n" +
// "If you want, you can log in to hide this ad placeholder.";
// ad.innerHTML = "";
// ad.appendChild(p);
}