您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
水木社区自动翻页,方向左键上一页,方向右键上一页
// ==UserScript== // @name 水木社区 - 自动翻页 // @version 1.0 // @author Siukei // @description 水木社区自动翻页,方向左键上一页,方向右键上一页 // @match *://*.newsmth.net/* // @icon https://static.mysmth.net/nForum/favicon.ico // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_openInTab // @grant GM_getValue // @grant GM_setValue // @grant GM_notification // @license GPL-3.0 License // @run-at document-end // @namespace https://www.newsmth.net // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js // ==/UserScript== (function () { document.addEventListener('keydown', function (event) { if (event.key === 'ArrowRight') { // ArrowRight 表示键盘右箭头键的键码 nextPage(true); } if (event.key === 'ArrowLeft') { // ArrowLeft 表示键盘右箭头键的键码 nextPage(false); } }); window.onscroll = function () { if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) { // nextPage(true); } }; function nextPage(isNext) { var selector = isNext ? 'last-child' : 'first-child' var a = document.querySelector(`ul.pagination > li > ol.page-main > li:${selector} > a`); if (a) { a.click(); // 触发点击事件 } } })();