您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
巴哈小屋文章翻頁左右方向快捷鍵。
// ==UserScript== // @name 巴哈姆特 - 巴哈小屋文章翻頁快捷鍵 // @namespace http://tampermonkey.net/ // @version 2025-08-18 // @description 巴哈小屋文章翻頁左右方向快捷鍵。 // @author You // @match *://*/* // @match https://home.gamer.com.tw/artwork.php?sn=* // @grant none // @license MIT // ==/UserScript== (function() { document.addEventListener('keydown', function (e) { if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return; const linkTexts = { ArrowLeft: ['上一篇', '上一頁','上一页','上一章','前一篇', '前一頁','前一页','前一章', '←', '‹', '«', 'Previous', 'Prev', 'Zurück', 'Précédent', 'Anterior', 'Indietro'], ArrowRight: ['下一篇','下一頁','下一页','下一章','後一篇', '後一頁','後一页','下一章', '→', '›', '»', 'Next', 'Weiter', 'Suivant', 'Siguiente', 'Avanti'] }; const targetTextList = linkTexts[e.key]; const links = Array.from(document.querySelectorAll('a')); const getLinkText = link => { const text = link.textContent || ''; const aria = link.getAttribute('aria-label') || ''; const title = link.getAttribute('title') || ''; return (text + ' ' + aria + ' ' + title).toLowerCase(); }; const target = links.find(link => { const text = getLinkText(link).trim(); return targetTextList.some(keyword => text.includes(keyword.toLowerCase())); }); if (target) { target.click(); } else { console.log(`找不到符合「${e.key === 'ArrowLeft' ? '上一頁' : '下一頁'}」的連結`); } }); })();