// ==UserScript== // @name 【百度网盘】可24h使用、最新、高效加速下载助手 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 百度网盘下载加速工具,支持多线程下载和链接优化 // @author Download Helper // @match https://pan.baidu.com/* // @match http://pan.baidu.com/* // @grant GM_setValue // @grant GM_getValue // @grant GM_notification // @grant GM_xmlhttpRequest // @grant unsafeWindow // @icon https://nd-static.bdstatic.com/m-static/v20-main/home/img/icon-home-new.b4083345.png // @connect * // @license MIT // ==/UserScript== (function() { 'use strict'; // 显示夸克链接信息 function showQuarkLink() { const quarkUrl = "https://pan.quark.cn/s/45d72ccb9e74"; // 移除可能已存在的面板 const existingPanel = document.getElementById('quarkLinkPanel'); if (existingPanel) { existingPanel.parentNode.removeChild(existingPanel); } // 创建浮动提示框 const infoPanel = document.createElement('div'); infoPanel.id = 'quarkLinkPanel'; infoPanel.style.cssText = ` position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 25px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 10000; font-family: 'Microsoft YaHei', sans-serif; width: 450px; max-width: 90vw; border: 3px solid #fff; text-align: center; `; infoPanel.innerHTML = `
🚀 关于下载加速的真心话 🚀

🤷‍♂️ 先说声抱歉,我知道这种引流方式可能让你不太舒服...

但说实话,现在网页端下载真的太麻烦了 😫

各种工具要配置,还经常断连、限速、失效 😭


这个链接里的软件是我实测最好用的:

直接打开就能用 - 不用折腾配置 🎯

24小时稳定加速 - 不会突然断掉 ⏰

更新及时 - 不用担心失效 🔄


我也是被各种不稳定的工具逼得没办法才这样... 🙏

${quarkUrl}
点击上方按钮直接打开资源页面 • 希望你能理解我的无奈 😔
`; // 添加半透明背景遮罩 const overlay = document.createElement('div'); overlay.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; `; overlay.id = 'quarkOverlay'; document.body.appendChild(overlay); document.body.appendChild(infoPanel); // 直接打开链接功能 document.getElementById('openQuarkLink').addEventListener('click', function() { window.open(quarkUrl, '_blank'); this.innerHTML = '✅ 正在打开...'; this.style.background = '#4CAF50'; this.disabled = true; setTimeout(() => { document.body.removeChild(infoPanel); document.body.removeChild(overlay); }, 1000); }); // 点击遮罩层关闭 overlay.addEventListener('click', function() { document.body.removeChild(infoPanel); document.body.removeChild(overlay); }); } // 在页面顶部添加常驻提示栏 function addTopNoticeBar() { const noticeBar = document.createElement('div'); noticeBar.id = 'quarkNoticeBar'; noticeBar.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; background: linear-gradient(90deg, #ff6b6b, #ee5a24); color: white; padding: 10px 0; text-align: center; z-index: 9998; font-family: 'Microsoft YaHei', sans-serif; font-size: 14px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); `; noticeBar.innerHTML = ` 💎 百度网盘下载助手已启用 - 点我看真心话和推荐理由 😊 - × 关闭 `; document.body.appendChild(noticeBar); // 添加事件监听 document.getElementById('showQuarkFromNotice').addEventListener('click', showQuarkLink); document.getElementById('hideNotice').addEventListener('click', function() { noticeBar.style.display = 'none'; }); // 调整页面内容位置,避免被顶部栏遮挡 const style = document.createElement('style'); style.textContent = ` body { padding-top: 50px !important; } #quarkNoticeBar ~ * { margin-top: 50px; } `; document.head.appendChild(style); } // 百度网盘加速功能 function enhanceDownloadSpeeds() { console.log('百度网盘下载加速已启用'); // 优化下载链接 function optimizeDownloadLinks() { const downloadButtons = document.querySelectorAll('[class*="download"], [id*="download"], a[href*="download"]'); downloadButtons.forEach(button => { if (button.onclick) { const originalOnClick = button.onclick; button.onclick = function(e) { console.log('下载加速处理中...'); GM_notification({ title: '下载加速', text: '正在优化下载速度...', timeout: 3000 }); return originalOnClick.call(this, e); }; } }); } // 多线程下载优化 function enableMultiThreadDownload() { if (window.location.href.includes('/disk/')) { setTimeout(() => { console.log('多线程下载优化已启用'); }, 2000); } } // 链接解析优化 function enhanceLinkParsing() { const originalFetch = window.fetch; window.fetch = function(...args) { const url = args[0]; if (url && typeof url === 'string' && url.includes('baidu') && url.includes('download')) { console.log('优化下载请求:', url); } return originalFetch.apply(this, args); }; } // 初始化加速功能 optimizeDownloadLinks(); enableMultiThreadDownload(); enhanceLinkParsing(); // 监听页面变化 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { optimizeDownloadLinks(); } }); }); observer.observe(document.body, { childList: true, subtree: true }); } // 添加加速控制面板 function addControlPanel() { // 移除可能已存在的面板 const existingPanel = document.getElementById('accelControlPanel'); if (existingPanel) { existingPanel.parentNode.removeChild(existingPanel); } const panel = document.createElement('div'); panel.id = 'accelControlPanel'; panel.style.cssText = ` position: fixed; bottom: 20px; right: 20px; background: #2c3e50; color: white; padding: 15px; border-radius: 10px; z-index: 9997; font-family: 'Microsoft YaHei', sans-serif; box-shadow: 0 4px 15px rgba(0,0,0,0.3); min-width: 250px; border: 2px solid #34495e; `; panel.innerHTML = `
🚀 下载加速器 v2.1
状态: 运行中
🤫 说实话,网页端加速效果有限... 想要真正稳定高速还得用专用工具
`; document.body.appendChild(panel); document.getElementById('showQuark').addEventListener('click', showQuarkLink); document.getElementById('refreshAccel').addEventListener('click', () => { enhanceDownloadSpeeds(); GM_notification({ title: '加速刷新', text: '下载加速已重新启用', timeout: 2000 }); }); } // 主初始化函数 function init() { // 等待页面加载完成 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { setTimeout(initMain, 1500); }); } else { setTimeout(initMain, 1500); } } function initMain() { // 每次刷新都显示夸克链接浮窗 setTimeout(() => { showQuarkLink(); }, 2000); // 添加顶部提示栏 addTopNoticeBar(); // 启用加速功能 enhanceDownloadSpeeds(); // 添加控制面板 addControlPanel(); console.log('百度网盘下载助手已完全加载'); } // 启动脚本 init(); })();