您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add CTRL+ArrowLeft and CTRL+ArrowRight for generic next/previous page. It will click the last found link/button whose text starts/ends with e.g. "Next", "Prev", "Back", or "Previous".
当前为
// ==UserScript== // @name Add Keyboard Shortcut for Generic Next/Previous Page // @namespace AddKeyboardShortcutForGenericNextPreviousPage // @version 1.0.19 // @license GNU AGPLv3 // @author jcunews // @description Add CTRL+ArrowLeft and CTRL+ArrowRight for generic next/previous page. It will click the last found link/button whose text starts/ends with e.g. "Next", "Prev", "Back", or "Previous". // @website https://gf.qytechs.cn/en/users/85671-jcunews // @include *://*/* // @include *:* // @grant none // ==/UserScript== /* The link/button text more specifically, are those which starts with (non case sesitive) "Next", "Prev", "Previous"; or ends with "Prev", "Back", "Previous", "Next". e.g. "Next", "> Next", "Next Page", "Prev", "< Prev", "< Previous", etc. but not "< Prev Page" because the word "prev" or "previous" is not at the start/end of text. The ID and class names are also checked. This script doesn't take into account of links whose contents is an image rather than text, or whose text is a CSS text contents. If next/previous navigation link is specified in the HTML metadata, it will be used as a priority. */ (function(rxPrev, rxNext, ts) { rxPrevious = /\u00ab|(\b|_)(?:back|prev(ious)?)(\b|_)/i; rxNext = /\u00bb|(\b|_)next(\b|_)/i; rxCarousel = /carousel/i; addEventListener("keydown", function(ev, e, a) { function clickLink(rx, e, i, l, r, rx2) { rx2 = new RegExp("[a-z].*?(" + rx.source + ")", "i"); e = document.querySelectorAll('a,button,input[type="button"],input[type="submit"]'); for (i = e.length - 1; i >= 0; i--) { if ( ( ((e[i].tagName === "A") && rx.test(e[i].rel) && !rx2.test(e[i].rel)) || ((e[i].tagName === "A") && Array.from(e[i].classList).some(cl => rx.test(cl) && !rx2.test(cl))) || ((e[i].tagName === "INPUT") && rx.test(e[i].value) && !rx2.test(e[i].value)) || (rx.test(e[i].textContent) && !rx2.test(e[i].textContent)) || (e[i].id && rx.test(e[i].id)) || Array.from(e[i].classList).some(s => rx.test(s)) ) && (!rxCarousel.test(e[i].className)) ) { ev.stopImmediatePropagation(); ev.stopPropagation(); ev.preventDefault(); e[i].click(); return true } } return false } if (ev.ctrlKey && !ev.altKey && !ev.shiftKey) { a = document.activeElement; while (a && a.shadowRoot?.activeElement) a = a.shadowRoot.activeElement; if (a && ((/^(INPUT|TEXTAREA)$/).test(a.tagName) || a.isContentEditable)) return; switch (ev.key) { case "ArrowLeft": //previous if (e = document.querySelector('link[rel="prev"][href]')) { ev.stopImmediatePropagation(); ev.stopPropagation(); ev.preventDefault(); location.href = e.href; return } if (clickLink(rxPrevious)) return; break; case "ArrowRight": //next if (e = document.querySelector('link[rel="next"][href]')) { ev.stopImmediatePropagation(); ev.stopPropagation(); ev.preventDefault(); location.href = e.href; return } if (clickLink(rxNext)) return; break } } }, true) })()
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址