User:1234qwer1234qwer4/mass-tools.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*
Blame instructions; I'm not a programmer
Loads (depending on the user groups)
* [[User:Frietjes/masspurge.js]] (all),
* [[User:Plastikspork/massmove.js]] (extendedmover/sysop),
* [[User:Animum/massdelete.js]], [[User:Timotheus Canens/massrestore.js]], [[User:Timotheus Canens/massblock.js]], [[User:Timotheus Canens/massunblock.js]], [[User:Timotheus Canens/massprotect.js]], [[User:Timotheus Canens/massedit.js]] (sysop)
* [[m:MediaWiki:Gadget-globalmassblock.js]] (steward)
and adds links to them to the sidebar.
*/

jQuery(document).ready(function($) {

	var groups = mw.config.get('wgUserGroups');
	
	// [[User:Frietjes/masspurge.js]]
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Frietjes/masspurge.js&action=raw&ctype=text/javascript');

	$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
	  mw.util.addPortletLink(
		'p-tb',
		mw.util.getUrl('Special:MassPurge'),
		'MassPurge',
		't-masspurge',
		"Frietjes's MassPurge tool"
	  );
	});
	
	if(/extendedmover|sysop/.test(groups)){
		// [[User:Plastikspork/massmove.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Plastikspork/massmove.js&action=raw&ctype=text/javascript');
		
		$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassMove'),
			'MassMove',
			't-massmove',
			"Plastikspork's MassMove tool",
			'',
			't-masspurge'
		  );
		});
	}
	
	if(/sysop/.test(groups)){
		// [[User:Animum/massdelete.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Animum/massdelete.js&action=raw&ctype=text/javascript');
		// [[User:Timotheus Canens/massrestore.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/massrestore.js&action=raw&ctype=text/javascript');
		// [[User:Timotheus Canens/massblock.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/massblock.js&action=raw&ctype=text/javascript');
		// [[User:Timotheus Canens/massunblock.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/massunblock.js&action=raw&ctype=text/javascript');
		// [[User:Timotheus Canens/massprotect.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/massprotect.js&action=raw&ctype=text/javascript');
		// [[User:Timotheus Canens/massedit.js]]
		mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/massedit.js&action=raw&ctype=text/javascript');
		
		$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassDelete'),
			'MassDelete',
			't-massdelete',
			"Animum's MassDelete tool",
			'',
			't-massmove'
		  );
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassRestore'),
			'MassRestore',
			't-massrestore',
			"Timotheus Canens's MassRestore tool",
			'',
			't-massdelete'
		  );
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassBlock'),
			'MassBlock',
			't-massblock',
			"Timotheus Canens's MassBlock tool",
			'',
			't-massrestore'
		  );
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassUnblock'),
			'MassUnblock',
			't-massunblock',
			"Timotheus Canens's MassUnblock tool",
			'',
			't-massblock'
		  );
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassProtect'),
			'MassProtect',
			't-massprotect',
			"Timotheus Canens's MassProtect tool",
			'',
			't-massunblock'
		  );
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassEdit'),
			'MassEdit',
			't-massedit',
			"Timotheus Canens's MassEdit tool",
			'',
			't-massprotect'
		  );
		});
	}
	
	if(/steward/.test(mw.config.get( 'wgGlobalGroups' ))){
		// [[m:MediaWiki:Gadget-globalmassblock.js]]
		mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-globalmassblock.js&action=raw&ctype=text/javascript');
		
		$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
		  mw.util.addPortletLink(
			'p-tb',
			mw.util.getUrl('Special:MassGlobalBlock'),
			'MassGlobalBlock',
			't-massglobalblock',
			"MassGlobalBlock tool",
			'',
			't-masspurge'
		  );
		});
	}

});