aboutsummaryrefslogtreecommitdiff
path: root/yomichan-user/conf.d/shortcuts.js
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-03-30 19:07:24 +0100
committerlonkaars <loek@pipeframe.xyz>2024-03-30 19:07:24 +0100
commita29b452b89b2f83f0785f7e05ef5de0e60645b5a (patch)
tree4c867df855826dac2aeb7441465e52e39580e191 /yomichan-user/conf.d/shortcuts.js
parentf1fa7f0c181ab96a42c8bd7bbab4c8270fe31acf (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.js6
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" });
}