Greasy Fork

Greasy Fork is available in English.

Fur Affinity Gallery Keys

Allows viewers to move between pictures in a gallery using the arrow keys.

当前为 2016-10-26 提交的版本,查看 最新版本

// ==UserScript==
// @name         Fur Affinity Gallery Keys
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Allows viewers to move between pictures in a gallery using the arrow keys.
// @author       ItsNix (https://www.furaffinity.net/user/itsnix/)
// @match        https://www.furaffinity.net/view/*
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';

    var prev = $('.prev').attr('href');
    var next = $('.next').attr('href');
    var nextpage = $('.parsed_nav_links').children('a:contains("NEXT")').attr('href');
    var prevpage = $('.parsed_nav_links').children('a:contains("PREV")').attr('href');
    if (nextpage === undefined) { nextpage = $('a.auto_link[href*="view"]:contains("Next"), a.auto_link[href*="view"]:contains("NEXT")').attr('href'); }
    if (prevpage === undefined) { prevpage = $('a.auto_link[href*="view"]:contains("Prev"), a.auto_link[href*="view"]:contains("PREV")').attr('href'); }
    if (nextpage === undefined) { nextpage = $('a.auto_link[href*="view"]:contains("Final"), a.auto_link[href*="view"]:contains("FINAL")').attr('href'); }
    if (prevpage === undefined) { prevpage = $('a.auto_link[href*="view"]:contains("First"), a.auto_link[href*="view"]:contains("FIRST")').attr('href'); }
    if (nextpage === undefined) { nextpage = $('a.auto_link[href*="view"]:contains("Last"), a.auto_link[href*="view"]:contains("LAST")').attr('href'); }
    $(window).keydown(function(e){
        if (e.target.id != 'JSMessage') {
            if (e.keyCode == 37 && next !== undefined) { window.location.href = next; return false; }
            if (e.keyCode == 39 && prev !== undefined) { window.location.href = prev; return false; }
            if (e.keyCode == 188 && prevpage !== undefined) { window.location.href = prevpage; return false; }
            if (e.keyCode == 190 && nextpage !== undefined) { window.location.href = nextpage; return false; }
        }
    });
})();