MediaWiki:Vector.js: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Vector skin */
/* All JavaScript here will be loaded for users of the Vector skin */


/*
if (document.readyState === 'complete') {
if (document.readyState === 'complete') {
bg3wikiCheckAdBlock();
bg3wikiVectorJsMain();
} else {
} else {
window.addEventListener('load', bg3wikiCheckAdBlock);
window.addEventListener('load', bg3wikiVectorJsMain);
}
 
function bg3wikiVectorJsMain() {
var reportAdsLink = document.querySelector('#n-Please-report-bad-ads a');
if (reportAdsLink) {
reportAdsLink.setAttribute("target", "_blank");
}
}
}


/*
function bg3wikiCheckAdBlock() {
function bg3wikiCheckAdBlock() {
var adsEnabled = document.body.classList.contains("mw-ads-enabled");
var adsEnabled = document.body.classList.contains("mw-ads-enabled");
if (adsEnabled && window.fusetag === undefined) {
if (adsEnabled && !window.fusetag && !window.ramp) {
bg3wikiAdBlockProbable();
bg3wikiAdBlockProbable();
}
}

Latest revision as of 20:27, 18 September 2024

/* All JavaScript here will be loaded for users of the Vector skin */

if (document.readyState === 'complete') {
	bg3wikiVectorJsMain();
} else {
	window.addEventListener('load', bg3wikiVectorJsMain);
}

function bg3wikiVectorJsMain() {
	var reportAdsLink = document.querySelector('#n-Please-report-bad-ads a');
	if (reportAdsLink) {
		reportAdsLink.setAttribute("target", "_blank");
	}
}

/*
function bg3wikiCheckAdBlock() {
	var adsEnabled = document.body.classList.contains("mw-ads-enabled");
	if (adsEnabled && !window.fusetag && !window.ramp) {
		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.";
}
*/