Hebraicize Typing.com

Converts Typing.com to Hebrew keyboard.

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!)

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!)

// ==UserScript==
// @name         Hebraicize Typing.com
// @namespace    http://github.com/emosenkis
// @version      2024-12-08
// @description  Converts Typing.com to Hebrew keyboard.
// @author       emosenkis
// @include      https://www.typing.com/*/lesson/*
// @include      https://typing.com/*/lesson/*
// @match        http*://www.typing.com/*/lesson/*
// @match        http*://typing.com/*/lesson/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      MIT
// ==/UserScript==

(function(){
    const en = "QWERTYUIOP[ASDFGHJKL;'ZXCVBNM,./";
    const he = "/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ.";
    function hebraicize() {
        const els = document.querySelectorAll(".key-label, .letter");
        for(const el of els) {
            if (el.innerText == null || el.hebraicized === el.innerText) { continue }
            el.hebraicized = el.innerText;
            const it = el.innerText.trim();
            if (it.length !== 1) { continue };
            const idx = en.indexOf(it.toUpperCase());
            if (idx === -1) { continue };
            console.log(it + " -> " + he[idx]);
            el.innerText = el.innerText.replace(it, he[idx])
        }
    }
    hebraicize();
    new MutationObserver(hebraicize).observe(document, {childList:true,subtree:true})
}())