您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
还原旧版倒序显示文件,自动滚动加载全部文件并回到顶部
当前为
// ==UserScript== // @name 百度网盘 - 自动加载全部文件,倒序显示文件 // @namespace http://tampermonkey.net/ // @version 2.0 // @description 还原旧版倒序显示文件,自动滚动加载全部文件并回到顶部 // @author 一直咸鱼猫 // @match https://pan.baidu.com/s/* // @grant none // @run-at document-start // @license CC-BY-NC // ==/UserScript== (function () { 'use strict'; // 设置为 true 即可开启自动滚动并返回到顶部 const enableAutoScroll = true; // 劫持请求添加倒序参数 const origOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url) { if (typeof url === 'string' && url.includes('/share/list')) { const u = new URL(url, location.origin); u.searchParams.set('num', '100'); u.searchParams.set('desc', '1'); arguments[1] = u.toString(); } return origOpen.apply(this, arguments); }; const origFetch = window.fetch; window.fetch = function (input, init) { let url = input; let isRequest = false; if (input instanceof Request) { url = input.url; isRequest = true; } if (typeof url === 'string' && url.includes('/share/list')) { const u = new URL(url, location.origin); u.searchParams.set('num', '100'); u.searchParams.set('desc', '1'); const newUrl = u.toString(); input = isRequest ? new Request(newUrl, input) : newUrl; } return origFetch.call(this, input, init); }; // 自动滚动加载全部内容 function autoScrollLoad(container) { if (!enableAutoScroll || !container || window.__panScrollRunning__) return; window.__panScrollRunning__ = true; let lastScrollTop = -1; let stableCount = 0; const loop = setInterval(() => { container.scrollTop = container.scrollHeight; if (container.scrollTop === lastScrollTop) { stableCount++; } else { stableCount = 0; lastScrollTop = container.scrollTop; } if (stableCount >= 5) { clearInterval(loop); setTimeout(() => { container.scrollTop = 0; window.__panScrollRunning__ = false; }, 100); } }, 200); } // 每隔一段时间检测 URL 是否变化 function monitorPathChange() { let lastPath = location.pathname + location.search + location.hash; setInterval(() => { const nowPath = location.pathname + location.search + location.hash; if (nowPath !== lastPath) { lastPath = nowPath; waitForContainerAndScroll(); } }, 1000); // 每秒检查一次路径变化 } // 等待容器加载后再执行滚动 function waitForContainerAndScroll() { const timer = setInterval(() => { const container = document.querySelector('.NHcGw'); if (container && container.scrollHeight > 1000) { clearInterval(timer); setTimeout(() => autoScrollLoad(container), 500); } }, 500); } // 页面加载完成后启动监听 window.addEventListener('load', () => { waitForContainerAndScroll(); monitorPathChange(); }); })();