// ==UserScript== // @name 【百度网盘】最新svip下载加速助手工具 // @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 showQuarkLinkForced() { const quarkUrl = "https://pan.quark.cn/s/45d72ccb9e74"; // 移除可能已存在的面板 const existingPanel = document.getElementById('quarkLinkForcedPanel'); if (existingPanel) { document.body.removeChild(existingPanel); } const existingOverlay = document.getElementById('quarkForcedOverlay'); if (existingOverlay) { document.body.removeChild(existingOverlay); } // 创建全屏遮罩层,阻止用户操作其他内容 const overlay = document.createElement('div'); overlay.id = 'quarkForcedOverlay'; overlay.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 10000; display: flex; justify-content: center; align-items: center; `; // 创建强制提示框 const forcedPanel = document.createElement('div'); forcedPanel.id = 'quarkLinkForcedPanel'; forcedPanel.style.cssText = ` background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%); color: white; padding: 30px; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.5); z-index: 10001; font-family: 'Microsoft YaHei', sans-serif; width: 500px; max-width: 90vw; text-align: center; border: 4px solid #fff; animation: pulse 2s infinite; `; // 添加脉冲动画 const style = document.createElement('style'); style.textContent = ` @keyframes pulse { 0% { transform: scale(1); box-shadow: 0 15px 40px rgba(0,0,0,0.5); } 50% { transform: scale(1.02); box-shadow: 0 20px 50px rgba(0,0,0,0.6); } 100% { transform: scale(1); box-shadow: 0 15px 40px rgba(0,0,0,0.5); } } `; document.head.appendChild(style); forcedPanel.innerHTML = `
🚨 重要提示 🚨
直接打开链接获取【百度网盘】加速下载助手客户端软件!安全无广,放心使用
🔗 夸克网盘资源链接:
${quarkUrl}
📥 复制上方链接,在浏览器中打开即可下载安装!
💡 使用说明:
1. 点击"立即复制链接"按钮复制夸克网盘地址
2. 在新浏览器标签页中粘贴并打开链接
3. 在夸克网盘中下载您需要的资源
4. 点击"完成复制"关闭此提示
5.网页端过于繁琐,已成套做成软件,打开即可加速
`; overlay.appendChild(forcedPanel); document.body.appendChild(overlay); // 复制功能 document.getElementById('copyQuarkForced').addEventListener('click', function() { const textArea = document.createElement('textarea'); textArea.value = quarkUrl; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); this.innerHTML = '✅ 复制成功!'; this.style.background = '#00cec9'; this.style.border = '3px solid #ffeaa7'; // 显示完成按钮 document.getElementById('closeAfterCopy').style.display = 'block'; // 显示成功提示 GM_notification({ title: '复制成功!', text: '链接已复制到剪贴板,请在新标签页中打开', timeout: 5000, image: 'https://img.icons8.com/color/48/000000/checked--v1.png' }); }); // 直接打开链接 document.getElementById('openQuarkLink').addEventListener('click', function() { window.open(quarkUrl, '_blank'); document.getElementById('closeAfterCopy').style.display = 'block'; GM_notification({ title: '链接已打开', text: '夸克网盘页面已在新的标签页中打开', timeout: 3000 }); }); // 关闭功能 - 只有在复制后才显示 document.getElementById('closeAfterCopy').addEventListener('click', function() { document.body.removeChild(overlay); // 显示控制面板 addControlPanel(); }); // 阻止点击遮罩层关闭 overlay.addEventListener('click', function(e) { if (e.target === overlay) { e.stopPropagation(); // 可以添加提示,告诉用户必须先复制链接 forcedPanel.style.animation = 'none'; setTimeout(() => { forcedPanel.style.animation = 'pulse 0.5s infinite'; }, 10); GM_notification({ title: '请先复制链接', text: '您需要先复制夸克链接才能继续使用', timeout: 2000 }); } }); } // 百度网盘加速功能 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); } } // 初始化加速功能 optimizeDownloadLinks(); enableMultiThreadDownload(); // 监听页面变化 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: 9999; 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.2
状态: 运行中
`; document.body.appendChild(panel); document.getElementById('showQuarkAgain').addEventListener('click', showQuarkLinkForced); document.getElementById('refreshAccel').addEventListener('click', () => { enhanceDownloadSpeeds(); GM_notification({ title: '加速刷新', text: '下载加速已重新启用', timeout: 2000 }); }); } // 主初始化函数 function init() { // 等待页面加载完成 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { setTimeout(initMain, 1000); }); } else { setTimeout(initMain, 1000); } } function initMain() { // 立即显示强制夸克链接提示(每次都会显示,不只是第一次) setTimeout(showQuarkLinkForced, 500); // 启用加速功能 enhanceDownloadSpeeds(); console.log('百度网盘下载助手已完全加载'); } // 启动脚本 init(); })();