左右鍵翻頁 Navigate with Arrow Keys

Use ArrowLeft and ArrowRight keys to navigate using page buttons

目前为 2024-09-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         左右鍵翻頁 Navigate with Arrow Keys
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Use ArrowLeft and ArrowRight keys to navigate using page buttons
// @author       Your Name
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('keydown', function(event) {
        if (event.key === 'ArrowLeft') {
            // 找到並點擊包含 "上一章"、"上一頁" 或 "上一页" 文本的按鈕
            var prevButton = Array.from(document.querySelectorAll('a')).find(btn =>
                btn.textContent.includes('上一章') ||
                btn.textContent.includes('上一頁') ||
                btn.textContent.includes('上一页')
            );
            if (prevButton) {
                prevButton.click();
            }
        } else if (event.key === 'ArrowRight') {
            // 找到並點擊包含 "下一章"、"下一頁" 或 "下一页" 文本的按鈕
            var nextButton = Array.from(document.querySelectorAll('a')).find(btn =>
                btn.textContent.includes('下一章') ||
                btn.textContent.includes('下一頁') ||
                btn.textContent.includes('下一页')
            );
            if (nextButton) {
                nextButton.click();
            }
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址