您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically scrolls and clicks "Load more" on Wattpad search results until there is nothing left to load.
// ==UserScript== // @name Wattpad Auto Scroll + Load More // @namespace https://khaid-anthony.local/userscripts // @version 1.0.0 // @description Automatically scrolls and clicks "Load more" on Wattpad search results until there is nothing left to load. // @license MIT // @match https://www.wattpad.com/search* // @run-at document-idle // @grant none // ==/UserScript== (function () { 'use strict'; // Find any "Load more" style button (by text or aria-label) function findLoadMore() { const buttons = document.querySelectorAll('button, [role="button"]'); for (const b of buttons) { const text = (b.textContent || '').trim(); const aria = (b.getAttribute('aria-label') || '').trim(); if (/load/i.test(text) || /load/i.test(aria)) return b; } return null; } let lastHeight = 0; let stagnant = 0; const MAX_STAGNANT_TICKS = 6; // stop after 6 cycles with no growth const INTERVAL_MS = 1200; const timer = setInterval(() => { // 1) Scroll to bottom to trigger lazy loading window.scrollTo(0, document.body.scrollHeight); // 2) Click "Load more" if present const btn = findLoadMore(); if (btn) btn.click(); // 3) Stop when page height stops increasing for several cycles AND no button is found const h = document.body.scrollHeight; if (h <= lastHeight && !btn) { stagnant++; if (stagnant >= MAX_STAGNANT_TICKS) { clearInterval(timer); } } else { stagnant = 0; lastHeight = h; } }, INTERVAL_MS); })();