Keyboard Navigation for Worm

Just adds arrow key movement.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Keyboard Navigation for Worm
// @description Just adds arrow key movement.
// @namespace   http://userscripts.org/users/scuzzball
// @include     http://parahumans.wordpress.com/*
// @grant       none
// @version     1.0
// ==/UserScript==

if(document.getElementsByClassName('nav-next')[0].hasChildNodes()){//so if the menunav-next div is not empty, get the next link. Otherwise, blank.
    navNext = document.getElementsByClassName('nav-next')[0].firstChild.getAttribute("href");
}else{
    navNext="";
}

if(document.getElementsByClassName('nav-previous')[0].hasChildNodes()){//so if the menunav-next div is not empty, get the next link. Otherwise, blank.
    navPrev = document.getElementsByClassName('nav-previous')[0].firstChild.getAttribute("href");
}else{
    navPrev="";
}

function leftArrowPressed() {
   window.location = navPrev;
}

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

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