From 459e9b54f5f85e71f4244c51ff5dcd9524ba3bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8?= Date: Fri, 14 Feb 2025 22:06:38 +0800 Subject: [PATCH] =?UTF-8?q?perf(XHS-Downloader.js):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=90=8D=E6=9C=AA=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/XHS-Downloader.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/static/XHS-Downloader.js b/static/XHS-Downloader.js index e98f46f..99dad8a 100644 --- a/static/XHS-Downloader.js +++ b/static/XHS-Downloader.js @@ -27,16 +27,12 @@ let config = { disclaimer: GM_getValue("disclaimer", false), packageDownloadFiles: GM_getValue("packageDownloadFiles", true), - autoScrollSwitch: GM_getValue("autoScrollSwitch", false), - // scrollCheckTime: GM_getValue("scrollCheckTime", 2500), + autoScrollSwitch: GM_getValue("autoScrollSwitch", false), // scrollCheckTime: GM_getValue("scrollCheckTime", 2500), maxScrollCount: GM_getValue("maxScrollCount", 10), }; let menu = { - disclaimer: undefined, - packageDownloadFiles: undefined, - autoScrollSwitch: undefined, - // scrollCheckTime: undefined, + disclaimer: undefined, packageDownloadFiles: undefined, autoScrollSwitch: undefined, // scrollCheckTime: undefined, maxScrollCount: undefined, }; @@ -124,7 +120,7 @@ XHS-Downloader 用户脚本 详细说明: }, {title: "单击切换功能状态",}); }; - autoScrollSwitchMenu() + autoScrollSwitchMenu(); // menu.scrollCheckTime = GM_registerMenuCommand("修改滚动检测间隔", function () { // let data; @@ -565,7 +561,7 @@ XHS-Downloader 用户脚本 详细说明: const run = url => { setTimeout(function () { - if (!disclaimer) { + if (!config.disclaimer) { } else if (url === "https://www.xiaohongshu.com/explore" || url.includes("https://www.xiaohongshu.com/explore?")) { updateContainer(buttons.slice(4, 5)); } else if (url.includes("https://www.xiaohongshu.com/explore/")) { @@ -589,7 +585,7 @@ XHS-Downloader 用户脚本 详细说明: // 设置 MutationObserver 来监听 URL 变化 let observer - if (disclaimer) { + if (config.disclaimer) { observer = new MutationObserver(function () { if (currentUrl !== window.location.href) { currentUrl = window.location.href; @@ -660,7 +656,7 @@ XHS-Downloader 用户脚本 详细说明: style.type = 'text/css'; style.appendChild(document.createTextNode(buttonStyle)); - console.info("用户接受 XHS-Downloader 免责声明", disclaimer) + console.info("用户接受 XHS-Downloader 免责声明", config.disclaimer) if (typeof JSZip === 'undefined') { alert("XHS-Downloader 用户脚本依赖库 JSZip 加载失败,作品文件打包下载功能无法使用,请尝试刷新网页或者向作者反馈!");