New Userscript

custom keymap overlay for monkeytype

Version au 21/06/2021. Voir la dernière version.

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  custom keymap overlay for monkeytype
// @author       Joe. Joe Mama.
// @match        https://monkeytype.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function swap(key1, key2){
        var k1 = document.getElementById("Key"+key1);
        var k2 = document.getElementById("Key"+key2);
        k1.id = "Key"+key2;
        k2.id = "Key"+key1;
        var tempk1val = k1.getElementsByTagName("span")[0].innerText
        k1.getElementsByTagName("span")[0].innerText = k2.getElementsByTagName("span")[0].innerText
        k2.getElementsByTagName("span")[0].innerText = tempk1val
    }


    //just right click anywhere for the changes to be made
    //the goal is to have keys swap places with each other on the keymap to suit your layout
    window.oncontextmenu = function (){
        //use capital letters for keys, swap("a","b"); will not work, you will have to use swap("A","B");
        //for symbols like ";" type them like "Semicolon", if you have doubts on the word then just inspect element the key and see what the 'id' of the element is
        swap("O","Semicolon");
        swap("F","G");
        swap("Z","Quote");
        swap("K","Quote");
        swap("D","Quote");
        swap("C","Quote");
        swap("X","Quote");
    };
})();