ehentai flipping shortcut

use 'A','D','←','→' to flip page in e-hentai/exhentai, also works in gallery view

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         ehentai flipping shortcut
// @namespace    none
// @version      0.1.4
// @description  use 'A','D','←','→' to flip page in e-hentai/exhentai, also works in gallery view
// @author       creonly
// @match        exhentai.org/*
// @match        e-hentai.org/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
})();
document.onkeydown=function(b){
    b=(b)?b:window.event;
    var isInput = b?b.srcElement.type == "text":false;
    if(isInput) return;
	var ptt=document.getElementsByClassName("ptt")[0];
    if(ptt){
        ptt = ptt.getElementsByTagName("a")
    }
    var uprev = document.getElementById("uprev");
    var unext = document.getElementById("unext");
    if(b.keyCode=="37"|b.keyCode=="65"){
		if(ptt){
			window.location.href=ptt[0].href;
         }
        if(uprev){
            window.location.href=uprev.href;
        }
    }else if(b.keyCode=="39"|b.keyCode=="68"){
		if(ptt){
			window.location.href=ptt[ptt.length-1].href;
        }
        if(unext){
            window.location.href=unext.href;
        }
    }
};