User:RisenPhoenix/global.js

//purge button config PurgeButtonText = 'Purge';

//last edited config window.lastEdited = { avatar: true, size: false, diff: true, comment: true, time: true };

//cache check config cacheSkip = []; cacheSkipLimit = 1000;

// User page creation // Borrowed from Yatalu templateLanguages = ['en', 'es']; qtUserPageTemplate = '';

var qtEnableUserPageOverwrite = true;

//ajax rc config window.ajaxPages = ["Special:RecentChanges","Special:Watchlist","Special:Log","Special:Contributions"];

//batch delete config batchDeleteDelay = 1000;

//wham config WHAMDelay = 1000;

if (wgDBname !== 'admintools') { // Script imports window.importArticles( {   type: 'script',    articles: [      'w:dev:QuickCreateUserPage/code.js',       'u:dev:LastEdited/code.js',      'u:dev:View_Source/code.js',      'u:dev:CacheCheck/code.js',      "w:c:dev:RevealAnonIP/usercode.js",      'u:dev:PurgeButton/code.js',      'u:dev:WHAM/code.2.js',      'u:dev:AjaxUndo/code.js',      'u:dev:QQX/code.js',      'u:dev:ViewRemoved/code.js',                            'u:dev:RedirectManagement/code.js',      'u:dev:CleanWantedFiles/code.js',      'u:dev:AjaxBatchDelete/code.2.js',      'w:c:community:User:Ozuzanna/nuke.js',      'u:dev:NoImageLightbox/code.js',      'u:admintools:MediaWiki:Common.js/powerUser.js',       'u:admintools:MediaWiki:Common.js/sitenotice.js',      'u:admintools:MediaWiki:Common.js/extraRollbacks.js',      'u:admintools:MediaWiki:Common.js/ajaxRollback.js',      'u:dev:ReplyBottom/code.js',     ] } ); }

// stuff I found in @Ozuzanna's global.js

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

switch (c.wgCanonicalSpecialPageName) { /* Add IP lookup on anon contribs */ case "Contributions": if ($('#anontalktext').length && c.wgTitle.split('.').length == 4) $('.masthead-info h2').html('(lookup)'); break; } /* Always go to IP contributions, not userpage */ if (c.wgNamespaceNumber == 2 && c.wgTitle.split('.').length == 4) location.replace(articlePath + 'Special:Contributions/' + c.wgTitle);

/* Create toolbar links */ function addToolbarTool(param,text) { if ($('.toolbar > .tools').length) { $('.toolbar > .tools > li:last').after(     $('').append('' + text + '')    ); } } addToolbarTool("&useskin=monobook","Mono"); addToolbarTool("&useskin=wikiamobile","Mobi"); addToolbarTool("&allowuserjs=0","No User JS"); addToolbarTool("&allowusercss=0","No User CSS"); addToolbarTool("&usesitejs=0","No Site JS"); addToolbarTool("&usesitecss=0","No Site CSS"); /* Auto-submit bugged pages for deletion */ if (c.wgAction == "delete" && $('#ca-edit').text.trim == "Create") $('#mw-img-deleteconfirm,#deleteconfirm').submit;

// by @OneTwoThreeFall

// disable redirect links $('.mw-redirect, .allpagesredirect > a').each(function {  var link = new mw.Uri(this.href);  link.extend({ redirect: 'no' }); $(this).attr('href', link.toString); }); // don't leave redirect when moving files if (mw.config.get('wgCanonicalSpecialPageName') === 'Movepage' &&   mw.config.get('wgRelevantPageName').indexOf(mw.config.get("wgFormattedNamespaces")[6] + ':') === 0) { $('#wpLeaveRedirect').prop('checked', false); } // quick prefix search if (mw.config.get('wgNamespaceNumber') !== -1) { var prefixlink = 'Prefix search'; if (mw.config.get('skin') === 'oasis') { $('#my-tools-menu').prepend(prefixlink); } else if (mw.config.get('skin') === 'monobook') { $('#p-tb > .pBody > ul').append(prefixlink); } } //end if (mw.config.get('wgPageName') == "Special:Torus") { importScriptURI('http://monchbox.wikia.com/wiki/User:Monchoman45/monobook.js?action=raw&ctype=text/javascript&templates=expand'); $('.global-navigation').remove; } }) (this.jQuery, this.mediaWiki);

/* Removing content from auto-adding to additional reason when deleting (probably written by Josephyr) */ $(function {   // Clears the delete reason box if it's an autosummary    if (wgAction && wgAction === "delete") {        var deleteBox = document.getElementsByName("wpReason")[0];        if (deleteBox && deleteBox.value.search("content was") === 0) {            deleteBox.value = "";        }    } });

/* Stuff written by @Bobogoobo */

// Add "infinite" value to expiry dropdowns (another thing that should be built-in) $('#mw-input-wpExpiry option:last').before(   $(' ', { 'value':'infinite', 'text':'infinite' }) ); //Highlight whitespace characters in diffs when they're the only thing in the change //Winner of most conspicuous missing feature for five consecutive years if (window.location.href.indexOf('diff=') !== -1) { $('.diffchange-inline').each(function {       if (!(new RegExp('\\S+').test($(this).text))) {            $(this).css('background-color', 'red');        }    }); }

//end

// Stuff I borrowed from ChaoticShadow

// Makes the template classification default to 'Unknown' if (mw.config.get('wgAction') === "edit") { $('#template-classification-unknown').prop('checked',true); $('.buttons .primary').removeAttr('disabled'); $('.buttons .primary').click; } //end

//STYLE import importArticles({   type: "style",    articles: [        "w:c:dev:Highlight/code.css"    ] });