Schlock Mercenary Navigation Improvements

Makes the image a link to the next comic, and arrow keys control movement.

Від 02.06.2014. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Schlock Mercenary Navigation Improvements
// @namespace   http://userscripts.org/users/Scuzzball
// @description Makes the image a link to the next comic, and arrow keys control movement.
// @include     http://www.schlockmercenary.com/*
// @version     1.0
// ==/UserScript==




if(document.getElementById('nav-next').tagName == "A") //If the next link is a link(It's a div when no new comic)
{
	var navNext = document.getElementById('nav-next');
}
else
{
	var navNext = ""
}

document.getElementById('comic').innerHTML = '<a href="' + navNext + '">' + document.getElementById('comic').innerHTML + '</a>';


function leftArrowPressed() {
	window.location = document.getElementById('nav-previous');
}

function rightArrowPressed() {
	window.location = navNext;
}

document.onkeydown = function(evt) {
    evt = evt || window.event;
    switch (evt.keyCode) {
        case 37:
            leftArrowPressed();
            break;
        case 39:
            rightArrowPressed();
            break;
    }
};