Greasy Fork镜像 还支持 简体中文。

Антилах 2.0 (ctrl+alt)

Антилах

目前為 2020-01-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name          Антилах 2.0 (ctrl+alt)
// @description	  Антилах
// @author        DygDyg
// @homepage      http://dygdyg.ddns.net
// @version       2.0.4
// @include       *
// @require       https://code.jquery.com/jquery-3.3.1.min.js
// @icon          https://cdn.discordapp.com/attachments/497134253788758026/657240743554973698/ico48.png
// @run-at        document-start
// @grant         GM_setValue
// @grant         GM_getValue
// @grant         GM_addStyle
// @grant 		  GM_info
// @grant         GM_unregisterMenuCommand
// @grant         GM_registerMenuCommand
// @grant         GM_openInTab
// @grant         GM_notification
// @run-at        context-menu
// @namespace https://gf.qytechs.cn/users/303755
// ==/UserScript==


function translateToNorm(text) {
    var layouts = { "q": "й", "w": "ц", "e": "у", "r": "к", "t": "е", "y": "н", "u": "г", "i": "ш", "o": "щ", "p": "з", "[": "х", "]": "ъ", "a": "ф", "s": "ы", "d": "в", "f": "а", "g": "п", "h": "р", "j": "о", "k": "л", "l": "д", ";": "ж", "'": "э", "z": "я", "x": "ч", "c": "с", "v": "м", "b": "и", "n": "т", "m": "ь", ",": "б", ".": "ю", "/": ".", "`": "ё", "Q": "Й", "W": "Ц", "E": "У", "R": "К", "T": "Е", "Y": "Н", "U": "Г", "I": "Ш", "O": "Щ", "P": "З", "{": "Х", "}": "Ъ", "A": "Ф", "S": "Ы", "D": "В", "F": "А", "G": "П", "H": "Р", "J": "О", "K": "Л", "L": "Д", ":": "^", "\"": "Э", "|": "/", "Z": "Я", "X": "Ч", "C": "С", "V": "М", "B": "И", "N": "Т", "M": "Ь", "<": "Б", ">": "Ю", "?": "&", "~": "Ё", "@": "\"", "#": "№", "$": ";", "^": ":", "&": "?", "й": "q", "ц": "w", "у": "e", "к": "r", "е": "t", "н": "y", "г": "u", "ш": "i", "щ": "o", "з": "p", "х": "[", "ъ": "]", "ф": "a", "ы": "s", "в": "d", "а": "f", "п": "g", "р": "h", "о": "j", "л": "k", "д": "l", "ж": ";", "э": "'", "я": "z", "ч": "x", "с": "c", "м": "v", "и": "b", "т": "n", "ь": "m", "б": ",", "ю": ".", "ё": "`", "Й": "Q", "Ц": "W", "У": "E", "К": "R", "Е": "T", "Н": "Y", "Г": "U", "Ш": "I", "Щ": "O", "З": "P", "Х": "{", "Ъ": "}", "Ф": "A", "Ы": "S", "В": "D", "А": "F", "П": "G", "Р": "H", "О": "J", "Л": "K", "Д": "L", "Ж": ":", "Э": "\"", "Я": "Z", "Ч": "X", "С": "C", "М": "V", "И": "B", "Т": "N", "Ь": "M", "Б": "<", "Ю": ">", "Ё": "~", "№": "#" };
    var text_defrustrated = "";
    for (i = 0; i < text.length; i++) {
        text_defrustrated += layouts[text.charAt(i)] || text.charAt(i);
    }

    console.log("Перевод: "+text_defrustrated);
    navigator.clipboard.writeText(text_defrustrated)
    GM_notification({ title: "Скопировано в буфер: ", text: text_defrustrated, image: "https://cdn.discordapp.com/attachments/497134253788758026/657240743554973698/ico48.png", timeout: 3000 });
    return text_defrustrated;
}

$(document).on('click', '.im-mess--edit._im_mess_edit', function (e) {
    if (e.ctrlKey) {
        let editor = $('.im_editable');
        let curTxt = editor.text();
        let newTxt = translateToNorm(curTxt);
        editor.text(newTxt);
        setTimeout(() => {
            $('.im-send-btn.im-chat-input--send.im-send-btn_saudio._im_send.im-send-btn_audio').click();
        }, 10)
    }
});




function runOnKeys(func, ...codes) {
    let pressed = new Set();

    document.addEventListener('keydown', function (event) {
        pressed.add(event.code);

        for (let code of codes) {
            if (!pressed.has(code)) {
                return;
            }
        }

        $(document).ready(function () {
            $('input').on('focus', function () {
                var $self = $(this);
                console.log($self);
            });
        });

        if (!getSelection().toString()) {
            console.log("!!!Нечего не выделено!!!");
            return;
        } else {
            console.log("Оригинал: "+getSelection().toString());
        }

        pressed.clear();

        func();
    });

    document.addEventListener('keyup', function (event) {
        pressed.delete(event.code);
    });
}

runOnKeys(
    function (e) {
        translateToNorm(getSelection().toString())
    },
    "ControlLeft",
    "AltLeft",
);

GM_addStyle(`
.dark-theme-box
    {
    position: fixed;
    white-space: nowrap;
    z-index: 200; height: 42px;
    top: 0; left: 0;
    padding: 0 5px 0 10px;
    line-height: 42px;
    }
.dark-theme-box a
    {
    color: red
    }
`);



$(document).ready(function () {

    $('#side_bar_inner ol').append($('<div>', { class: 'more_div' })).append($('<li>', { id: 'l_bt' }).append($('<a>', { class: 'left_row' }).on("click", () => { window.open('https://gf.qytechs.cn/ru/scripts/393973-%D0%B0%D0%BD%D1%82%D0%B8%D0%BB%D0%B0%D1%85-2-0-ctrl-alt') }).append($('<span>', {
        class: 'left_fixer', html: [
            $('<span>', { class: 'left_count_wrap fl_r left_void' }).append($('<span>', { class: 'inl_bl left_count_sign' })),
            $('<span>', { class: 'left_icon fl_l' }),
            $('<span>', { class: 'left_label inl_bl', text: `Антилах ${GM_info.script.version}` })
        ]
    }))))

});


QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址