MediaWiki:Vector.js: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:


function bg3wikiAdBlockProbable() {
function bg3wikiAdBlockProbable() {
bg3wikiCleanupHeaderAd();
//bg3wikiRemoveSidebarAdSection();
}
function bg3wikiCleanupHeaderAd() {
var headerAd = document.getElementById("bg3wiki-header-ad");
if (!headerAd) {
return;
}
var p = headerAd.querySelector("p");
p.innerText = "Ad block user? No problem.\n" +
"You can log in to clean up the UI of placeholders like this.";
}
function bg3wikiRemoveSidebarAdSection() {
var sidebarAdSection = document.getElementById("p-Advertisement");
var sidebarAdSection = document.getElementById("p-Advertisement");
if (sidebarAdSection) {
if (sidebarAdSection) {
sidebarAdSection.parentNode.removeChild(sidebarAdSection);
sidebarAdSection.parentNode.removeChild(sidebarAdSection);
}
var headerAd = document.getElementById("bg3wiki-header-ad");
if (headerAd) {
var p = headerAd.querySelector("p");
p.innerText = "Ad block user? No problem.\n" +
"You can log in to hide this placeholder.";
}
}
}
}

Revision as of 18:49, 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() {
	if (window.fusetag === undefined) {
		bg3wikiAdBlockProbable();
	}
}

function bg3wikiAdBlockProbable() {
	bg3wikiCleanupHeaderAd();
	//bg3wikiRemoveSidebarAdSection();
}

function bg3wikiCleanupHeaderAd() {
	var headerAd = document.getElementById("bg3wiki-header-ad");
	if (!headerAd) {
		return;
	}
	var p = headerAd.querySelector("p");
	p.innerText = "Ad block user? No problem.\n" +
		"You can log in to clean up the UI of placeholders like this.";
}

function bg3wikiRemoveSidebarAdSection() {
	var sidebarAdSection = document.getElementById("p-Advertisement");
	if (sidebarAdSection) {
		sidebarAdSection.parentNode.removeChild(sidebarAdSection);
	}
}