From 9eea6586e8fb051744f892573dc6096b51b487b6 Mon Sep 17 00:00:00 2001 From: Utopiah Date: Wed, 5 Aug 2026 18:53:08 +0200 Subject: [PATCH] block --- kbd.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kbd.js b/kbd.js index 57de3da..f1de122 100644 --- a/kbd.js +++ b/kbd.js @@ -21,6 +21,7 @@ function onError(error) { let key, modifiers = [] let seq = '' +let richSeq = '' document.addEventListener("keydown", function(event) { if (event.key.length === 1 || event.key === event.code) { @@ -29,9 +30,13 @@ document.addEventListener("keydown", function(event) { if (key == 'Escape') { seq = '' modifiers = [] + richSeq = '' return } - if ( event.key.length === 1) seq += key // does not take modifiers into account per key, e.g. IoT works but not ^i^o^t + if ( event.key.length === 1) { + seq += key // does not take modifiers into account per key, e.g. IoT works but not ^i^o^t + richSeq += modifiers.join('') + key + } } else { // 'Alt', 'Control', 'Shift' modifiers.push( event.key ) @@ -66,6 +71,7 @@ document.addEventListener("keyup", function(event) { // could then grow userActions by the user themselves, save in localStorage, etc without having to rebuild extension // note that i is different from I (which is here captured as I + Shift) let userActions = [ + // consider richSeq instead { seq: 'gtm', action: 'window.open("https://twitter-archive.benetou.fr/")'}, { seq: 'gg', action: 'window.scrollTo(0, 0)'}, { key: 'G', mods: ['Shift'], action: 'window.scrollTo(0, document.body.scrollHeight)'}, @@ -74,6 +80,7 @@ let userActions = [ { key: 'r', action: 'window.location.reload()'}, { key: 'x', action: 'autoscroll()'}, { key: 'b', action: 'history.back()'}, + { key: 'B', mods: ['Shift'], action: 'blocked = !blocked'}, // can not be unblocked, need to refresh the page { key: 'a', action: 'addWiki()'}, { key: 'n', action: 'firstTab()'}, { key: 'P', mods: ['Shift'], action: 'window.open("https://account.proton.me/")'},