When I read Japanese books I use jisho.org a lot. I mostly read on my computer, so I mostly keep my hands on the keyboard. Sometimes when jisho can’t recognize a search query, the input field loses focus and I have to take the mouse and click again on the input field which I then have to clear with Backspace. Another situation is when I get to the end of the long list of search results and have to scroll all the way back to top. It’s not a big deal, but after some number of repetitions it gets annoying.
That’s why I created a simple script that allows a simple keyboard-only navigation with key combinations:
- Alt + Q : scroll back to top and focus input field
- Alt + K : scroll up
- Alt + J : scroll down
- Alt + N : click “More Words” link
If you want to use other keys, you can edit the code of the script. Here are the values to check for:
-
e.altKey
Alt -
e.ctrlKey
Ctrl -
e.shiftKey
Shift - for letter keys you need to use comparison:
e.code === "KeyX"
- just look at the existing code to get the idea
If you want to change the speed of scroll, change the value of top
in the line window.scrollBy({ top: 200, left: 0, behavior: "smooth" });
(and the other one for scrolling up).