User:Taavi/global.js

From Meta, a Wikimedia project coordination wiki

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
const dbName = mw.config.get( 'wgDBname' );

function loadModule( name, base ) {
	if (mw.loader.getState(name) === null) {
		mw.loader.load( 'https://' + base + '/w/load.php?modules=' + name );
	} else {
		mw.loader.load( name );
	}
}

// moremenu
mw.loader.load('https://meta.wikimedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:MoreMenu.import.js');
if ( dbName === 'enwiki' ) {
	mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {
		mw.loader.load('https://en.wikipedia.org/w/?title=MediaWiki:Gadget-MoreMenu.enwiki.js&action=raw&ctype=text/javascript');
	});
}

// shortdeschelper on all wikipedias
if ( mw.config.get( 'wgServer' ).endsWith( '.wikipedia.org' ) ) {
	mw.loader.getScript( 'https://en.wikipedia.org/w/load.php?modules=ext.gadget.libSettings' ).then( function() {
		mw.loader.load( 'https://en.wikipedia.org/w/load.php?modules=ext.gadget.Shortdesc-helper' );
	});
}

// sysop tools on wikis where I am a sysop
if ( mw.config.get( 'wgUserGroups' ).includes( 'sysop' ) ) {
	mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Enterprisey/link-deleted-revs.js&action=raw&ctype=text/javascript' );
}

// auto purge
if ( mw.config.get( 'wgAction' ) === 'purge' ) {
   $('form[action*="action=purge"]').submit();
}

if ( mw.config.get( 'skin' ) !== 'minerva' && dbName !== 'apiportalwiki' ) {
	loadModule( 'ext.gadget.Navigation_popups', 'en.wikipedia.org' );
	loadModule( 'ext.gadget.HotCat', 'en.wikipedia.org' );
	
	// discussionTools
	if ( $( '#ca-addsection' ).length > 0 ) {
		mw.loader.load( 'ext.discussionTools.init' );
		
		// hack: force enable all interesting tools
		mw.cookie.set( 'discussiontools-tempenable', 'yes' );
	}
}

$( function() {
	if (
		$('#mw-sidebar-checkbox').length > 0
		&& !$('#mw-sidebar-checkbox').is(':checked') 
	) {
		$( '#mw-sidebar-button' ).click();
	}
} );

loadModule( 'ext.gadget.CommentsInLocalTime', 'en.wikipedia.org' );
loadModule( 'ext.gadget.StickyTableHeaders', 'en.wikipedia.org' );

mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/QuickEdit.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Chlod/Scripts/GoToTitle.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:DannyS712/Pretty_rights_log.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'https://meta.wikimedia.org/w/index.php?title=User:AntiCompositeNumber/centralAuthGuard.js&action=raw&ctype=text/javascript' );