Loading... 在nodeloc.cc上的帖子使用,让 **chrome浏览器自动向下滑动刷时间** 在Tampermonkey使用的代码,功能是开启后,让chrome浏览器自动向下滑动,模仿人在看帖子 找一个回帖长的页面,如 [2200多个回帖页](https://nodeloc.cc/t/topic/32583) ,Tampermonkey自动刷时间开始,期间可以页面最小化后做其它事。 3、循环自动滚动NodeLOC【2025年7月2日更新,添加控制面板】 ``` // ==UserScript== // @name NodeLOC // @namespace http://tampermonkey.net/ // @version 0.2 // @description 自动向下滚动页面,模拟人在浏览NodeLOC上的帖子,并增加控制面板 // @author You // @match https://nodeloc.cc/* // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @grant GM_registerMenuCommand // ==/UserScript== (function () { 'use strict'; // 配置参数 const config = { scrollInterval: 3000, // 滚动间隔(毫秒) scrollAmount: window.innerHeight * 1.8, // 每次滚动距离(像素) maxScrolls: 100 // 最大滚动次数 }; let scrollCount = 0; let scrollDirection = 1; // 滚动方向:1为向下,-1为向上 let isScrolling = false; // 创建控制UI function createControlUI() { // 创建控制面板元素 const controlPanel = document.createElement('div'); controlPanel.id = 'autoScrollControl'; document.body.appendChild(controlPanel); // 创建UI元素 controlPanel.innerHTML = ` <div class="control-header"> <div class="control-title">自动滚动控制</div> <button class="close-btn" id="closeControl">×</button> </div> <div class="buttons"> <button class="btn btn-start" id="startBtn">开始滚动</button> <button class="btn btn-stop" id="stopBtn">停止滚动</button> </div>`; // 添加样式 GM_addStyle(` #autoScrollControl { position: fixed; bottom: 20px; right: 20px; z-index: 9999; background: rgba(30, 30, 50, 0.9); border-radius: 10px; padding: 15px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); border: 1px solid #444; backdrop-filter: blur(5px); min-width: 250px; color: #fff; font-family: Arial, sans-serif; transition: transform 0.3s ease; } #autoScrollControl:hover { transform: translateY(-5px); } #autoScrollControl .control-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #444; } #autoScrollControl .control-title { font-size: 18px; font-weight: bold; color: #ff8a00; } #autoScrollControl .close-btn { background: none; border: none; color: #aaa; font-size: 20px; cursor: pointer; transition: color 0.3s; } #autoScrollControl .close-btn:hover { color: #fff; } #autoScrollControl .buttons { display: flex; gap: 10px; margin-top: 10px; } #autoScrollControl .btn { flex: 1; padding: 8px 15px; border: none; border-radius: 6px; font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.3s ease; } #autoScrollControl .btn-start { background: linear-gradient(to right, #22c1c3, #1a9c9e); color: white; } #autoScrollControl .btn-stop { background: linear-gradient(to right, #e52e71, #c41c5c); color: white; }`); // 获取UI元素 const startBtn = controlPanel.querySelector('#startBtn'); const stopBtn = controlPanel.querySelector('#stopBtn'); const closeBtn = controlPanel.querySelector('#closeControl'); // 按钮事件 startBtn.addEventListener('click', startAutoScroll); stopBtn.addEventListener('click', stopAutoScroll); // 关闭按钮 closeBtn.addEventListener('click', function () { controlPanel.style.display = 'none'; }); } // 开始滚动 function startAutoScroll() { if (isScrolling) return; isScrolling = true; startBtn.disabled = true; stopBtn.disabled = false; setTimeout(startAutoScrollInternal, config.scrollInterval); } function startAutoScrollInternal() { if (!isScrolling) return; if (scrollCount >= config.maxScrolls) { console.log('已达到最大滚动次数,将在45秒后反向滚动'); setTimeout(() => { scrollCount = 0; // 重置滚动计数器 scrollDirection *= -1; // 切换滚动方向 startAutoScrollInternal(); // 重新开始滚动 }, 45000); // 45秒后重启 return; } window.scrollBy({ top: config.scrollAmount * scrollDirection, left: 0, behavior: 'smooth' }); scrollCount++; console.log(`第${scrollCount}次滚动`); setTimeout(startAutoScrollInternal, config.scrollInterval); } // 停止滚动 function stopAutoScroll() { isScrolling = false; startBtn.disabled = false; stopBtn.disabled = true; } // 初始化 window.addEventListener('load', function () { createControlUI(); }); })(); ``` 2、循环自动滚动NodeLOC【2025年6月9日更新】 ``` // ==UserScript== // @name 循环自动滚动NodeLOC // @namespace http://tampermonkey.net/ // @version 0.1 // @description 自动向下滚动页面,模拟人在浏览NodeLOC上的帖子 // @author You // @match https://nodeloc.cc/* // @grant none // ==/UserScript== (function() { 'use strict'; // 配置参数 const config = { scrollInterval: 5000, // 滚动间隔(毫秒) scrollAmount: window.innerHeight * 0.8, // 每次滚动距离(像素) maxScrolls: 60 // 最大滚动次数,10次约为30个回帖,60次约为180个回帖,找一个180个回帖以上的 }; let scrollCount = 0; let scrollDirection = 1; // 滚动方向:1为向下,-1为向上 // 开始自动滚动 function startAutoScroll() { if (scrollCount >= config.maxScrolls) { console.log('已达到最大滚动次数,将在45秒后反向滚动'); setTimeout(() => { scrollCount = 0; // 重置滚动计数器 scrollDirection *= -1; // 切换滚动方向 startAutoScroll(); // 重新开始滚动 }, 45000); // 45秒后重启 return; } window.scrollBy({ top: config.scrollAmount * scrollDirection, left: 0, behavior: 'smooth' }); scrollCount++; console.log(`第${scrollCount}次滚动`); setTimeout(startAutoScroll, config.scrollInterval); } // 初始化 setTimeout(startAutoScroll, config.scrollInterval); })(); ``` 1、单向自动滚动NodeLOC【2025年6月8日】 ``` // ==UserScript== // @name 自动滚动NodeLOC // @namespace http://tampermonkey.net/ // @version 0.1 // @description 自动向下滚动页面,模拟人在浏览NodeLOC上的帖子 // @author You // @match https://nodeloc.cc/* // @grant none // ==/UserScript== (function() { 'use strict'; // 配置参数 const config = { scrollInterval: 5000, // 滚动间隔(毫秒) scrollAmount: window.innerHeight * 0.8, // 每次滚动距离(像素) maxScrolls: 200 // 最大滚动次数 }; let scrollCount = 0; // 开始自动滚动 function startAutoScroll() { if (scrollCount >= config.maxScrolls) { console.log('已达到最大滚动次数,停止自动滚动'); return; } window.scrollBy({ top: config.scrollAmount, left: 0, behavior: 'smooth' }); scrollCount++; console.log(`第${scrollCount}次滚动`); setTimeout(startAutoScroll, config.scrollInterval); } // 初始化 setTimeout(startAutoScroll, config.scrollInterval); })(); ``` 最后修改:2025 年 07 月 02 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏