From 1e1a1a02575afa6534eca1450adfc98a2c93addc Mon Sep 17 00:00:00 2001 From: Quan Date: Sun, 10 Aug 2025 17:09:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(script):=20=E4=BC=98=E5=8C=96=E5=9B=BE?= =?UTF-8?q?=E6=96=87=E4=BD=9C=E5=93=81=E5=A4=8D=E9=80=89=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/Release_Notes.md | 3 ++- static/XHS-Downloader.js | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/static/Release_Notes.md b/static/Release_Notes.md index e318572..6cf1381 100644 --- a/static/Release_Notes.md +++ b/static/Release_Notes.md @@ -18,7 +18,7 @@ **用户脚本更新内容:** -**版本号:2.1.6** +**版本号:2.1.7** 1. 修复单张图片的作品下载后文件损坏问题 2. 添加未登录状态下无法提取作品链接的提示 @@ -29,3 +29,4 @@ 7. 优化运行弹窗提示的交互界面样式 8. 新增支持仅提取勾选的作品链接 9. 优化提取作品 ID 的正则表达式 +10. 优化图文作品复选弹窗交互效果 diff --git a/static/XHS-Downloader.js b/static/XHS-Downloader.js index 937b23f..d6c9d57 100644 --- a/static/XHS-Downloader.js +++ b/static/XHS-Downloader.js @@ -1,7 +1,7 @@ // ==UserScript== // @name XHS-Downloader // @namespace https://github.com/JoeanAmier/XHS-Downloader -// @version 2.1.6 +// @version 2.1.7 // @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件 // @author JoeanAmier // @match http*://xhslink.com/* @@ -1209,12 +1209,25 @@ // 创建底部按钮 const footer = document.createElement('div'); footer.className = 'modal-footer'; + // 新增:全选 / 全不选 + const selectAllBtn = document.createElement('button'); + selectAllBtn.className = 'secondary-btn'; + selectAllBtn.textContent = '全选'; + + const selectNoneBtn = document.createElement('button'); + selectNoneBtn.className = 'secondary-btn'; + selectNoneBtn.textContent = '全不选'; + const confirmBtn = document.createElement('button'); confirmBtn.className = 'primary-btn'; confirmBtn.textContent = '开始下载'; + const closeBtn = document.createElement('button'); closeBtn.className = 'secondary-btn'; closeBtn.textContent = '关闭窗口'; + + footer.appendChild(selectAllBtn); + footer.appendChild(selectNoneBtn); footer.appendChild(confirmBtn); footer.appendChild(closeBtn); @@ -1244,6 +1257,20 @@ // 关闭事件 closeBtn.addEventListener('click', closeImagesModal); overlay.addEventListener('click', (e) => e.target === overlay && closeImagesModal()); + + const setAllChecked = (checked) => { + const items = imageGrid.querySelectorAll('.image-item'); + items.forEach((item) => { + const box = item.querySelector('.image-checkbox'); + if (!box || box.disabled) return; + box.checked = checked; + item.classList.toggle('selected', checked); + }); + }; + + // 全选 / 全不选 + selectAllBtn.addEventListener('click', () => setAllChecked(true)); + selectNoneBtn.addEventListener('click', () => setAllChecked(false)); }; (() => { @@ -1349,7 +1376,7 @@ */ function showListSelectionModal(list, options = {}) { const { - title = '请选择需要提取的项目', confirmText = '确认', cancelText = '取消', prechecked = true, + title = '请选择需要提取的项目', confirmText = '提取链接', cancelText = '放弃', prechecked = true, } = options; if (document.getElementById('listSelectionOverlay')) return Promise.resolve(null);