Jump to content

User:PiRSquared17/common.js

From Simple English Wikipedia, the free encyclopedia

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(document).ready(function() {
   $('<div class="portlet portal expanded" id="p-wl" role="navigation"><h3>Watchlists</h3><div class="pBody body"></div>').insertAfter("#p-tb")
   mw.util.addPortletLink("p-wl", "//en.wikipedia.org/wiki/Special:Watchlist", "enwiki Watchlist");
   mw.util.addPortletLink("p-wl", "//simple.wikipedia.org/wiki/Special:Watchlist", "simplewiki Watchlist");
   mw.util.addPortletLink("p-wl", "//www.wikidata.org/wiki/Special:Watchlist", "Wikidata Watchlist");
   mw.util.addPortletLink("p-wl", "//meta.wikimedia.org/wiki/Special:Watchlist", "Meta Watchlist");
   mw.util.addPortletLink("p-wl", "//commons.wikimedia.org/wiki/Special:Watchlist", "Commons Watchlist");
});
$(document).ready(function(){mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&ctype=text/javascript&action=raw');});
mw.loader.load("//en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400");
$(document).ready(function(){
hookEvent('load', setupPopups);
addOnloadHook(autoEdit);

// Support for MediaWiki's live preview, VisualEditor's saves and Echo's flyout.
( function () {
	var once = true;
	function dynamicContentHandler( $content ) {
		// Try to detect the hook fired on initial page load and disregard
		// it, we already hook to onload (possibly to different parts of
		// page - it's configurable) and running twice might be bad. Ugly…
		if ( $content.attr( 'id' ) == 'mw-content-text' ) {
			if ( once ) {
				once = false;
				return;
			}
		}

		function doIt () {
			$content.each( function () {
				this.ranSetupTooltipsAlready = false;
				setupTooltips( this );
			} );
		};

		if ( !setupPopups.completed ) {
			setupPopups( doIt );
		} else {
			doIt();
		}
	}

	// This hook is also fired after page load.
	mw.hook( 'wikipage.content' ).add( dynamicContentHandler );

	mw.hook( 'ext.echo.overlay.beforeShowingOverlay' ).add( function($overlay){
		dynamicContentHandler( $overlay.find(".mw-echo-state") );
	});
} )();

})