User:Сибирский Смотритель/global.js

console.log("global.js: " + 10); /*global require */ require(['jquery', 'fosl.wds'], function($, wds) {	if ($('[data-tracking="admin-dashboard"]').length)       $('', { class: 'wds-button wds-is-squished wds-is-secondary', href: '/wiki/MediaWiki:Wiki-navigation?action=edit', title: 'Редактировать навигацию', 'data-tracking': 'edit-nav', }).html( wds.icon('pencil', ['wds-icon', 'wds-icon-small'], 18) )       .insertAfter('[data-tracking="admin-dashboard"]'); });

// You Shall Not Pass Script // Author: Сибирский Смотритель require(['jquery', 'mw'], function($, mw) {   var i18n = {        en: 'http://i.imgur.com/JtmgNUu.png',        ru: 'http://i.imgur.com/HiMVnYC.png',    },     lang = mw.config.get('wgUserLanguage');

$(':not(.editpage-intro-wrapper) .permissions-errors') .html(''); });

// Some modification for global navigation $(".wds-global-navigation__logo") .html('') .css({   "-webkit-flex": "0 0 100px",    "-ms-flex": "0 0 100px",    "flex": "0 0 100px", }); $(".wds-global-navigation__link:last") .after('Популярные вики') .after('Игры') .after('Фильмы') .after('Книги'); $("#searchInput.wds-global-navigation__search-input").keydown(function(e) {   if (e.which == 27) {        $(".wds-global-navigation__search-close").trigger("click");        $(this).blur;    } });

//Скрипт, добавляющий теги s (Зачёркивание), u (Подчёркивание), mir (Переворачивание), tran (Транслитерация), rev (Реверс) и morze (Азбука Морзе) //Использование: [s]Текст для зачоркивания[/s] $('#Write [name="message"]').bind('keydown', function(e) {   if (e.which != 13) {        return;    }    //Это достаточно длинно, чтобы его иметь вначале    var letters = {"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};    var flipTo = {"я": "ʁ", "ю": "o", "э": "є", "ь": "q", "ы": "ıq", "ъ": "q", "щ": "m", "ш": "m", "ц": "ц", "х": "х", "ф": "ф", "у": "ʎ", "т": "ʟ", "с": "ɔ", "р": "d", "о": "о", "н": "н", "м": "w", "л": "v", "к": "ʞ", "и": "и", "з": "є", "ж": "ж", "ё": "ё", "е": "ǝ", "д": "6", "г": "L", "в": "ʚ", "б": "g", "а": "ɐ", z: "z", y: "ʎ", x: "x", w: "ʍ", v: "ʌ", u: "n", t: "ʇ", s: "s", r: "ɹ", q: "6", p: "d", o: "o", n: "u", m: "ш", l: "l", k: "ʞ", j: "ɾ", i: "ı", h: "у", g: "ƃ", f: "ɟ", e: "ǝ", d: "р", c: "ɔ", b: "q", a: "ɐ"}; var morzeCode = {"А": "·−", "A": "·−", "Б": "−···", "B": "−···", "В": "·−−", "W": "·−−", "Г": "−−·", "G": "−−·", "Д": "−··", "D": "−··", "Е": "·", "Ё": "·", "E": "·", "Ж": "···−", "V": "···−", "З": "−−··", "Z": "−−··", "И": "··", "I": "··", "Й": "·−−−", "J": "·−−−", "К": "−·−", "K": "−·−", "Л": "·−··", "L": "·−··", "М": "−−", "M": "−−", "Н": "−·", "N": "−·", "О": "−−−", "O": "−−−", "П": "·−−·", "P": "·−−·", "Р": "·−·", "R": "·−·", "С": "···", "S": "···", "Т": "−", "T": "−", "У": "··−", "U": "··−", "Ф": "··−·", "F": "··−·", "Х": "····", "H": "····", "Ц": "−·−·", "C": "−·−·", "Ч": "−−−·", "Ö": "−−−·", "Ш": "−−−−", "CH": "−−−−", "Щ": "−−·−", "Q": "−−·−", "Ñ": "−−·−−", "Ь": "−··−", "Ъ": "−··−", "X": "−··−", "Э": "··−··", "É": "··−··", "Ю": "··−−", "Ü": "··−−", "Я": "·−·−", "Ä": "·−·−", "1": "·−−−−", "2": "··−−−", "3": "···−−", "4": "····−", "5": "·····", "6": "−····", "7": "−−···", "8": "−−−··", "9": "−−−−·", "0": "−−−−−", ".": "······", ",": "·−·−·−", ":": "−−−···", ";": "−·−·−·", "(": "−·−−·−", ")": "−·−−·−", "`": "·−−−−·", "\"": "·−−−−·", "«": "·−−−−·", "»": "·−−−−·", "—": "−····−", "-": "−····−", "/": "−··−·", "?": "··−−··", "!": "−−··−−", "@": "·−−·−·", " ": "   "}; function makeLoop(tag, funct) { var message = $('#Write [name="message"]').val; while (message.search(new RegExp("\\[" + tag + "\\]([\\s\\S]+)\\[\\/" + tag + "\\]", "ig")) != -1) { var changedText = message.match(new RegExp("\\[" + tag + "\\]([\\s\\S]+?)\\[\\/" + tag + "\\]", "i")); var newtext = changedText[0].replace(new RegExp("\\[\\/?" + tag + "\\]", "ig"), ''); newtext = funct(newtext); $('#Write [name="message"]').val(message.replace(new RegExp(changedText[0].replace(/([\^\$\(\)\<\>\[\]\{\\\|\.\*\+\?])/ig, '\\$1'), "i"), newtext)); message = $('#Write [name="message"]').val; }   }    var actions = { 's': function(word) { console.log(1); return '\u0336' + word.split('').join('\u0336') + '\u0336'; },       'u': function(word) { return '\u0332' + word.split('').join('\u0332') + '\u0332'; },       'mir': function(word) { return word.toLowerCase.split('').reverse.map(function (char) {                return flipTo[char] || char;             }).join(""); },       'tran': function(word){ return word.split('').map(function (char) {                return letters[char] || char;             }).join(""); },       'rev': function(text) { return '&#8238;' + text; },       'morze': function(word) { return word.split('').map(function (char) {                return morzeCode[char.toUpperCase] + '  ' || ' ';             }).join(""); }     };    for (var i in actions) { makeLoop(i, actions[i]); } });

importArticles({   type: 'script',    articles: [        'u:dev:Wikimarks/code.js',        'u:dev:ChatHacks.js',        "w:c:ru.learnedit:User:Сибирский Смотритель/ChatHacksNotification.javascript"    ] });