您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Navigate giveaway pages with left and right arrow keys
// ==UserScript== // @name Goodreads giveaways arrow pager // @namespace randomecho.com // @description Navigate giveaway pages with left and right arrow keys // @include https://www.goodreads.com/giveaway* // @include http://www.goodreads.com/giveaway* // @grant none // @copyright 2014 Soon Van // @author Soon Van - randomecho.com // @license http://opensource.org/licenses/BSD-3-Clause // @version 1.1 // ==/UserScript== function arrowPager(e) { pager_class = detectArrowKeyPressed(e); if (pager_class !== false) { changeToPage(document.getElementsByClassName(pager_class)); } } function changeToPage(pager_node) { if (typeof(pager_node[0]) != 'undefined') { page_url = pager_node[0].getAttribute('href'); // First and last pager links will not have a URL set if (page_url) { document.location = page_url; } } } function detectArrowKeyPressed(e) { if (e.keyCode == 39) { return 'next_page'; } else if (e.keyCode == 37) { return 'previous_page'; } return false; } document.addEventListener('keydown', arrowPager, false);