// ==UserScript== // @name 图片下载助手 // @namespace http://tampermonkey.net/ // @version alpha 1.0 // @description 支持图片预览和多图批量下载,置顶批量下载按钮 // @author Songlll // @match https://www.zqy.com/resource/* // @grant GM_download // @grant GM_xmlhttpRequest // @license MIT // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/540467/%E5%9B%BE%E7%89%87%E4%B8%8B%E8%BD%BD%E5%8A%A9%E6%89%8B.user.js // @updateURL https://update.greasyfork.icu/scripts/540467/%E5%9B%BE%E7%89%87%E4%B8%8B%E8%BD%BD%E5%8A%A9%E6%89%8B.meta.js // ==/UserScript== (function() { 'use strict'; // 免责声明内容 const DISCLAIMER = ` 免责声明:
本脚本仅用于个人学习研究,请尊重网站版权。下载内容仅限个人使用,禁止传播或用于商业用途。
使用本脚本产生的任何法律责任由用户自行承担。请支持正版资源,尊重创作者劳动成果。
`; // 添加样式 const style = document.createElement('style'); style.innerHTML = ` /* 整体布局 */ .dh-container { position: fixed; bottom: 20px; right: 100px; z-index: 10000; display: flex; flex-direction: column; align-items: flex-end; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } /* 浮动按钮 */ .dh-toggle { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; border: none; } .dh-toggle:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 8px 25px rgba(74, 108, 247, 0.6); } /* 控制面板 */ .dh-panel { width: 360px; background: white; border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); overflow: hidden; margin-bottom: 15px; display: none; max-height: 80vh; } .dh-panel.active { display: block; } /* 面板头部 */ .dh-header { background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; } .dh-title { font-size: 18px; font-weight: 600; } .dh-close { background: rgba(255, 255, 255, 0.2); border: none; width: 32px; height: 32px; border-radius: 50%; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; font-size: 18px; } .dh-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); } /* 面板内容 */ .dh-content { padding: 20px; max-height: calc(80vh - 150px); overflow-y: auto; } /* 免责声明 */ .dh-disclaimer { background: #fff8e1; border-left: 4px solid #ffc107; padding: 12px 15px; margin-bottom: 20px; border-radius: 4px; font-size: 13px; line-height: 1.5; } /* 统计信息 */ .dh-stats { display: flex; justify-content: space-between; margin-bottom: 15px; background: #f8fafc; padding: 15px; border-radius: 12px; } .dh-stat-item { text-align: center; } .dh-stat-value { font-size: 24px; font-weight: 700; color: #4a6cf7; line-height: 1; } .dh-stat-label { color: #64748b; font-size: 14px; } /* 操作按钮 */ .dh-action-buttons { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; } .dh-action-btn { padding: 14px; border-radius: 12px; border: none; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.2s ease; font-size: 16px; } .dh-download-all { background: linear-gradient(to right, #00c9a7, #00b09b); color: white; position: sticky; top: 60px; z-index: 5; } .dh-download-all:hover { transform: translateY(-3px); box-shadow: 0 6px 15px rgba(0, 201, 167, 0.4); } /* 单张图片下载按钮 */ .dh-single-download { background: #4A90E2; color: white; padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; margin-left: 10px; transition: all 0.2s; } .dh-single-download:hover { background: #3a7bc8; } /* 进度条 */ .dh-progress-container { background: #f1f5f9; border-radius: 12px; overflow: hidden; margin-bottom: 15px; } .dh-progress-header { display: flex; justify-content: space-between; padding: 10px 15px; font-size: 14px; color: #64748b; } .dh-progress-bar { height: 8px; background: #e2e8f0; position: relative; } .dh-progress-fill { height: 100%; background: linear-gradient(to right, #ff9a9e, #fad0c4); width: 0%; transition: width 0.5s ease; border-radius: 0 4px 4px 0; } /* 当前文件信息 */ .dh-current-file { padding: 15px; background: #f8fafc; border-radius: 12px; font-size: 14px; margin-top: 15px; display: none; } .dh-current-file.active { display: block; } .dh-filename { font-weight: 600; color: #4a6cf7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; } /* 状态文本 */ .dh-status { font-size: 14px; color: #4a5568; text-align: center; margin: 10px 0; font-weight: 500; } /* 图片预览区域 */ .dh-preview-container { margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px; } .dh-preview-title { font-weight: 600; margin-bottom: 10px; color: #4a5568; display: flex; align-items: center; justify-content: space-between; } .dh-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .dh-preview-item { border-radius: 8px; overflow: hidden; cursor: pointer; position: relative; aspect-ratio: 4/3; background: #f5f7fa; border: 1px solid #e2e8f0; transition: all 0.2s ease; } .dh-preview-item:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); border-color: #4a6cf7; } .dh-preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; } .dh-preview-number { position: absolute; top: 5px; right: 5px; background: rgba(0, 0, 0, 0.6); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; } /* 预览弹窗 */ .dh-preview-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 20000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; } .dh-preview-modal.active { opacity: 1; pointer-events: all; } .dh-preview-content { position: relative; max-width: 90%; max-height: 90%; text-align: center; } .dh-preview-content img { max-width: 100%; max-height: 80vh; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); } .dh-preview-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; background: rgba(255, 255, 255, 0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; cursor: pointer; transition: all 0.3s ease; } .dh-preview-nav:hover { background: rgba(255, 255, 255, 0.3); } .dh-preview-prev { left: 20px; } .dh-preview-next { right: 20px; } .dh-preview-close { position: absolute; top: 20px; right: 20px; background: rgba(255, 255, 255, 0.2); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; cursor: pointer; transition: all 0.3s ease; } .dh-preview-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); } .dh-preview-info { color: white; margin-top: 15px; font-size: 16px; } /* VIP提示 */ .vip-protection-notice { position: fixed; top: 10px; right: 10px; background-color: #4CAF50; color: white; padding: 8px 15px; border-radius: 4px; z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.2); animation: fadeInOut 5s forwards; } @keyframes fadeInOut { 0% { opacity: 0; transform: translateY(-20px); } 10% { opacity: 1; transform: translateY(0); } 90% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } } /* 网站原有样式覆盖 */ .cont_one { position: relative; margin-bottom: 25px; padding: 15px; background: white; border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.08); transition: transform 0.3s ease; } .cont_one:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); } .cont_one p { display: flex; align-items: center; margin-top: 10px; } .cont_one em { font-weight: bold; color: #6a11cb; } `; document.head.appendChild(style); // 创建浮动控制面板容器 const container = document.createElement('div'); container.className = 'dh-container'; document.body.appendChild(container); // 创建浮动按钮 const toggleBtn = document.createElement('button'); toggleBtn.className = 'dh-toggle'; toggleBtn.innerHTML = '⇩'; container.appendChild(toggleBtn); // 创建控制面板 const panel = document.createElement('div'); panel.className = 'dh-panel'; container.appendChild(panel); // 面板头部 const header = document.createElement('div'); header.className = 'dh-header'; header.innerHTML = `