User:Ozank Cx/global.js

/* Import Config */ OFPoptions = {'showlinks': false}; //OldFilePages /* Imports */ importArticles({	type: "script",	articles: [		'u:dev:AjaxBatchDelete/code.2.js',		'u:dev:AjaxUndo/code.js',		'u:dev:AjaxRC/code.js',		'u:dev:AjaxRedirect/code.js',		'u:dev:AnchoredRollback/code.js',		'u:dev:CacheCheck/code.js',		'u:dev:CategoryRenameAuto-update/code.js',		'u:dev:CleanWantedFiles/code.js',		'u:dev:ContribsLink/code.js',		'u:dev:FileUsageAuto-update/code.js',		'u:dev:MassBlock/code.js',		'u:dev:MassCategorization/code.js',		'u:dev:MassNullEdit/code.js',		'u:dev:MassProtect/code.js',		'u:dev:MassUserRights/code.js',		'u:dev:MinorEditTimeout/code.js',		'u:dev:NoImageLightbox/code.js',		'u:dev:Nuke/code.js',		'u:dev:OldFilePages/code.js',		'u:dev:RedirectManagement/code.js',		'u:dev:RelocateEditDiscussionButtons/code.js',		'u:dev:Rollback/code.js',		'u:dev:ViewRemoved/code.js',		'u:dev: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] + '');		}); }	/* Additional Buttons for "My Tools" */ if ($('#my-tools-menu').length) { $('#my-tools-menu').prepend(' List Dupe Files').prepend(' Multiple RC'); }	/* 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) { case "Blankpage":

/* START Blank page code */

switch ($.getUrlVar('blankspecial')) {

/* Duplicate Files */ case "listdupefiles": document.title = 'Duplicate files - ' + config.wgSiteName; $('.header-title h1').text('Duplicate files'); $('#mw-content-text').html(' '); importScriptPage('DupImageList/code.js', 'dev'); break;

/* Multiple RC */ case "recentchangesmultiple": document.title = 'Multiple recent changes - ' + config.wgSiteName; $('.header-title h1').text('Multiple recent changes'); $('#mw-content-text').html(' \						\							community.wikia.com\							dev.wikia.com</li>\							donkeykong.wikia.com</li>\							mlp.wikia.com</li>\							runescape.wikia.com</li>\							steven-universe.wikia.com</li>\						</ul>\					 '); importScriptPage('RecentChangesMultiple/code.2.js', 'dev'); break; }

/* END Blank page code */

break; /* IP lookup for anonymous contributions */ case "Contributions": if (config.wgTitle.replace(/(?:\d{1,3}\.){3}\d{1,3}/, "") == "Contributions/") $('.masthead-info h2').html('<a style="color:white" href="http://myip.ms/info/whois/' + config.wgPageName.split('/')[1] + '">(lookup)</a>'); break; /* Improve Search Digest */ 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 Check User */ case "CheckUser": if ($.getUrlVar('user') && $.getUrlVar('user').replace(/(?:\d{1,3}\.){3}\d{1,3}/, "") == "") $('#subipusers').attr('checked','checked'); break; }	/* List all titles on UncategorizedFiles etc */ if (config.wgCanonicalSpecialPageName !== false && $('.gallerytext').length) { $('#mw-content-text').prepend('<textarea id="name-output" readonly="readonly" style="width:500px"/>'); var titles = []; $('.gallerytext a').each(function {			titles.push($(this).attr('title').trim);		}); $('#name-output').append(titles.sort.join('\n')); }

/* 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'); }	/* Convert Visual Editor to Source Editor */ if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action'));

/* END Action related code */ });