User:Ozuzanna/global.js

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

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

/* Imports */ importArticles({   type: "script",    articles: [        'u:a:MediaWiki:Gadget-HotCat.js',        'u:c:User:Ozuzanna/chatconnect.js',        'u:c:User:Ozuzanna/noSyntaxHighlight.js',        'u:c:User:Ozuzanna/nuke.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:MassProtect/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', 'u:runescape:MediaWiki:Common.js/spreport.js' ] });


 * (function($, mw) {

var c = mw.config.get( [   'wgAction',    'wgArticlePath',    'wgCanonicalNamespace',    'wgCanonicalSpecialPageName',    'wgNamespaceNumber',    'wgPageName',    'wgUserGroups',    'wgSiteName',    'skin',    'wgTitle' ] ), articlePath = c.wgArticlePath.slice(0,-2), escapedPage = encodeURIComponent(c.wgPageName), str, array = [];

switch (c.wgCanonicalSpecialPageName) {

/* Add IP range calculator and lookup link to Special:Block for IPs */ case "Block": if ($('.mw-ipb-conveniencelinks a').text.indexOf('Contributions for') === -1) { str = c.wgPageName.match(/((?:\d{1,3}\.){3}\d{1,3})/)[0]; $('.visualClear').before(' (lookup | range calc)'); }  break;

/* Compile list of videos listed on Special:UnusedVideos and Special:UnusedFiles */ case "UnusedVideos": case "Unusedimages": $('.mw-spcontent p:first').after('Compile'); $('#btn-compile').click(function {     array = [];      $('.gallerytext').each(function { if (!/File missing/gi.test($(this).text)) array.push($(this).find('a').attr('title')); });     alert(array.sort.join('\n').trim);    }); break; /* Add IP lookup on anon contribs */ case "Contributions": if (c.wgTitle.split('.').length == 4) $('.masthead-info h2').html('(lookup)'); break; /* Create an edit link on Special:MovePage */ case "Movepage": $('#mw-movepage-table').find('a').first.after(' (edit)'); break; /* Add edit link to Special:WhatLinksHere listings */ case "Whatlinkshere": $('#mw-whatlinkshere-list li').find('a:first').each(function {     $(this).parent.find('a:last').before('edit | ');    }); break; /* Special:SearchDigest better functionality */ case "SearchDigest": $('#mw-content-text ul li').each(function {     if ($(this).find('a').attr('title').indexOf('(page does not exist)') === -1)        $(this).remove;    }); break; /* Dupe file list markup */ case "Blankpage": if ($.getUrlVar('blankspecial') === 'listdupefiles') { document.title = 'Duplicate Files'; $('#mw-content-text').html(' '); importScriptPage('DupImageList/code.js', 'dev'); } break; /* Make sure when using CheckUser on IPs, it always has users selected by default rather than edits */ case "CheckUser": if ($.getUrlVar('user').split('.').length == 4) $('#subipusers').attr('checked','checked'); break; /* Add links for chatconnect log and CU on CheckUser Log user entries; replace MultiLookup with local contribs */ case "CheckUserLog": $('#mw-content-text ul li').each(function {     if (!$(this).children('.mw-usertoollinks').length) {        $(this).children('a:last').attr('href', articlePath + 'Special:Contributions/' + $(this).children('a:last').attr('href').split('?target=')[1]);        $(this).children('a:last').after(' (check)');      }    }); $('#mw-content-text ul li .mw-usertoollinks').each(function {     $(this).children('a:last').after(' | connect | check</a>');    }); break;

} /* 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) { $('.mw-logline-newusers').each(function {   $(this).find('.mw-usertoollinks').find('a:last').after(' | abuse</a>');  }); }

/* 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</a>');

/* 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)</a> (history)</a>');

/* 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 && c.wgTitle.split('.').length == 4) location.replace(articlePath + 'Special:Contributions/' + c.wgTitle);

/* Remove Help:Contents from dropdown thing */ if ($('#globalNavigation').length) $('.user-menu.subnav li:nth-child(3),.hubs-entry-point').remove;

/* Create toolbar links */ function addToolbarTool(param,text) { if ($('.toolbar > .tools').length) { $('.toolbar > .tools > li:last').after(     $('<li/>').append('' + text + '</a>')    ); } }

addToolbarTool("&allowuserjs=0","No User JS"); addToolbarTool("&allowusercss=0","No User CSS"); addToolbarTool("&useskin=monobook","Monobook"); addToolbarTool("&usesitejs=0","No Site JS"); addToolbarTool("&usesitecss=0","No Site CSS"); addToolbarTool("&useskin=qqx","MediaWiki Sources");

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

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

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

/* Remove self user rights changes on Special:Log/rights */ if (c.wgPageName.indexOf("Special:Log/rights") !== -1) { $('#mw-content-text form:nth-child(2) fieldset:nth-child(1) input:nth-child(8)').after(' Unique</a> '); $('#remove-self-changes').click(function {   $('.mw-logline-rights').each(function { if ($(this).children('a:first').text == $(this).children('a:last').text.split(':')[1]) //split using : to suit interlang $(this).remove; }); }); }

/* Add "show most recent" notice to message 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').indexOf(document.domain) === -1) $('#WikiaNotifications li div[data-type="1"]').append(' (show most recent</a>)');

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