User:Evad37/XFDcloser/v3.js

/** * XFDcloser Loader: * On XFD pages, notify users that WP:XFDcloser is a gadget, then load the gadget */ /* jshint esversion: 5, laxbreak: true, undef: true, eqnull: true, maxerr: 900 */ /* globals window, $, mw */ /* */

$.when(	// Resource loader modules	mw.loader.using([]),	$.ready ).then(function {	var config = mw.config.get( [ 'wgPageName', 'wgUserGroups' ] );	/* Quick checks that script should be running */	if ( /(?:\?|&)(?:action|diff|oldid)=/.test(window.location.href) ) {		// Page is in edit, history, diff, or oldid mode		return;	}	if ( config.wgUserGroups.indexOf('extendedconfirmed') === -1 && config.wgUserGroups.indexOf('sysop') === -1 ) {		// User is not extendedconfirmed or sysop		return;	}	var xfdpage_regex = /(Articles_for_deletion\/|Miscellany_for_deletion|User:Cyberbot_I\/AfD's_requiring_attention|Wikipedia:WikiProject_Deletion_sorting\/(?!(Flat|Compact)$)|(Categories|Files|Templates|Redirects)_for_discussion(?!\/(Working|Holding_cell|Speedy)))(?!\/?Administrator_instructions$)/;	if ( !xfdpage_regex.test(config.wgPageName) ) {		// Current page is not an XfD page;		return;	}	/* Notification */	mw.notify( $(' XFDcloser is now a gadget! Please upgrade to the gadget version. '), {			autoHide: false, tag: 'XFDcloser-gadget', type: 'warn' }	);	/* Load the gadget */	mw.loader.load("ext.gadget.XFDcloser");

}); /* */