Last active
November 27, 2019 09:36
-
-
Save JulianWebb/111ea5f71f36f9a55dae76f812e35c69 to your computer and use it in GitHub Desktop.
Changed to addEventListener as per Kuilin
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== | |
// @name Genocide Man Arrow Keys | |
// @namespace https://gist.github.com/JulianWebb | |
// @version 0.2 | |
// @author Pongles | |
// @description Adds the ability to navigate the comic using just the left and right arrow keys | |
// @icon https://www.genocideman.com/wp-content/uploads/2015/08/cropped-genoman-logo-icon-32x32.jpg | |
// @match https://www.genocideman.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log('Genocide Man Arrow Keys is working!') | |
document.addEventListener("keydown", event => { | |
switch (event.key) { | |
case 'ArrowLeft': | |
let prevPage = document.querySelector("a[rel=prev]"); | |
prevPage.click() | |
break; | |
case 'ArrowRight': | |
let nextPage = document.querySelector("a[rel=next]"); | |
nextPage.click(); | |
break; | |
default: return; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment