// ==UserScript== // @name NexusMods 自动下载增强版 // @namespace https://github.com/Jeffrey131313/nexus-auto-download/ // @version 0.3 // @description 如果Mod只有一个文件, 它会自动帮你点缓慢下, 如果Mod有多个文件, 你选好要下载的文件后, 它会自动帮你点缓慢下载 // @author Jeffrey131313 // @match https://www.nexusmods.com/*/mods/*?tab=files* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; const checkInterval = setInterval(mainLogic, 500); setTimeout(() => clearInterval(checkInterval), 20000); function mainLogic() { const urlParams = new URLSearchParams(location.search); const isFilePage = urlParams.has('file_id'); if (isFilePage) { const slowBtn = document.getElementById('slowDownloadButton'); if (slowBtn) { console.log('检测到慢速下载按钮'); slowBtn.click(); clearInterval(checkInterval); verifyDownloadSuccess(); } } else { const fileAlert = document.querySelector('a.selected span.alert'); if (fileAlert?.textContent?.trim() === '1') { console.log('检测到只有一个文件'); const manualBtn = document.querySelector( 'a[data-tracking*="Manual Download"]' ); if (manualBtn) { console.log('点击手动下载按钮'); manualBtn.click(); clearInterval(checkInterval); } } } } function verifyDownloadSuccess() { setTimeout(() => { if (document.getElementById('fastDownloadButton')) { console.log('下载按钮仍然存在'); } }, 2000); } })();