Keyboard Navigation for Worm

Just adds arrow key movement.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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;
    }
};