Skip to content

Instantly share code, notes, and snippets.

@xl1
Created April 22, 2014 14:32
Show Gist options
  • Save xl1/11181457 to your computer and use it in GitHub Desktop.
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))
`
// ==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