Last active
August 29, 2015 14:17
-
-
Save orng/c44890bf962056cb6fc5 to your computer and use it in GitHub Desktop.
Revisions
-
orng renamed this gist
Mar 25, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
orng created this gist
Mar 25, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ // ==UserScript== // @name ArtInt Navigator // @namespace gorn/aiNav // @description Enables back and forth navigation using the arrow keys on AI book webpage // @include http://artint.info/html/ArtInt_*.html // @version 1 // @grant none // ==/UserScript== var base = "http://artint.info/html/ArtInt_"; var end = ".html" function getNumber() { var url = document.URL; var number = parseInt(url.match("[0-9]+")); return number; } document.onkeydown = function(evt) { evt = evt || window.event; switch (evt.keyCode) { case 37: newUrl = base + (getNumber() - 1) + end; document.location.href = newUrl; break; case 39: newUrl = base + (getNumber() + 1) + end; document.location.href = newUrl; break; } };