diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-30 19:07:24 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-30 19:07:24 +0100 |
commit | a29b452b89b2f83f0785f7e05ef5de0e60645b5a (patch) | |
tree | 4c867df855826dac2aeb7441465e52e39580e191 /yomichan-user/conf.d/shortcuts.js | |
parent | f1fa7f0c181ab96a42c8bd7bbab4c8270fe31acf (diff) |
clean up keyboard shortcuts + add shortcut for copying sentence
Diffstat (limited to 'yomichan-user/conf.d/shortcuts.js')
-rw-r--r-- | yomichan-user/conf.d/shortcuts.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/yomichan-user/conf.d/shortcuts.js b/yomichan-user/conf.d/shortcuts.js index 0e2d2c8..8b6aafc 100644 --- a/yomichan-user/conf.d/shortcuts.js +++ b/yomichan-user/conf.d/shortcuts.js @@ -1,16 +1,16 @@ (() => { window.addEventListener("keydown", ev => { if (ev.altKey != true) return; - if (ev.key == "j" || ev.key == "k") { + if (ev.code == "KeyJ" || ev.code == "KeyK") { // alt j/k for moving up/down entries var currentEntry = document.getElementsByClassName("entry-current")[0]; - var sibling = currentEntry[ev.key == "j" ? "nextSibling" : "previousSibling"]; + var sibling = currentEntry[ev.code == "KeyJ" ? "nextSibling" : "previousSibling"]; if (sibling == null) return; currentEntry.classList.remove("entry-current"); sibling.classList.add("entry-current"); sibling.scrollIntoView({ behavior: "smooth", block: "center" }); } - else if (ev.key == "g") { + else if (ev.code == "KeyG") { // g for going back to top document.getElementById("content-scroll").scrollTo({ top: 0, behavior: "smooth" }); } |