Skip to content

Instantly share code, notes, and snippets.

@Zyst
Last active November 21, 2023 07:18
Show Gist options
  • Select an option

  • Save Zyst/3f58009943653e7873d30f1c748cf9ce to your computer and use it in GitHub Desktop.

Select an option

Save Zyst/3f58009943653e7873d30f1c748cf9ce to your computer and use it in GitHub Desktop.

Revisions

  1. Zyst revised this gist Mar 15, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@

    const loopToFindKeyboard = () => {
    const kb = document.querySelector("main > div > div > svg");
    if (kb) return remapKeys();
    if (document.title === "Typing Practice" && kb) return remapKeys();
    setTimeout(loopToFindKeyboard, 500);
    };

  2. Zyst revised this gist Mar 15, 2022. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    // ==UserScript==
    // @name KeyBR Colemak-DH
    // @namespace http://tampermonkey.net/
    // @version v1.1
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author https://github.com/Zyst
    // @match https://www.keybr.com/
    // @icon https://www.google.com/s2/favicons?domain=keybr.com
    // @grant none
    // @name KeyBR Colemak-DH
    // @namespace http://tampermonkey.net/
    // @version v1.1
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author https://github.com/Zyst
    // @match https://www.keybr.com/
    // @icon https://www.google.com/s2/favicons?domain=keybr.com
    // @grant none
    // @contributors https://github.com/hilarycheng
    // ==/UserScript==

    (() => {
    @@ -31,7 +32,7 @@
    };

    const loopToFindKeyboard = () => {
    const kb = document.querySelector("main#App > div > div > div > svg");
    const kb = document.querySelector("main > div > div > svg");
    if (kb) return remapKeys();
    setTimeout(loopToFindKeyboard, 500);
    };
  3. Zyst revised this gist Dec 27, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name KeyBR Colemak-DH
    // @namespace http://tampermonkey.net/
    // @version v1.2
    // @version v1.1
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author https://github.com/Zyst
    // @match https://www.keybr.com/
  4. Zyst revised this gist Dec 27, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name KeyBR Colemak-DH
    // @namespace http://tampermonkey.net/
    // @version final
    // @version v1.2
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author https://github.com/Zyst
    // @match https://www.keybr.com/
    @@ -31,7 +31,7 @@
    };

    const loopToFindKeyboard = () => {
    const kb = document.querySelector("svg.Keyboard.Keyboard--full");
    const kb = document.querySelector("main#App > div > div > div > svg");
    if (kb) return remapKeys();
    setTimeout(loopToFindKeyboard, 500);
    };
  5. Zyst revised this gist Nov 6, 2021. 1 changed file with 25 additions and 21 deletions.
    46 changes: 25 additions & 21 deletions KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -10,27 +10,31 @@
    // ==/UserScript==

    (() => {
    'use strict';
    const remapKey = (originalKey, newValue) => {
    document.querySelector(`svg[data-key='Key${originalKey}'] > text`).innerHTML = newValue;
    }
    "use strict";
    const KEYS_TO_REMAP = [
    { from: "T", to: "B" },
    { from: "G", to: "G" },
    { from: "H", to: "M" },
    { from: "Z", to: "X" },
    { from: "X", to: "C" },
    { from: "C", to: "D" },
    { from: "B", to: "Z" },
    { from: "M", to: "H" },
    ];

    const remapKeys = () => {
    remapKey('T', 'B')
    remapKey('G', 'G')
    remapKey('H', 'M')
    remapKey('Z', 'X')
    remapKey('X', 'C')
    remapKey('C', 'D')
    remapKey('B', 'Z')
    remapKey('M', 'H')
    }
    const remapKey = ({ from, to }) => {
    document.querySelector(`svg[data-key='Key${from}'] > text`).innerHTML = to;
    };

    const loopToFindKeyboard = () => {
    const kb = document.querySelector("svg.Keyboard.Keyboard--full")
    if (kb) return remapKeys()
    setTimeout(loopToFindKeyboard, 500)
    }
    const remapKeys = () => {
    KEYS_TO_REMAP.forEach(remapKey);
    };

    loopToFindKeyboard()
    })();
    const loopToFindKeyboard = () => {
    const kb = document.querySelector("svg.Keyboard.Keyboard--full");
    if (kb) return remapKeys();
    setTimeout(loopToFindKeyboard, 500);
    };

    loopToFindKeyboard();
    })();
  6. Zyst revised this gist Nov 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // @namespace http://tampermonkey.net/
    // @version final
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author You
    // @author https://github.com/Zyst
    // @match https://www.keybr.com/
    // @icon https://www.google.com/s2/favicons?domain=keybr.com
    // @grant none
  7. Zyst revised this gist Nov 6, 2021. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,6 @@
    }

    const loopToFindKeyboard = () => {
    console.log('loooooping')
    const kb = document.querySelector("svg.Keyboard.Keyboard--full")
    if (kb) return remapKeys()
    setTimeout(loopToFindKeyboard, 500)
  8. Zyst created this gist Nov 6, 2021.
    37 changes: 37 additions & 0 deletions KeyBR Colemak-DH ANSI.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    // ==UserScript==
    // @name KeyBR Colemak-DH
    // @namespace http://tampermonkey.net/
    // @version final
    // @description Switch Colemak layout in keybr.com to Colemak DH
    // @author You
    // @match https://www.keybr.com/
    // @icon https://www.google.com/s2/favicons?domain=keybr.com
    // @grant none
    // ==/UserScript==

    (() => {
    'use strict';
    const remapKey = (originalKey, newValue) => {
    document.querySelector(`svg[data-key='Key${originalKey}'] > text`).innerHTML = newValue;
    }

    const remapKeys = () => {
    remapKey('T', 'B')
    remapKey('G', 'G')
    remapKey('H', 'M')
    remapKey('Z', 'X')
    remapKey('X', 'C')
    remapKey('C', 'D')
    remapKey('B', 'Z')
    remapKey('M', 'H')
    }

    const loopToFindKeyboard = () => {
    console.log('loooooping')
    const kb = document.querySelector("svg.Keyboard.Keyboard--full")
    if (kb) return remapKeys()
    setTimeout(loopToFindKeyboard, 500)
    }

    loopToFindKeyboard()
    })();