User:Ozank Cx/global.js

/* Import Config */ 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' ] });

/* Main */ mw.loader.using(['mediawiki.util', 'mediawiki.api'], function {

/* Cache Config */ var config = mw.config.get( [		'wgAction',		'wgArticlePath',		'wgCanonicalSpecialPageName',		'wgPageName',		'wgTitle',		'wgSiteName'	] ); config.wgEscapedPageName = encodeURIComponent(config.wgPageName); config.wgArticlePath = config.wgArticlePath.slice(0,-2); /* START Code used on almost every page load */ /* Remove Help:Contents */ if ($('#globalNavigation').length) $('.user-menu.subnav li:nth-child(3)').remove; /* 	* Custom Toolbar Links * Usage: requires two values per link * - First: The URL parameter to append * - Second: Text to display link * Seperate each key with a pipe - | */	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').append('' + v.split("|")[1] + '');		}); }	/* Duplicate Files Button */ if ($('#my-tools-menu').length) $('#my-tools-menu').prepend(' List Dupe Files'); /* Add "show most recent" notice to talk page 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)');

/* END Code used on almost every page load */ /* START Special page code */ switch (config.wgCanonicalSpecialPageName) { /* Duplicate Files */ case "Blankpage": if ($.getUrlVar('blankspecial') === 'listdupefiles') { document.title = 'Duplicate files - ' + config.wgSiteName; $('#mw-content-text').html(' '); importScriptPage('DupImageList/code.js', 'dev'); }		break; /* IP lookup for anonymous contributions */ case "Contributions": if (config.wgTitle.replace(/(?:\d{1,3}\.){3}\d{1,3}/, "") == "Contributions/") $('.masthead-info h2').html('(lookup)'); break; /* Improve Special:SearchDigest */ case "SearchDigest": $('#mw-content-text ul li').each(function {				if ($(this).find('a').attr('title').indexOf('(page does not exist)') === -1)					$(this).remove;			}); break;

/* Improve Special:CheckUser */ case "CheckUser": if ($.getUrlVar('user').split('.').length == 4) $('#subipusers').attr('checked','checked'); break; }

/* No redirect when moving files */ if (config.wgPageName.indexOf("Special:MovePage/File:") != -1 && document.getElementById('wpLeaveRedirect').checked) $('#wpLeaveRedirect').removeAttr('checked');

/* END Special page code */

/* START Action related code */ /* Revision Delete */ if (config.wgAction == 'revisiondelete' || config.wgCanonicalSpecialPageName == 'Revisiondelete') { $('#wpHidePrimary,#wpHideComment,#wpHideUser').attr('checked','checked'); $('#wpReason').val('spam'); }	/* Untick minor edit checkbox after 10 seconds when editing */ if (["edit","submit"].indexOf(config.wgAction) != -1) { setTimeout(function {			if (document.getElementById('wpMinoredit').checked) 				$('#wpMinoredit').removeAttr('checked');		}, 10 * 1000); }	/* Convert Visual Editor to Source Editor */ if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action'));

/* END Action related code */ });