G.E/EX Navigate Gallery Thumbnails

Navigate through pages of in-gallery thumbnails with A/D or arrows.

Από την 14/03/2015. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey 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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        G.E/EX Navigate Gallery Thumbnails
// @description Navigate through pages of in-gallery thumbnails with A/D or arrows.
// @author      Hen Tie
// @homepage	http://hen-tie.tumblr.com/
// @namespace   https://greasyfork.org/en/users/8336
// @include	http://g.e-hentai.org/g/*
// @include	http://exhentai.org/g/*
// @include	https://g.e-hentai.org/g/*
// @include	https://exhentai.org/g/*
// @grant	GM_getValue
// @grant	GM_setValue
// @run-at 	document-start
// @require	http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @icon        https://i.imgur.com/RPv1X1r.png
// @version	3.0
// ==/UserScript==

document.onkeydown = checkNumber;
function checkNumber(e) {

    e = e || window.event;

    if ($(e.target).is('input, textarea')) {
        // no shortcuts while commenting
        return;   
    }
    else if (e.keyCode == '37' && e.metaKey) {
        // CMD + left arrow, blocks page change
        return;
    }
    else if (e.keyCode == '37') {
	      // left arrow, back page
	      $('table.ptt td:first-child a').click();
    }
    else if (e.keyCode == '39' && e.metaKey) {
        // CMD + right arrow, blocks page change
        return;
    }
    else if (e.keyCode == '39') {
        // right arrow, next page
        $('table.ptt td:last-child a').click();
    }
    else if (e.keyCode == '68' && e.metaKey) {
        // CMD + d, blocks page change
        return;
    }
    else if (e.keyCode == '68') {
        // d key, next page
        $('table.ptt td:last-child a').click();
    }
    else if (e.keyCode == '65' && e.metaKey) {
        // CMD + a, blocks page change
        return;
    }
    else if (e.keyCode == '65') {
        // a key, back page
        $('table.ptt td:first-child a').click();
    }
    else if (e.keyCode == '87' && e.metaKey) {
        // CMD + w, blocks page change
        return;
    }
    else if (e.keyCode == '87') {
        // w key, first page
        $('table.ptt td:nth-child(2) a').click();
    }
    else if (e.keyCode == '83' && e.metaKey) {
        // CMD + s, blocks page change
        return;
    }
    else if (e.keyCode == '83') {
        // s key, last page
        $('table.ptt td:nth-last-child(2) a').click();
    }
}