NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name commitstrip.com next and previous page using keyboard
// @namespace com.phinisistudio.js
// @version 0.1
// @description Getting tired of clicking commitstrip.com next and previous page? this is the solution
// @author Muhammad Anis
// @include http://*commitstrip.com/*/
// @include http://*commitstrip.com/*/page/*
// @require http://code.jquery.com/jquery-1.7.2.min.js
// ==/UserScript==
(function($){
//register keydown left arrow and right arrow
$("body").keydown(function(e){
if(e.keyCode == 37) { // left
var prevLink = $('.previouspostslink').first();
if(prevLink.length > 0){
window.location.href=prevLink.attr('href');
}else{
alert("There is no more previous page");
}
}
else if(e.keyCode == 39) { // right
var nextLink = $('.nextpostslink').first();
if(nextLink.length > 0){
window.location.href=nextLink.attr('href');
}else{
alert("There is no more next page");
}
}
});
})(jQuery);