Char replacer

16.08.2020, 16:39:22

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Advertisement:

// ==UserScript==
// @name        Char replacer 
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      -
// @description 16.08.2020, 16:39:22
// ==/UserScript==

var charsChange = {
    а: "о",
    о: "а",
    б: "п",
    п: "б",
    в: "ф",
    ф: "в",
    г: "к",
    к: "г",
    д: "т",
    т: "д",
    е: "э",
    э: "е",
    щ: "ж",
    ш: "щ",
    ж: "ш",
    з: "с",
    с: "з",
    и: "ы",
    ы: "и",
    л: "р",
    р: "л",
    м: "н",
    н: "м",
    у: "ю",
    ю: "у",
    я: "а"
}

onkeydown = function (e) {
    if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') return
    if (Math.random() > .1) return
    var char
    if (charsChange[e.key]) char = charsChange[e.key]
    else return
    e.preventDefault()
    e.target.value += char
}