巴哈姆特 - 巴哈小屋文章翻頁快捷鍵

巴哈小屋文章翻頁左右方向快捷鍵。

当前为 2025-08-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         巴哈姆特 - 巴哈小屋文章翻頁快捷鍵
// @namespace    http://tampermonkey.net/
// @version      2025-08-17
// @description  巴哈小屋文章翻頁左右方向快捷鍵。
// @author       You
// @match        https://home.gamer.com.tw/artwork.php?sn=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gamer.com.tw
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    document.addEventListener('keydown', function (event) {
        const prevBtn = document.querySelector('.ct-btn-box a.ct-btn.normal:not(.no-link):nth-of-type(1)');
        const nextBtn = document.querySelector('.ct-btn-box a.ct-btn.normal:not(.no-link):nth-of-type(2)');

        if (event.key === 'ArrowLeft') {
            if (prevBtn && prevBtn.href && prevBtn.href !== 'javascript:;') {
                window.location.href = prevBtn.href;
            } else {
                alert('已經是第一篇了');
            }
        } else if (event.key === 'ArrowRight') {
            if (nextBtn && nextBtn.href && nextBtn.href !== 'javascript:;') {
                window.location.href = nextBtn.href;
            } else {
                alert('已經是最後一篇了');
            }
        }
    });
})();

QingJ © 2025

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