MediaWiki:Gadget-NavigationPopups.js

From Noita Wiki
Jump to navigation Jump to search

In other languages: 日本語 • Български • Deutsch • Ελληνικά • English • Español • Français • Magyar • Italiano • 한국어 • Nederlands • Polski • Português • Português do Brasil • Русский • Türkçe中文

CSS and Javascript changes must not modify the wiki.gg branding or advertisements.

Note: After saving, 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 Hold Ctrl while clicking Refresh, or press Ctrl-F5
Opera Clear the cache in Tools → Preferences
// Load the module from [[Wikipedia:Tools/Navigation popups]]
mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups');

function waitFor(conditionFunction) {
	var poll = function(resolve) {
		if (conditionFunction()) {
			resolve();
		}
		else {
			setTimeout(function(_) { poll(resolve) }, 100);
		}
	};
	
	return new Promise(poll);
}

// Strip tooltips off of images
waitFor(function() { return window.pg && window.pg.flag.finishedLoading; })
	.then(function() {
	// Borrowed from: https://en.wikipedia.org/wiki/MediaWiki:Gadget-popups.js
	function removeTooltip(a) {
		if (!a.hasPopup) {
			return;
		}

		a.onmouseover = null;
		a.onmouseout = null;

		if (a.originalTitle) {
			a.title = a.originalTitle;
		}

		a.hasPopup = false;
	}
	
	// Remove tooltips from all images
	$('a.image').each(function(index, element) {
		removeTooltip(element);	
	});
});