User:Ozuzanna/global.js

/* Configs */ OFPoptions = {'showlinks': false};

if (mw.config.get('wgSiteName') == "My Little Pony Friendship is Magic Wiki" || mw.config.get('wgSiteName') == "Wikianswers") { WHAMBotReason = "Temporary" WHAMBotMe = true; }

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

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

/* IP lookup on contribs */ if (c.wgCanonicalSpecialPageName == "Contributions" && $('#anontalktext').length && c.wgTitle.split('.').length == 4) $('.masthead-info h2').html('(lookup)');

/* Create an edit link on Special:MovePage for easy redirecting */ if (c.wgCanonicalSpecialPageName == "Movepage") $('#mw-movepage-table').find('a').first.after(' (edit)');

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

/* Add edit link to Special:WhatLinksHere listings */ if (c.wgCanonicalSpecialPageName == 'Whatlinkshere') { $('#mw-whatlinkshere-list li').find('a:first').each(function {   $(this).parent.find('a:last').before('edit | ');  }); }

/* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(c.wgPageName) !== -1) { $('.mw-logline-newusers').each(function {   $(this).find('.mw-usertoollinks').find('a:last').after(' | abuse');  }); }

/* 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.wgCanonicalNamespace == "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 */ if ($('#WikiaPageHeader h2').text.indexOf('Redirected from') != -1) $('#WikiaPageHeader h2').append(' (links) (history)');

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

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

/* Add link to chatconnect per banned user for MLP chat ban log */ if ("Special:Log/chatban".indexOf(c.wgPageName) !== -1 && c.wgSiteName == "My Little Pony Friendship is Magic Wiki") { $('.mw-logline-chatban').each(function {   $(this).find('.mw-usertoollinks:last').find('a:last').after(' | connect</a>');  }); }

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

/* Global navigation changes */ if (({"oasis": 1, "wikia": 1})[c.skin] === 1 && $('#globalNavigation').length) $('.user-menu.subnav li:nth-child(3),.hubs-entry-point').remove; //Removes Help:Contents and dropdown thing

/* Quick Dev Buttons */ if ($('.toolbar > .tools').length) { $('.toolbar > .tools > li:last').after(   $('<li/>').append('Monobook</a>'),    $('<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,#deleteconfirm').submit;

/* Add delete link to Special:UnusedFiles */ if (c.wgCanonicalSpecialPageName == "Unusedimages") { $('.gallerytext').each(function {   if (!/File missing/gi.test($(this).text))      $(this).find('a').after(' (delete)</a>');  }); }

/* Compile list of videos listed on Special:UnusedVideos and Special:UnusedFiles */ if (c.wgCanonicalSpecialPageName == "UnusedVideos" || c.wgCanonicalSpecialPageName == "Unusedimages") { $('.mw-spcontent').find('p:first').after('Compile</a>'); $('#btn-compile').click(function {   tempArray = [];    $('.gallerytext').each(function { if (!/File missing/gi.test($(this).text)) tempArray.push($(this).find('a').attr('title')); });   alert(tempArray.sort.join('\n').trim);  }); }

/* Change the undo/rollback links for protections actually do something useful */ if (c.wgAction == "History" || c.wgCanonicalSpecialPageName == "Contributions") { $('.comment').each(function {   if ($(this).parent.find('.mw-plusminus-null').length && $(this).text.match('Protected')) {      if ($('.mw-revdelundel-link').length) {        $(this).parent.find('a:last').attr('href',c.wgArticlePath.split('$')[0]+$(this).parent.children('a').eq(1).attr('title')+'?action=protect').text('change');      }      else {        $(this).parent.find('a:last').attr('href',c.wgArticlePath.split('$')[0]+$(this).parent.find('a:first').attr('title')+'?action=protect').text('change');      }    }  }); }

/* Create dupe file list button */ if (mw.config.get('skin') === 'monobook') { mw.util.addPortletLink('p-tb', '/index.php?title=Special:BlankPage&blankspecial=listdupefiles', 'List Dupe Files', 't-dl'); } else { $('#my-tools-menu').prepend(' List Dupe Files</a></li>'); }

/* Dupe file list markup */ if (mw.config.get('wgCanonicalSpecialPageName') === 'Blankpage' && $.getUrlVar('blankspecial') === 'listdupefiles') { document.title = 'Duplicate Files'; $('#mw-content-text').html(' '); importScriptPage('DupImageList/code.js', 'dev'); }

/* Untick minor edit box after 10 seconds when editing */ if ((c.wgAction === 'edit' || c.wgAction === 'submit') && !$.getUrlVar('undo')) { setTimeout(function {   if ($('#wpMinoredit').attr('Checked'))       $('#wpMinoredit').removeAttr('checked');  }, 10000); }

/* Make sure when using CheckUser on IPs, it always has users selected by default rather than edits */ if (c.wgCanonicalSpecialPageName == "CheckUser" && $.getUrlVar('user').split('.').length == 4) $('#subipusers').attr('checked','checked'); }) (this.jQuery, this.mediaWiki);