Skip to content

Instantly share code, notes, and snippets.

@judell
Created October 18, 2018 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judell/abb850091c347e11d24693563017b003 to your computer and use it in GitHub Desktop.
Save judell/abb850091c347e11d24693563017b003 to your computer and use it in GitHub Desktop.
delete hypothesisHighlights
hypothesisHighlights = Array.from(document.body.querySelectorAll('hypothesis-highlight'))
var hypothesisIndex = 0
document.body.addEventListener('keydown', function (e) {
let hl
if (e.key === 'ArrowDown' && hypothesisIndex < hypothesisHighlights.length) {
document.body.scrollIntoView(true)
hl = hypothesisHighlights[hypothesisIndex]
hl.scrollIntoView({
block: "center",
inline: "center",
behavior: "auto"
})
hl.click()
hypothesisIndex++
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment