User:Ozank Cx/global.js

/* Configs */ OFPoptions = {'showlinks': false}; //OldFilePages /* Imports */ importArticles({	type: "script",	articles: [		'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',		'u:dev:MediaWiki:AjaxUndo/code.js',		'u:dev:MediaWiki:AjaxRC/code.js',		'u:dev:MediaWiki:AjaxRedirect/code.js',		'u:dev:MediaWiki:AnchoredRollback/code.js',		'u:dev:MediaWiki:CacheCheck/code.js',		'u:dev:MediaWiki:CategoryRenameAuto-update/code.js',		'u:dev:MediaWiki:CleanWantedFiles/code.js',		'u:dev:MediaWiki:ContribsLink/code.js',		'u:dev:MediaWiki:FileUsageAuto-update/code.js',		'u:dev:MediaWiki:MassBlock/code.js',		'u:dev:MediaWiki:MassCategorization/code.js',		'u:dev:MediaWiki:MassNullEdit/code.js',		'u:dev:MediaWiki:MassProtect/code.js',		'u:dev:MediaWiki:MassUserRights/code.js',		'u:dev:MediaWiki:NoImageLightbox/code.js',		'u:dev:MediaWiki:Nuke/code.js',		'u:dev:MediaWiki:OldFilePages/code.js',		'u:dev:MediaWiki:RelocateEditDiscussionButtons/code.js',		'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:ViewRemoved/code.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:ozank:MediaWiki:Chatconnect.js', 'u:runescape:MediaWiki:Common.js/spreport.js' ] });

$(function {

// Run JS when page has finished loading var globalJSloader = setInterval(function {	if (typeof mw.Api == "function") {		globalJS;		console.log("Global JavaScript loaded");		clearInterval(globalJSloader);	} }, 200);

function globalJS { var config = mw.config.get( [ // Cache config		'wgAction',		'wgArticlePath',		'wgCanonicalSpecialPageName',		'wgPageName',		'wgTitle'	] ); config.wgEscapedPageName = encodeURIComponent(config.wgPageName); config.wgArticlePath = config.wgArticlePath.slice(0,-2); switch (config.wgCanonicalSpecialPageName) { /* IP lookup on anon contribs */ case "Contributions": if (config.wgTitle.split('.').length == 4) $('.masthead-info h2').html('(lookup)'); break; /* Special:SearchDigest better functionality */ case "SearchDigest": $('#mw-content-text ul li').each(function {				if ($(this).find('a').attr('title').indexOf('(page does not exist)') === -1)					$(this).remove;			}); break;

/* Make sure when using CheckUser on IPs it selects users by default */ case "CheckUser": if ($.getUrlVar('user').split('.').length == 4) $('#subipusers').attr('checked','checked'); break; }	/* Unchecks redirects when moving files */ if (config.wgPageName.indexOf("Special:MovePage/File:") != -1) $('#wpLeaveRedirect').removeAttr('checked'); /* Revision Delete */ if (config.wgAction == 'revisiondelete' || config.wgCanonicalSpecialPageName == 'Revisiondelete') { $('#wpHidePrimary,#wpHideComment,#wpHideUser').attr('checked','checked'); $('#wpReason').val('spam'); }	/* Visual Editor links load the regular editor instead */ if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action')); /* Remove Help:Contents */ if ($('#globalNavigation').length) $('.user-menu.subnav li:nth-child(3)').remove; /* Toolbar links */ if ($('.toolbar > .tools').length) { $.each(["&allowuserjs=0|No User JS","&allowusercss=0|No User CSS","&useskin=monobook|Monobook",	"&usesitejs=0|No Site JS","&usesitecss=0|No Site CSS","&useskin=qqx|MediaWiki Sources"], function (i,v) {			$('.toolbar > .tools > li:last').after( $('').append('' + v.split("|")[1] + '') );		});	}	/* Duplicate files list button */ if ($('#my-tools-menu').length) $('#my-tools-menu').prepend(' List Dupe Files'); /* Untick minor edit box after 10 seconds while editing */ if (["edit","submit"].indexOf(config.wgAction) != -1) { setTimeout(function {			if ($('#wpMinoredit').attr('Checked')) 				$('#wpMinoredit').removeAttr('checked');		}, 10000); }	/* Add "show most recent" notice to message notifications when not on the same wiki */ if ($('#WikiaNotifications li div[data-type="1"]').length && $('#WikiaNotifications li div[data-type="1"] a:last').attr('href').slice(0,6) != config.wgArticlePath) $('#WikiaNotifications li div[data-type="1"]').append(' (show most recent)');

}

});