MediaWiki:Common.js

/** * Redirect User:Name/skin.js and skin.css to the current skin's pages * (unless the 'skin' page really exists). * * Dependencies: mediawiki.util * * @source https://www.mediawiki.org/wiki/Snippets/Redirect_skin.js * @revision 2016-04-13 */ if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) { mw.loader.using( 'mediawiki.util', function {		var titleParts = mw.config.get( 'wgPageName' ).split( '/' );		// Make sure there was a part before and after the slash		// And that the latter is 'skin.js' or 'skin.css'		if ( titleParts.length == 2 ) {			var userSkinPage = titleParts[0] + '/' + mw.config.get( 'skin' );			if ( titleParts[1] === 'skin.js' ) {				location.href = mw.util.getUrl( userSkinPage + '.js' );			} else if ( titleParts[1] === 'skin.css' ) {				location.href = mw.util.getUrl( userSkinPage + '.css' );			}		}	} ); }

// Book specific mw.config.set( 'wgBookName', ( mw.config.get( 'wgPageName' ).split( '/', 1 )[0] || '' ).split( ':', 2 ).join( ':' ) );

if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) { importStylesheet( 'MediaWiki:Common.css/Watchlist.css' ); importScript('MediaWiki:Common.js/WatchlistNotice.js'); } else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ) { importStylesheet( 'MediaWiki:Common.css/Recentchanges.css' ); } else if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit', 'upload'] ) !== -1 ) { importScript('MediaWiki:Common.js/Toolbox.js'); }

/* * Use Gadgets whenever possible to minimize loading for all users for every page. * Wait for mediawiki.util to be ready because some things assume its availability. */ mw.loader.using( 'mediawiki.util', function {		// Page specific - lynchpin for dialog 	importScript( 'MediaWiki:Common.js/w/' + mw.config.get( 'wgPageName' ) );

// Imported scripts importScript('MediaWiki:Common.js/Relics.js'); importScript('MediaWiki:Common.js/ExtraTools.js'); importScript('MediaWiki:Common.js/CollapseElements.js'); importScript('MediaWiki:Common.js/NavigationTabs.js'); importScript('MediaWiki:Common.js/Displaytitle.js'); // importScript('MediaWiki:Common.js/RandomBook.js'); importScript('MediaWiki:Common.js/Perbook.js'); importScript('MediaWiki:Common.js/tabs.js'); importScript('MediaWiki:Common.js/top.js'); importScript('MediaWiki:Common.js/review.js'); importScript('MediaWiki:Common.js/Categories.js'); importScript('MediaWiki:Common.js/use.js'); importScript('MediaWiki:Common.js/Slideshows.js'); // DO NOT ADD CODE BELOW THIS LINE });