User:Ozuzanna/global.js

/* Imports */ importArticles({   type: "script",    articles: [        'u:a:MediaWiki:Gadget-HotCat.js',        'u:c:User:Ozuzanna/chatconnect.js',        'u:c:User:Ozuzanna/OldFilePages.js',        'u:dev:AjaxBatchDelete/code.2.js',        'u:dev:AjaxUndo/code.js',        'u:dev:AjaxRedirect/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:MassCategorization/code.js',        'u:dev:MassNullEdit/code.js',        'u:dev:MassRedirect/code.1.js',        'u:dev:MassRenameRevert/code.js',        'u:dev:NoImageLightbox/code.js',        'u:dev:RedirectManagement/code.js',        'u:dev:WHAM/code.2.js',        'u:dev:ViewRemoved/code.js'    ] });

var c = mw.config.get( [   'wgPageName',    'wgCanonicalSpecialPageName',    'wgTitle',    'wgAction',    'wgCanonicalNamespace',    'wgNamespaceNumber',    'wgUserGroups',    'wgSiteName',    'skin' ] ), escapedPage = encodeURIComponent(c.wgPageName), href, link;
 * (function($, mw) {

/* Import CacheCheck not for Special:WantedFiles */ if (c.wgCanonicalSpecialPageName != "Wantedfiles") importScriptPage('CacheCheck/code.js','dev');

/* Import AjaxRC for just Special:RecentChanges */ if (c.wgCanonicalSpecialPageName == "Recentchanges") importScriptPage('AjaxRC/code.js','dev');

/* IP lookup on contribs */ if (c.wgCanonicalSpecialPageName == "Contributions" && c.wgTitle.split('.').length == 4) { href = 'http://myip.ms/info/whois/' + c.wgPageName.split('/')[1], link = ' (lookup)'; $('.masthead-info').find('h2').html(link); }

/* Create an edit link on Special:MovePage for easy redirecting */ if (c.wgCanonicalSpecialPageName == "Movepage") { href = $('fieldset').find('a').attr('href') + '?action=edit', link = ' (edit)'; $('#mw-movepage-table').find('a').first.after(link); }

/* Unchecks redirects when moving files */ if (c.wgPageName.indexOf("Special:MovePage/File:") !== -1) $('#wpLeaveRedirect').removeAttr('checked');

/* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(c.wgPageName) !== -1) { $('li.mw-logline-newusers').each(function {   href = '/wiki/Special:AbuseLog?wpSearchUser=' + $(this).children('a.new.mw-userlink,a.mw-userlink').attr('href').substring(11),    link = ' | abuse';    $(this).children('span.mw-usertoollinks').find('a:last-child').after(link);  }); }

/* Create move link on Special:ListFiles for users' files listed */ if (c.wgCanonicalSpecialPageName == "Listfiles" && c.wgPageName.split('/').length === 2) { $('.TablePager_col_img_name').each(function {   link = ' (move)';     $(this).append(link);  }); }

/* Automatic broken redirect delete summary */ if (c.wgAction == "delete" && $('#wpReason').val.slice(0,23) == 'content was: \"#REDIRECT' ) $('#wpReason').val('Broken redirect');

/* Revision delete */ if (c.wgAction == 'revisiondelete' || c.wgCanonicalSpecialPageName == 'Revisiondelete') { $('#wpHidePrimary,#wpHideComment,#wpHideUser').attr('checked','checked'); $('#wpReason').val('spam'); }

/* Thread history return to thread */ if (c.wgPageName.split(':')[0] == "Thread" && c.wgAction == "history") $('.SortingBar').after('Back to thread');

/* Make Visual Editor links load the regular editor instead */ if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action'));

/* Special:WhatLinksHere on redirect page */ var h2header = $('#WikiaPageHeader').find('h2'); if (h2header && h2header.text.split('Redirected from').length == 2) { link = ' (links) (history)'; h2header.append(link); }

/* Special:SearchDigest better functionality */ if (c.wgCanonicalSpecialPageName == "SearchDigest") { $('#mw-content-text ul li').each(function {   var attrTitle = $(this).children('a').attr('title');    if (attrTitle && attrTitle.split('(page does not exist)').length == 1)      $(this).remove;  }); }

/* Add history button to diffs */ if ($('strong:contains("Changes:")').length) $('#WikiaPageHeader').find('p').children('a').after(' (history)');

/* Add link to chatconnect per banned user for CC and MLP chat ban logs */ if ("Special:Log/chatban".indexOf(c.wgPageName) !== -1 && (c.wgSiteName == "Community Central" || c.wgSiteName == "My Little Pony Friendship is Magic Wiki")) { $('.mw-logline-chatban').each(function {   href = '/wiki/Special:Log/chatconnect?user=' + $(this).children('a.new.mw-userlink,a.mw-userlink').last.attr('href').substring(11),    link = ' | connect</a>';    $(this).children('.mw-usertoollinks').last.find('a:last-child').after(link);  }); }

/* Remove contents from user drop-down menu */ if ($('#globalNavigation').length) $('.user-menu.subnav li:nth-child(4)').remove;

/* Refresh Special:RecentChanges if a hash is in the URL for convenience every minute if (c.wgCanonicalSpecialPageName == "Recentchanges" && document.URL.split('#').length != 1) { setTimeout(function {    location.replace(document.URL.slice(0,-1));  }, 60000); }*/

/* Always go to IP contributions, not userpage */ if (c.wgNamespaceNumber == 2 && c.wgTitle.split('.').length == 4) location.replace("/wiki/Special:Contributions/"+c.wgPageName.split(':')[1]);

/* Skin Switch Button (changing "Start a wikia" in Oasis to it) */ if (({"oasis": 1, "wikia": 1})[c.skin] === 1) { $('.start-wikia').attr('href','/index.php?title='+escapedPage+'&useskin=monobook').attr('title','Switch to Monobook').text('Monobook'); } else { $('.pBody > ul > li:last-child').after(   $('<li/>').append('Oasis</a>')  ); }

/* Quick Dev Buttons */ if ($('.toolbar > .tools').length) { $('.toolbar > .tools > li:last-child').after(   $('<li/>').append('No User JS</a>'),    $('<li/>').append('No User CSS</a>'),    $('<li/>').append('No Site JS</a>'),    $('<li/>').append('No Site CSS</a>'),    $('<li/>').append('MediaWiki Sources</a>')  ); }

/* Auto-submit bugged pages for deletion */ if (c.wgAction == "delete" && $('#ca-edit').text.trim == "Create") $('#mw-img-deleteconfirm,#wpConfirmB').submit;

}) (this.jQuery, this.mediaWiki);