User:JJMC89/common.js

// /******************************************************************************* lwgScript = mw.config.get( 'wgScript' ); lwgUserName = mw.config.get( 'wgUserName' ); lwgNamespaceNumber = mw.config.get( 'wgNamespaceNumber' ); lwgPageName = mw.config.get( 'wgPageName' );
 * Variables

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

$.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function {

// Don't open red links in edit mode $( function {   var $alinks = mw.util.$content.find( 'a.new' )	    .each( function(i, aa) { aa.href = aa.href.replace(/\/edit\//,'/page/'); });	});

// My subpages mw.util.addPortletLink(		'p-personal',		mw.util.getUrl( 'Special:PrefixIndex/User:' ) + mw.util.wikiUrlencode( lwgUserName + '/' ),		'Subpages',		'pt-subpages',		'Your subpages',		null,		'#pt-preferences'	); // Subpages of current page mw.util.addPortletLink(		'p-tb',		mw.util.getUrl( 'Special:PrefixIndex/' ) + mw.util.wikiUrlencode( lwgPageName + '/' ),		'Subpages',		't-subpages',		'Subpages of this page',		null,		'#t-recentchangeslinked'	);

} );

/*******************************************************************************
 * 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( 'https://' + mw.util.wikiUrlencode( lang + '.' + family + '.org' ) + '/w/index.php?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/javascript' );		}	} ); }

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

/** * Make red links not open in edit mode */ $( function {   var $alinks = mw.util.$content.find( 'a.new' )    .each( function(i, aa) { aa.href = aa.href.replace(/\/edit\//,'/page/'); }); });

importMwScript( 'MediaWiki:Gadget-SysopTools.js' );

importMwScript( 'User:JJMC89/autolink.js' );

importMwScript( 'User:JJMC89/AjaxPatrolLinks.js' );

importMwScript( 'User:JJMC89/ajaxRollback.js' );

// en:User:Cacycle/wikEd // ( function { // 	var script = document.createElement( 'script' ); // 	script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; // 	script.async = true; // 	document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); // } ) ;

importMwScript( 'User:BrandonXLF/NoRedirect.js', 'wikipedia' ); // en:User:BrandonXLF/NoRedirect

importMwScript( 'MediaWiki:Gadget-markblocked.js', 'wikipedia' ); // en:MediaWiki:Gadget-markblocked.js

importMwScript( 'User:Hoo_man/smart_rollback.js', 'wikimedia', 'meta' ); // m:User:Hoo man/Scripts/Smart rollback

mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Ais523/votesymbols.js&action=raw&ctype=text/javascript' ); // en:User:Ais523/votesymbols.js

// en:w:User:Writ Keeper/Scripts/commonHistory inspectText = '+'; showText = '+'; hideText = '-'; importMwScript( 'User:Writ Keeper/Scripts/commonHistory.js', 'wikipedia' );

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

if ( [ 0, 2 ].indexOf( lwgNamespaceNumber ) !== -1 ) { // Main, user importMwScript( 'Benutzer:TMg/autoFormatter.js', 'wikipedia', 'de' ); // en:User:TMg/autoFormatter

} else if ( lwgNamespaceNumber === 6 ) { // File /*	 * Add custom delete reasons * Author: Krinkle * File:Krinkle_addDeleteReasons.js	 * http://meta.wikimedia.org/wiki/User:Krinkle/Scripts/addDeleteReasons * http://meta.wikimedia.org/wiki/User:Krinkle/Scripts/addDeleteReasons.js	 */ $.getScript( 'https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/addDeleteReasons.js&action=raw&ctype=text/javascript', function {	 krAddDeleteReasons.File( 'Image of an item that never existed' );	  krAddDeleteReasons.File( 'Invalid file extension per File naming policy' );	  krAddDeleteReasons.File( 'Name corrected per File naming policy' );	}); } else if ( lwgNamespaceNumber === -1 ) { // Special // en:User:Evad37/Watchlist-openUnread var openUnread_oldest = true; importMwScript( 'User:Evad37/Watchlist-openUnread.js', 'wikipedia' );

importMwScript( 'User:Enterprisey/links-in-logs.js', 'wikipedia' ); // en:User:Enterprisey/links-in-logs

importMwScript( 'User:Writ Keeper/Scripts/massRevdel.js', 'wikipedia' ); // en:User:Writ Keeper/Scripts/massRevdel.js importMwScript( 'User:JJMC89/checkuser-toollinks-enwiki.js' );

} else { importMwScript( 'User:Ais523/votesymbols.js', 'wikipedia' ); // en:User:Ais523/votesymbols.js } //