Skip to content

Instantly share code, notes, and snippets.

@ready4god2513
Created March 19, 2012 19:04
Show Gist options
  • Save ready4god2513/2124182 to your computer and use it in GitHub Desktop.
Save ready4god2513/2124182 to your computer and use it in GitHub Desktop.
Turn the page on youversion via keyboard shortcuts. This is a Chrome Userscript that can be installed by saving as youversion.user.js and dragging in to Chrome.
// ==UserScript==
// @name Simple YouVersion Keyboard Pagination
// @author Brandon Hansen (https://github.com/ready4god2513)
// @description Turn the page on youversion via keyboard shortcuts. This is a Chrome Userscript that can be installed by saving as youversion.user.js and dragging in to Chrome.
// @match http://*.youversion.com/bible/*
// ==/UserScript==
document.onkeydown = function(e)
{
if(e.keyCode == 37)
{
document.location.href = document.getElementsByClassName("nav_prev")[0].getAttribute("href");
return false;
}
else if(e.keyCode == 39)
{
document.location.href = document.getElementsByClassName("nav_next")[0].getAttribute("href");
return false;
}
}
// Now, if we could just do this in jQuery
// $(document).keydown(function(e))
// {
// if(e.keyCode == 37)
// {
// document.location.href = $(".nav_prev").first().attr("href");
// return false;
// }
// else if(e.keyCode == 39)
// {
// document.location.href = $("nav_next").first().attr("href");
// return false;
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment