Skip to content

Instantly share code, notes, and snippets.

@gigawatts
Last active December 22, 2022 19:04
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 gigawatts/266b2ad2dd699c80a0c323424c39555f to your computer and use it in GitHub Desktop.
Save gigawatts/266b2ad2dd699c80a0c323424c39555f to your computer and use it in GitHub Desktop.
TamperMonkey/GreaseMonkey UserScript to add keyboard arrow navigation to Hackaday articles
// ==UserScript==
// @name Hackaday Arrow Navigation
// @description Adds keyboard arrow navigation to Hackaday articles
// @author Gigawatts
// @version 1.0.0
// @homepage https://gist.github.com/gigawatts/266b2ad2dd699c80a0c323424c39555f/
// @updateURL https://gist.githubusercontent.com/raw/266b2ad2dd699c80a0c323424c39555f/hackaday-arrow-nav.user.js
// @downloadURL https://gist.githubusercontent.com/raw/266b2ad2dd699c80a0c323424c39555f/hackaday-arrow-nav.user.js
// @match *://hackaday.com/*
// ==/UserScript==
(function() {
'use strict';
// listen for keyUp events
document.onkeyup = e => {
switch(e.key) {
case 'ArrowLeft':
document.querySelector('a[rel=prev]').click();
break;
case 'ArrowRight':
document.querySelector('a[rel=next]').click();
break;
}
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment