G.E/EX Navigate Gallery Thumbnails

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

当前为 2015-05-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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/*
// @include        http://g.e-hentai.org/s/*
// @include        http://exhentai.org/s/*
// @include        https://g.e-hentai.org/s/*
// @include        https://exhentai.org/s/*
// @grant          GM_getValue
// @grant          GM_setValue
// @require        http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @icon           https://i.imgur.com/RPv1X1r.png
// @version        4.0
// ==/UserScript==
document.onkeyup = checkNumber;
function checkNumber(e) {
  e = e || window.event;
  // no shortcuts while commenting
  if ($(e.target).is('input, textarea')) {
    return;
  }
  // CMD + left arrow, blocks page change
   else if (e.keyCode == '37' && e.metaKey) {
    return;
  }
  // left arrow, back page
   else if (e.keyCode == '37') {
    $('table.ptt td:first-child a').click();
  }
  // CMD + right arrow, blocks page change
   else if (e.keyCode == '39' && e.metaKey) {
    return;
  }
  // right arrow, next page
   else if (e.keyCode == '39') {
    $('table.ptt td:last-child a').click();
  }
  // CMD + d, blocks page change
   else if (e.keyCode == '68' && e.metaKey) {
    return;
  }
  // d key, next page
   else if (e.keyCode == '68') {
    $('table.ptt td:last-child a').click();
  }
  // CMD + a, blocks page change
   else if (e.keyCode == '65' && e.metaKey) {
    return;
  }
  // a key, back page
   else if (e.keyCode == '65') {
    $('table.ptt td:first-child a').click();
  }
  // CMD + w, blocks page change
   else if (e.keyCode == '87' && e.metaKey) {
    return;
  }
  // w key, first page
   else if (e.keyCode == '87') {
    $('table.ptt td:nth-child(2) a').click();
  }
  // CMD + s, blocks page change
   else if (e.keyCode == '83' && e.metaKey) {
    return;
  }
  // s key, last page
   else if (e.keyCode == '83') {
    $('table.ptt td:nth-last-child(2) a').click();
  }
  // q key, return to gallery
   else if (e.keyCode == '81') {
    $('.sb a') [0].click();
  }
}