User:Commander Ghost/global.js

window.WHAMBotMe        = true; // Allow quick removal of a bot's bot flag window.WHAMBotReason    = "Malfunctioning bot"; window.WHAMDeleteReason = "Housekeeping."; window.WHAMBlockReason  = "Vandalism / Sockpuppetry"; window.WHAMBlockDuration = "infinite"; importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PreventTheLimbo.js',    ] });

//================== // Script imports //================== $.extend(true, window, {   /** AJAX Auto-Refresh **/    ajaxPages: new Array( "Special:WikiActivity", "Special:WikiActivity/watchlist", "Special:RecentChanges", "Special:RecentChangesLinked", "Special:Log", "Special:Images", "Special:ListFiles", "Special:Contributions", "Special:NewPages", "Special:UncategorizedPages", "Special:DoubleRedirects", "Special:WhatLinksHere", "Special:Categories", "Special:Videos", "Special:Watchlist", "Special:LonelyPages", "Special:BrokenRedirects", "Special:DeadendPages", "Special:Disambiguation", "Special:Withoutimages", "Blog:Recent_posts"),   ajaxRefresh: 30000,    AjaxRCRefreshText: 'Auto-refresh',    AjaxRCRefreshHoverText: 'Automatically refresh the page over time',    ajaxIndicator: 'https://vignette.wikia.nocookie.net/dev/images/b/ba/Snake_throbber_dark-bg.gif/revision/latest?cb=20140519203615',    /** LastEdited **/    timezone: "local",    /** PageCreator **/    useAvatar: true,    useTimestamp: true,    /** WHAM **/    WHAMDelay: 2125 }); /** ViewDeleted **/ var ViewDeleted = { noPrompt: true, rc: true, logs: true, modal: { preview: {width: 800}, content: {width: 700}} }; //================ // Script Imports //================ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxRC/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:EditBio/code.js',        'u:dev:MediaWiki:EnableDisabledCancelButton.js',        'u:dev:MediaWiki:FavoriteWikisPersistTab/code.js',        'u:dev:MediaWiki:FixCascadingProtectionEditButton.js',        'u:dev:MediaWiki:FixEditorTooltips.js',        'u:dev:MediaWiki:FixJSRTLang.js',        'u:dev:MediaWiki:FixLazyloadingInsideOfScrollable.js',        'u:dev:MediaWiki:FixSourcePages/code.js',        'u:dev:MediaWiki:GlobalEditcount/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:OldFilePages/code.js',        'u:dev:MediaWiki:PageCreator/code2.js',        'u:dev:MediaWiki:PersistentParameters/code.js',        'u:dev:MediaWiki:PreventTheLimbo.js',        'u:dev:MediaWiki:ProtectionIcons.js', 'u:dev:MediaWiki:QuickLogs/code.js', 'u:dev:MediaWiki:Quick Management/code.js', 'u:dev:MediaWiki:ThreadInspection/code.js', 'u:dev:MediaWiki:ShowUserGroups.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', 'u:dev:MediaWiki:ViewRemoved/code.js', 'u:dev:MediaWiki:ViewDeleted/code.js', 'u:dev:MediaWiki:WorkingMoreUsersCount.js', 'u:dev:MediaWiki:WHAM/code.2.js' ] }); //================================================ // Ask for user confirmation before rollbacking // Really handy to combat misclicks //================================================ $("a.mw-rollback-link[data-action = 'rollback'],\ .mw-custom-rollback-link").on('click', function(e) { var linkText = $(e.target).text, count = linkText.match(/\d/) ? linkText.match(/\d+/)[0]: null, message = 'Rollback ' + (count ? count + ' edits' : 'edit') + ' by ' + mw.util.getParamValue('from', e.target.href) + '?'; if(!confirm(message)) return e.preventDefault; }); //================================================================== // Makes the Tab key in the editor actually behave like a Tab key //================================================================== if (({   edit: 1,    editredlink: 1,    submit: 1  })[mediaWiki.config.get('wgAction')] === 1) { // Edit pages only        jQuery(function ($) { 'use strict'; var $box; // CKE Source mode if (mw.config.get('skin') === 'oasis') {$box = $('textarea.cke_source')} // Monobook Editing / Oasis Raw Source mode if (!$box || !$box.length) {$box = $('#wpTextbox1')} $box.keydown(function (e) {               if (e.keyCode === 9) {                    // Get caret position/selection                    var start = this.selectionStart,                        end = this.selectionEnd,                        value = jQuery(this).val;                    // Text before caret + tab + text after caret                    jQuery(this).val( value.substring(0, start) + "\t" + value.substring(end));                   // Put caret at right position again (add one for the tab)                    this.selectionStart = this.selectionEnd = start + 1;                    // Prevent the focus lose                    e.preventDefault;        }})}); }