User:Ozuzanna/global.js

/* Configs */ cacheSkip = []; cacheSkipLimit = 1000;

/* Imports */ importArticles({   type: "script",    articles: [        'u:dev:AjaxBatchDelete/code.2.js',        'u:dev:AjaxUndo/code.js',        'u:dev:AjaxRedirect/code.js',        'u:dev:CacheCheck/code.js',        'u:dev:CategoryRenameAuto-update/code.js',        'u:dev:ContribsLink/code.js',        'u:dev:FileUsageAuto-update/code.js',        'u:dev:RedirectManagement/code.js',        'u:dev:WHAM/code.2.js',        'u:a:MediaWiki:Gadget-HotCat.js',        'u:dev:MassCategorization/code.js',        'u:dev:MassNullEdit/code.js',        'u:dev:MassRenameRevert/code.js',        'u:dev:NoImageLightbox/code.js',        'u:c:User:Ozuzanna/chatconnect.js',        'u:c:User:Ozuzanna/OldFilePages.js'    ] });

var usergroups = mw.config.get('wgUserGroups').join(' '), page = mw.config.get('wgPageName'), specialpage = mw.config.get('wgCanonicalSpecialPageName'), title = mw.config.get('wgTitle'), action = mw.config.get('wgAction'), sitename = mw.config.get('wgSiteName'), namespace = mw.config.get('wgCanonicalNamespace'), href, link;
 * (function($, mw) {

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

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

/* Create an edit link on Special:MovePage for easy redirecting */ if (specialpage == "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 (page.indexOf("Special:MovePage/File:") !== -1) $('#wpLeaveRedirect').removeAttr('checked');

/* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(page) !== -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 (specialpage == "ListFiles") { $('td.TablePager_col_img_name').each(function {   link = ' (move)';     $(this).append(link);  }); }

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

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

/* Thread history return to thread */ if (page.split(':')[0] == "Thread" && action == "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.text.split('Redirected from').length == 2) { link = ' (links) (history)'; h2header.append(link); }

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

/* Add history button to diffs */ if ($('strong:contains("Changes:")').length > 0) $('#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(page) != -1 && (sitename == "Community Central" || sitename == "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);  }); }

/* Change make wiki link to a dynamic chat link */ $('.global-navigation-link.start-wikia').attr('href','/wiki/Special:Chat').attr('title','Go to the wiki chat').text('Chat');

/* Remove navigation bar during editing */ if ((action == "edit" || action == "submit") && namespace != "Message_Wall" && namespace != "Thread") $('#globalNavigation').remove;

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

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