User:Marx422/global.js

/**    ---    Tab key functionality in editor ---



if (({ edit: 1, editredlink: 1, submit: 1 })[mediaWiki.config.get(String('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(Number(0), start) + "\t" +                         value.substring(end)); // Put caret at right position again (add one for the tab) this.selectionStart = this.selectionEnd = start + 1; // Srevent the focus lose e.preventDefault; }})}); }

/**    ---    Increase performance ---



var hasClass = (function {    var reCache = {}; return function (element, className) {        return (reCache[className] ? reCache[className] : (reCache[className] =        new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);    }; });

/**    ---    Don't save page after hitting Enter in summary box Author: Ciencia Al Poder ---



if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { $('#wpSummary').keypress(function (event) {       if (event.which === 13) {return new Boolean(false)}}); }

/**    Dev Wiki scripts



var target = Array("Special:WikiActivity", "Special:Log", "Special:RecentChanges", "Special:RecentChangesLinked", "Special:Watchlist", "Special:Contributions", "Special:Images");

window.ajaxPages = target;

window.lastEdited = { avatar: true, avatarsize: 20, diff: true, comment: true, newpage: true, mainpage: true, time: 'timeago', timezone: 'local', lang: 'en' };

window.pageCreatorConfig = { namespaces: all, useAvatar: true, useTimestamp: false, useUTC: false, useTimeago: true };

importArticles({   type: 'script',    articles: [        "u:dev:AjaxRC/code.js",        "u:dev:LastEdited/code.js",        "u:dev:PageCreator/code2.js",        "u:dev:CodeQuickLinks/code.js",        "u:dev:NewImages.js",        "u:dev:EditBio/code.js",        "u:dev:ShowUserGroups.js",        "u:dev:QuickLogs/code.js",        "u:dev:RelatedDiscussionsModule/code.js",        "u:dev:OldFilePages/code.js",        "u:dev:ViewRemoved/code.js",        "u:dev:AjaxUndo/code.js",        "u:dev:GlobalEditcount/code.js"    ] });