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

console.log("global.js: " + 7); (function {   var img;    if (wgUserLanguage == 'ru') img = 'http://i.imgur.com/HiMVnYC.png';    else img = 'http://i.imgur.com/JtmgNUu.png';    $('.permissions-errors').html('');     if ($('.editpage-intro-wrapper').length) $('img[src="' + img + '"]').width('122px'); });

// Some modification for global navigation $(".wds-global-navigation__link").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:MediaWiki:ChatHacksNotification.js'    ] });