MediaWiki:Gadget-NavigationPopups.js

提供:Noita Wiki
ナビゲーションに移動 検索に移動

他言語版: English


CSS and Javascript changes must comply with the wiki design rules.


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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// 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);	
	});
});