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



window.ajaxPages = Array("Special:WikiActivity", "Special:Log", "Special:RecentChanges", "Special:RecentChangesLinked", "Special:Watchlist", "Special:Contributions", "Special:Images");

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:MediaWiki:AjaxRC/code.js",        "u:dev:MediaWiki:LastEdited/code.js",        "u:dev:MediaWiki:PageCreator/code2.js",        "u:dev:MediaWiki:CodeQuickLinks/code.js",        "u:dev:MediaWiki:NewImages.js",        "u:dev:MediaWiki:EditBio/code.js",        "u:dev:MediaWiki:ShowUserGroups.js",        "u:dev:MediaWiki:QuickLogs/code.js",        "u:dev:MediaWiki:RelatedDiscussionsModule/code.js",        "u:dev:MediaWiki:OldFilePages/code.js",        "u:dev:MediaWiki:ViewRemoved/code.js",        "u:dev:MediaWiki:AjaxUndo/code.js",        "u:dev:MediaWiki:GlobalEditcount/code.js"    ] });