User:Ms2ger/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// Purge
addOnloadHook(
	function addPurge() {
		var plink = document.getElementById('purgelink');
		if (plink != null) {
			plink.style.display = "none"; // Hide all purgelinks
		}
		var print = document.getElementById('t-print');
		if (print != null) {
			print.getElementsByTagName("a")[0].accessKey = ""; // Get rid of the "p" accesskey
		}

		var history = document.getElementById("ca-history");
		if ((history != null) && (!document.getElementById("editform")))
		{
			mw.util.addPortletLink(
				"p-cactions",
				mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=purge",
				"Purge",
				"ca-purge",
				"Purge this page's cache",
				"p",
				history
			);
		}
	}
);
addOnloadHook(
	function addFr() {
		if (document.getElementById("ca-enwiki") != null) {
			var imagetitle = wgPageName.substring(wgPageName.indexOf(':') + 1); // strip off "Image:" namespace
			var tab_wikipedia_fr = 'fr';
			mw.util.addPortletLink(
				"p-cactions",
				"http://" + tab_wikipedia_fr + ".wikipedia.org/wiki/Image:" + imagetitle,
				tab_wikipedia_fr,
				"ca-" + tab_wikipedia_fr + "wiki",
				tab_wikipedia_fr,
				"0",
				"ca-enwiki"
			);
		}
	}
);