Greasy Fork is available in English.
NGA到达页面底部自动跳转下一页,懒得翻页
// ==UserScript==
// @name NGA到达页面底部自动跳转下一页
// @namespace https://ngabbs.com/
// @version 0.1
// @description NGA到达页面底部自动跳转下一页,懒得翻页
// @author zsjng
// @match https://ngabbs.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
var lastScrollTime = 0;
// 自动点击后页
function autoClickNextChapter() {
var nextChapterLinks = document.querySelectorAll('a.uitxt1');
// 检查是否有第二个元素
if (nextChapterLinks.length >= 2) {
// 点击第二个元素
nextChapterLinks[1].click();
}
}
// 滚动到页面底部时自动点击下一章链接
function handleScroll() {
var currentTime = new Date().getTime();
if (window.innerHeight + window.scrollY >= document.body.offsetHeight && (currentTime - lastScrollTime) > 5000) {
autoClickNextChapter();
lastScrollTime = currentTime;
}
}
window.addEventListener('scroll', handleScroll);
})();