mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 06:57:16 +08:00
feat(script): 优化图文作品复选弹窗交互效果
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
**用户脚本更新内容:**
|
**用户脚本更新内容:**
|
||||||
|
|
||||||
**版本号:2.1.6**
|
**版本号:2.1.7**
|
||||||
|
|
||||||
1. 修复单张图片的作品下载后文件损坏问题
|
1. 修复单张图片的作品下载后文件损坏问题
|
||||||
2. 添加未登录状态下无法提取作品链接的提示
|
2. 添加未登录状态下无法提取作品链接的提示
|
||||||
@@ -29,3 +29,4 @@
|
|||||||
7. 优化运行弹窗提示的交互界面样式
|
7. 优化运行弹窗提示的交互界面样式
|
||||||
8. 新增支持仅提取勾选的作品链接
|
8. 新增支持仅提取勾选的作品链接
|
||||||
9. 优化提取作品 ID 的正则表达式
|
9. 优化提取作品 ID 的正则表达式
|
||||||
|
10. 优化图文作品复选弹窗交互效果
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name XHS-Downloader
|
// @name XHS-Downloader
|
||||||
// @namespace https://github.com/JoeanAmier/XHS-Downloader
|
// @namespace https://github.com/JoeanAmier/XHS-Downloader
|
||||||
// @version 2.1.6
|
// @version 2.1.7
|
||||||
// @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件
|
// @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件
|
||||||
// @author JoeanAmier
|
// @author JoeanAmier
|
||||||
// @match http*://xhslink.com/*
|
// @match http*://xhslink.com/*
|
||||||
@@ -1209,12 +1209,25 @@
|
|||||||
// 创建底部按钮
|
// 创建底部按钮
|
||||||
const footer = document.createElement('div');
|
const footer = document.createElement('div');
|
||||||
footer.className = 'modal-footer';
|
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');
|
const confirmBtn = document.createElement('button');
|
||||||
confirmBtn.className = 'primary-btn';
|
confirmBtn.className = 'primary-btn';
|
||||||
confirmBtn.textContent = '开始下载';
|
confirmBtn.textContent = '开始下载';
|
||||||
|
|
||||||
const closeBtn = document.createElement('button');
|
const closeBtn = document.createElement('button');
|
||||||
closeBtn.className = 'secondary-btn';
|
closeBtn.className = 'secondary-btn';
|
||||||
closeBtn.textContent = '关闭窗口';
|
closeBtn.textContent = '关闭窗口';
|
||||||
|
|
||||||
|
footer.appendChild(selectAllBtn);
|
||||||
|
footer.appendChild(selectNoneBtn);
|
||||||
footer.appendChild(confirmBtn);
|
footer.appendChild(confirmBtn);
|
||||||
footer.appendChild(closeBtn);
|
footer.appendChild(closeBtn);
|
||||||
|
|
||||||
@@ -1244,6 +1257,20 @@
|
|||||||
// 关闭事件
|
// 关闭事件
|
||||||
closeBtn.addEventListener('click', closeImagesModal);
|
closeBtn.addEventListener('click', closeImagesModal);
|
||||||
overlay.addEventListener('click', (e) => e.target === overlay && 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 = {}) {
|
function showListSelectionModal(list, options = {}) {
|
||||||
const {
|
const {
|
||||||
title = '请选择需要提取的项目', confirmText = '确认', cancelText = '取消', prechecked = true,
|
title = '请选择需要提取的项目', confirmText = '提取链接', cancelText = '放弃', prechecked = true,
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
if (document.getElementById('listSelectionOverlay')) return Promise.resolve(null);
|
if (document.getElementById('listSelectionOverlay')) return Promise.resolve(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user