User:JJMC89/common.js

// /*******************************************************************************
 * Variables

lwgScript = mw.config.get( 'wgScript' ); lwgUserName = mw.config.get( 'wgUserName' ); lwgNamespaceNumber = mw.config.get( 'wgNamespaceNumber' ); lwgPageName = mw.config.get( 'wgPageName' ); maxUsersCUStaleness = 500;

/*******************************************************************************
 * Functions

function importMwScript( page, family, lang ) { $.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function {		if ( typeof family === 'undefined' && typeof lang === 'undefined' ) {			console.log( 'Loading ' + page );			mw.loader.load( lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/javascript' );		} else {			if ( typeof family === 'undefined' ) {				family = 'wikipedia';			} else if ( typeof lang === 'undefined' ) {				lang = 'en';			}			console.log( 'Loading script: ' + lang + ':' + family + ':' + page );			mw.loader.load( '//' + mw.util.wikiUrlencode( lang + '.' + family + '.org' ) + lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/javascript' );		}	} ); }

function importMwStylesheet( page, family, lang ) { $.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function {		if ( typeof family === 'undefined' && typeof lang === 'undefined' ) {			console.log( 'Adding ' + page );			mw.loader.load( lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/css', 'text/css' );		} else {			if ( typeof family === 'undefined' ) {				family = 'wikipedia';			} else if ( typeof lang === 'undefined' ) {				lang = 'en';			}			console.log( 'Loading stylesheet: ' + lang + ':' + family + ':' + page );			mw.loader.load( '//' + mw.util.wikiUrlencode( lang + '.' + family + '.org' ) + lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/css', 'text/css' );		}	} ); }

/*******************************************************************************
 * Gadget and global script configurations

// MoreMenu mw.loader.using(['mediawiki.util', 'mediawiki.api'], function {	importMwScript( 'MediaWiki:Gadget-MoreMenu.enwiki.js' ); });

window.charinsertCustom = { 'Wiki markup': '␥ ␥ (not.watching) .\ ' };

var wikEdConfig = {}; wikEdConfig.regExTypoFix = true; wikEdConfig.comboPresetOptions = {}; wikEdConfig.comboPresetOptions.summary = [ 'reply', 'Add maintenance template(s)', 'Add/update reference details', 'Copyedit', 'No evidence of notability', 'Remove image(s) lacking a fair use rationale for this page', 'Remove image(s) not satisifying the non-free content criteria', 'Remove external links', 'Remove external links', 'Remove unreliable sources', 'Remove unreliably sourced content', 'Remove unsourced', 'Remove unsourced personal information', 'Restore deletion notice', 'Restore maintenance template(s)', 'Revert: Failure to cite a reliable source', 'Revert: Unexplained removal of content', ]; wikEdConfig.comboPresetOptions.find = [ '(“|”|″|«|»)',	"(‘|’)",	' *([|=]) *',	'\\[http[^ ]+ ([^\\]]+)\\]', '\\|\\s*([^|}]+)\\s*=\\s*([|}])', '([^\\.,:;])<\\s*ref(\\s*[^>]*)>([^<]*)<\\s*\\/\\s*ref\\s*>([\\.,:;])', '\\|\\s*author(\\d*)\\s*=\\s*([^,|}]+) ([^,|} ]+)\\s*([|}])', '\\|\\s*author(\\d*)\\s*=\\s*([^,|}]+), ([^,|}]+)\\s*([|}])' ]; wikEdConfig.comboPresetOptions.replace = [ '"',	'\'',	'$1',	'$2',	'$1$4$3 ',	'|last$1=$3|first$1=$2$4',	'|last$1=$2|first$1=$3$4' ];

// Local config for m:User:Dragoniez/Selective Rollback if ( typeof( selectiveRollbackConfig ) === 'undefined' ) selectiveRollbackConfig = {}; if ( typeof( selectiveRollbackConfig.editSummaries ) === 'undefined' ) selectiveRollbackConfig.editSummaries = {}; selectiveRollbackConfig.editSummaries.Hidden = 'Reverted to revision $3 by $1'; selectiveRollbackConfig.editSummaries.Sock = selectiveRollbackConfig.editSummaries.Hidden + ': sockpuppetry'; selectiveRollbackConfig.editSummaries.Unsourced = selectiveRollbackConfig.editSummaries.Hidden + ': failure to cite a reliable source';

/*******************************************************************************
 * Links

$.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function {	// My dashboard	mw.util.addPortletLink( 'p-personal', mw.util.getUrl( 'User:' ) + mw.util.wikiUrlencode( lwgUserName + '/dashboard' ), 'Dashboard', 'pt-mydashboard', 'Show your dashboard', null, '#pt-subpages' );	// Admin dashboard	mw.util.addPortletLink( 'p-personal', mw.util.getUrl( 'Template:Admin dashboard' ), '(admin)', 'pt-admindashboard', 'Show the admin dashboard', null, '#pt-subpages' );	//mw.util.addPortletLink(portletId,href,text[,id[,tooltip[,accesskey[,nextnode]]]]); } );

/*******************************************************************************
 * Scripts for all namespaces

// User:Theopolisme/Scripts/adminhighlighter fork window.ADMINHIGHLIGHT_EXTLINKS = true; // highlights exteral links too; needs to be at the top importMwScript( 'User:Galobtter/scripts/adminhighlighter.js' ); // User:Galobtter/scripts/adminhighlighter.js

importMwScript( 'User:Anomie/linkclassifier.js' ); // User:Anomie/linkclassifier.js importMwStylesheet( 'User:Anomie/linkclassifier.css' ); // User:Anomie/linkclassifier.css

importMwScript( 'User:Anomie/previewtemplatelastmod.js' ); // User:Anomie/previewtemplatelastmod

importMwScript( 'User:Ahecht/Scripts/pageswap.js' ); // User:Ahecht/Scripts/pageswap

importMwScript( 'User:Enterprisey/url-select-revdel.js' ); // User:Enterprisey/url-select-revdel

importMwScript( 'User:The Earwig/revdel-responder.js' ); // User:The Earwig/revdel-responder

importMwScript( 'User:Ale jrb/Scripts/csdhelper.js' ); // User:Ale jrb/Scripts

importMwScript( 'User:Evad37/Xunlink.js' ); // User:Evad37/Xunlink

importMwScript( 'User:JJMC89/scripts/T210739.js' ); // User:JJMC89/scripts/T210739.js

importMwScript( 'User:Beetstra/Gadget-Spam-blacklist-Handler.js' ); // User:Beetstra/Gadget-Spam-blacklist-Handler importMwScript( 'User:Beetstra/Gadget-Spam-whitelist-Handler.js' ); // User:Beetstra/Gadget-Spam-whitelist-Handler

/*******************************************************************************
 * Scripts by namespace

if ( [ 0, 118 ].indexOf( lwgNamespaceNumber ) !== -1 ) { // Main and draft importMwScript( 'User:Erutuon/scripts/imageSize.js' ); // User:Erutuon/scripts/imageSize.js importMwScript( 'User:Evad37/duplinks-alt.js' ); // User:Evad37/duplinks-alt importMwScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // User:Qwertyytrewqqwerty/DisamAssist // User:Evad37/MoveToDraft importMwScript( 'User:Evad37/MoveToDraft.js' ); window.m2d_rationale = "incubate in draftspace"; window.m2d_notification = "Hello . I have moved an article you created, $1, to a draft at Draft:$1 to give you more time to work on it before publishing it. When you are sure that it belongs on Wikipedia and satisfies our inclusion criteria, please submit your draft for review by following the instructions at the top of the draft. ~"; //importMwScript( 'User:Salix alba/Citoid.js' ); // User:Salix alba/Citoid } else if ( [ 2, 3 ].indexOf( lwgNamespaceNumber ) !== -1 ) { // User + talk

// User:Mr. Stradivarius/gadgets/SpamUserPage SpamUserPage = {}; SpamUserPage.watchlist = 'nochange'; importMwScript( 'User:Mr. Stradivarius/gadgets/SpamUserPage.js' ); } else if ( lwgNamespaceNumber === 4 ) { // Project importMwScript( 'User:MusikAnimal/responseHelper.js' ); // User:MusikAnimal/responseHelper importMwScript( 'User:MusikAnimal/userRightsManager.js' ); // User:MusikAnimal/userRightsManager importMwScript( 'User:Enterprisey/delsort.js' ); // User:Enterprisey/delsort // importMwScript( 'User:Timotheus Canens/spihelper.js' ); // User:Timotheus Canens/spihelper.js importMwScript( 'User:GeneralNotability/spihelper.js' ); // User:GeneralNotability/spihelper.js importMwScript( 'User:Writ Keeper/Scripts/cuStaleness.js' ); // User:Writ Keeper/Scripts/cuStaleness.js window.charinsertCustom['Wiki markup'] += 'SPI:           moreinfo'; } else if ( lwgNamespaceNumber === 6 ) { // File

if ( mw.config.get('wgCategories').indexOf('All non-free media') !== -1 ) { // Non-free document.getElementById( 'ca-fileExporter' ).remove; // Remove FileExporter importMwScript( 'User:Ronhjones/rescaledsidebar.js' ); // User:Ronhjones/rescaledsidebar.js } } else if ( lwgNamespaceNumber === 10 ) { // Template importMwScript( 'User:Frietjes/addcheckforunknownparameters.js' ); // User:Frietjes/addcheckforunknownparameters.js

} else if ( lwgNamespaceNumber === 14 ) { // Category importMwScript( 'User:Writ Keeper/Scripts/sockStaleness.js' ); // User:Writ Keeper/Scripts/sockStaleness.js

}

if ( lwgNamespaceNumber % 2 === 1 ) { // Talk namespaces importMwScript( 'User:Jackmcbarn/editProtectedHelper.js' ); // User:Jackmcbarn/editProtectedHelper } //