fuj1n / Shotachan Gallery Arrow Controls

// ==UserScript==
// @name         Shotachan Gallery Arrow Controls
// @namespace    http://fuj1n.net/
// @version      1.0
// @description  Allows the use of arrow keys for the traversal of the shotachan galleries
// @author       fuj1n
// @match        *://shotachan.net/gallery/*
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

var prevTag = ".image-prev";
var nextTag = ".image-next";

try{
$(document).keydown(function(event){
    if(event.which == 37) { // Previous
        $(prevTag)[0].click();
    } else if (event.which == 39) { // Next
        $(nextTag)[0].click();
    }
});
}catch(err){ /* Not handling since it probably just means we're on the wrong gallery page */ }