MediaWiki:Vector.js

From bg3.wiki
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 */

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.";
}
*/