MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

mw.loader.using(['mediawiki.util']).then(function { /* Begin of mw.loader.using callback */

// Creates action=raw links for JS or CSS gadgets // Useful for mw.loader.load, which doesn't accept page titles function rawPageLink( pageName ) { return mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode(pageName) + '&action=raw&ctype=text/javascript'; }

// Overwriting deprecated functions that don't have an exact followup but can be easily mapped: window.importScript = function ( page ) { if ( typeof page === 'string' && page.length ) { mw.loader.load( rawPageLink( page ) ); } };

/* Enable image annotations for all users */ if (wgNamespaceNumber != -1) importScript ('MediaWiki:Gadget-ImageAnnotator.js');

/* End of mw.loader.using callback */ });