MediaWiki:Vector.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
function bg3wikiCheckAdBlock() { | function bg3wikiCheckAdBlock() { | ||
if (window.fusetag === undefined) { | var adsEnabled = document.body.classList.contains("mw-ads-enabled"); | ||
if (adsEnabled && window.fusetag === undefined) { | |||
bg3wikiAdBlockProbable(); | bg3wikiAdBlockProbable(); | ||
} | } | ||
Line 15: | Line 16: | ||
function bg3wikiAdBlockProbable() { | function bg3wikiAdBlockProbable() { | ||
bg3wikiCleanupHeaderAd(); | bg3wikiCleanupHeaderAd(); | ||
bg3wikiCleanupSidebarAd(); | |||
} | } | ||
Line 24: | Line 25: | ||
} | } | ||
var p = headerAd.querySelector("p"); | var p = headerAd.querySelector("p"); | ||
p.style.fontSize = '1em'; | |||
p.innerText = "Ad block user? No problem.\n" + | p.innerText = "Ad block user? No problem.\n" + | ||
"You can log in to clean up the UI of placeholders like this."; | "You can log in to clean up the UI of placeholders like this."; | ||
} | } | ||
function | function bg3wikiCleanupSidebarAd() { | ||
var | var headerAd = document.getElementById("bg3wiki-sidebar-ad"); | ||
if ( | if (!headerAd) { | ||
return; | |||
} | } | ||
var p = headerAd.querySelector("p"); | |||
p.style.fontSize = '0.7em'; | |||
p.innerText = "Ad block user? No problem.\n" + | |||
"You can log in to clean up the UI of placeholders like this."; | |||
} | } |
Revision as of 19:04, 9 August 2024
/* All JavaScript here will be loaded for users of the Vector skin */
if (document.readyState === 'complete') {
bg3wikiCheckAdBlock();
} else {
window.addEventListener('load', bg3wikiCheckAdBlock);
}
function bg3wikiCheckAdBlock() {
var adsEnabled = document.body.classList.contains("mw-ads-enabled");
if (adsEnabled && window.fusetag === undefined) {
bg3wikiAdBlockProbable();
}
}
function bg3wikiAdBlockProbable() {
bg3wikiCleanupHeaderAd();
bg3wikiCleanupSidebarAd();
}
function bg3wikiCleanupHeaderAd() {
var headerAd = document.getElementById("bg3wiki-header-ad");
if (!headerAd) {
return;
}
var p = headerAd.querySelector("p");
p.style.fontSize = '1em';
p.innerText = "Ad block user? No problem.\n" +
"You can log in to clean up the UI of placeholders like this.";
}
function bg3wikiCleanupSidebarAd() {
var headerAd = document.getElementById("bg3wiki-sidebar-ad");
if (!headerAd) {
return;
}
var p = headerAd.querySelector("p");
p.style.fontSize = '0.7em';
p.innerText = "Ad block user? No problem.\n" +
"You can log in to clean up the UI of placeholders like this.";
}