Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes. edit

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

User:JJMC89/common.js

From DDO wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r ( Command+r on a Mac)
  • Google Chrome: Press Ctrl+ Shift+R ( Command+ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools ‣ Preferences
// <nowiki>
/*******************************************************************************
* Variables
*******************************************************************************/
lwgScript = mw.config.get( 'wgScript' );
lwgUserName = mw.config.get( 'wgUserName' );
lwgNamespaceNumber = mw.config.get( 'wgNamespaceNumber' );
lwgPageName = mw.config.get( 'wgPageName' );


/*******************************************************************************
* 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 [[DDO:Image policy|File naming policy]]' );
	  krAddDeleteReasons.File( 'Name corrected per [[DDO:Image policy|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]]
	
} else {
	
	importMwScript( 'User:Ais523/votesymbols.js', 'wikipedia' ); // [[:en:User:Ais523/votesymbols.js]]
	
}
// </nowiki>