Created
April 22, 2014 14:32
-
-
Save xl1/11181457 to your computer and use it in GitHub Desktop.
Google 検索で JK 使えるようにするやつ (Chrome で espv 付いてると使えなくなってる (2014/4/22 36.0.1941.0 dev-m))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
` | |
// ==UserScript== | |
// @match https://www.google.com/* | |
// @run-at document-end | |
// ==/UserScript== | |
` | |
links = document.querySelectorAll '.r > a' | |
index = 0 | |
if links.length | |
links[index].focus() | |
document.addEventListener 'keydown', ({ keyCode }) -> | |
switch String.fromCharCode keyCode | |
when 'J' | |
links[++index].focus() | |
when 'K' | |
links[--index].focus() | |
, false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment