{"repo": "7452323/quantumultx", "files": {"Userscripts/omnily.user.js": {"74b5252862202e0aec4a4f95dd4c4a101b9b50a2": {"t": 1785746592.0058243, "n": 30448, "h": "51d6f28f6cd0b047", "c": "// ==UserScript==\n// @name 网页翻译 · 多引擎\n// @namespace http://tampermonkey.net/\n// @version 1.5\n// @description 点击翻译整个页面/恢复原文。支持Google(免费)/百度通用(极速)/百度大模型(AI)/DeepSeek(高质量),双语/单语模式,翻译结果缓存。长按进入配置。\n// @author you\n// @match *://*/*\n// @icon data:image/svg+xml,\n// @grant GM_setValue\n// @grant GM_getValue\n// @grant GM_addStyle\n// @grant GM_xmlhttpRequest\n// @license MIT\n// ==/UserScript==\n\n(function () {\n \"use strict\";\n\n // ====== 配置 ======\n const cfg = {\n engine: GM_getValue(\"ds_engine\", \"google\"),\n mode: GM_getValue(\"ds_mode\", \"bilingual\"),\n // 百度通用翻译 (appid + secretKey)\n baiduAppId: GM_getValue(\"ds_baidu_id\", \"\"),\n baiduKey: GM_getValue(\"ds_baidu_key\", \"\"),\n // 百度大模型翻译 (只有一串 APP ID)\n baiduLlmAppId: GM_getValue(\"ds_baidu_llm_id\", \"\"),\n // DeepSeek\n dsKey: GM_getValue(\"ds_api_key\", \"\"),\n dsModel: GM_getValue(\"ds_model\", \"deepseek-chat\"),\n };\n\n // ====== 状态 ======\n let translated = false;\n let translating = false;\n let stopRequested = false;\n let originalTexts = null;\n const transCache = new Map();\n\n // ====== 样式 ======\n GM_addStyle(`\n #ds-fab {\n position: fixed; bottom: 24px; right: 24px; z-index: 999999;\n width: 52px; height: 52px; border-radius: 50%; background: #4f6ef7;\n color: #fff; border: none; font-size: 24px; cursor: pointer;\n box-shadow: 0 2px 12px rgba(79,110,247,0.4);\n transition: transform 0.15s, background 0.3s;\n display: flex; align-items: center; justify-content: center;\n user-select: none; -webkit-user-select: none;\n }\n #ds-fab:active { transform: scale(0.92); }\n #ds-fab.translated { background: #a6e3a1; }\n\n #ds-panel {\n position: fixed; bottom: 88px; right: 24px; z-index: 999999;\n width: 320px; max-height: 70vh; overflow-y: auto;\n background: #1e1e2e; border-radius: 16px; padding: 20px;\n box-shadow: 0 8px 40px rgba(0,0,0,0.5); color: #cdd6f4;\n font: 14px -apple-system, sans-serif; display: none; border: 1px solid #313244;\n }\n #ds-panel.show { display: block; }\n #ds-panel h3 {\n margin: 0 0 16px 0; font-size: 16px; color: #cba6f7;\n display: flex; justify-content: space-between; align-items: center;\n }\n #ds-panel h3 button { background: none; border: none; color: #a6adc8; cursor: pointer; font-size: 18px; padding: 0 4px; }\n #ds-panel h3 button:hover { color: #f38ba8; }\n #ds-panel label { display: block; margin-bottom: 4px; color: #a6adc8; font-size: 12px; margin-top: 8px; }\n #ds-panel label:first-of-type { margin-top: 0; }\n #ds-panel input, #ds-panel select {\n width: 100%; padding: 8px 12px; margin-bottom: 4px;\n background: #313244; border: 1px solid #45475a; border-radius: 8px;\n color: #cdd6f4; font-size: 13px; box-sizing: border-box; outline: none;\n }\n #ds-panel input:focus, #ds-panel select:focus { border-color: #4f6ef7; }\n #ds-panel .hint { font-size: 11px; color: #6c7086; margin: 2px 0 8px 0; }\n\n #ds-panel .engine-tab {\n display: flex; gap: 6px; margin-bottom: 6px;\n }\n #ds-panel .engine-tab button {\n flex: 1; padding: 7px; border: 1px solid #45475a; border-radius: 8px;\n background: #313244; color: #a6adc8; cursor: pointer; font-size: 12px; transition: all 0.2s;\n }\n #ds-panel .engine-tab button.active { background: #4f6ef7; border-color: #4f6ef7; color: #fff; }\n\n #ds-panel .baidu-subtab {\n display: flex; gap: 6px; margin: 6px 0 10px 0;\n }\n #ds-panel .baidu-subtab button {\n flex: 1; padding: 5px; border: 1px solid #45475a; border-radius: 6px;\n background: #313244; color: #a6adc8; cursor: pointer; font-size: 11px; transition: all 0.2s;\n }\n #ds-panel .baidu-subtab button.active { background: #4f6ef7; border-color: #4f6ef7; color: #fff; }\n\n #ds-panel .mode-tab {\n display: flex; gap: 6px; margin-bottom: 12px;\n }\n #ds-panel .mode-tab button {\n flex: 1; padding: 6px; border: 1px solid #45475a; border-radius: 8px;\n background: #313244; color: #a6adc8; cursor: pointer; font-size: 12px; transition: all 0.2s;\n }\n #ds-panel .mode-tab button.active { background: #585b70; border-color: #585b70; color: #fff; }\n\n #ds-panel .cfg-section { display: none; }\n #ds-panel .cfg-section.show { display: block; }\n #ds-panel .btn-row { display: flex; gap: 8px; margin-top: 12px; }\n #ds-panel .btn-row button {\n flex: 1; padding: 9px; border: none; border-radius: 8px;\n cursor: pointer; font-size: 13px; transition: opacity 0.2s;\n }\n #ds-panel .btn-row button:active { opacity: 0.8; }\n #ds-panel .btn-save { background: #4f6ef7; color: #fff; }\n #ds-panel .btn-close-cfg { background: #45475a; color: #cdd6f4; }\n #ds-panel .btn-clear-cache { background: #45475a; color: #f38ba8; }\n\n #ds-progress { margin-top: 10px; display: none; }\n #ds-progress.show { display: block; }\n #ds-progress .bar-wrap { width: 100%; height: 4px; background: #313244; border-radius: 2px; overflow: hidden; }\n #ds-progress .bar { height: 100%; width: 0%; background: #a6e3a1; border-radius: 2px; transition: width 0.3s; }\n #ds-progress .text { font-size: 11px; color: #a6adc8; margin-top: 4px; text-align: center; }\n\n #ds-toast {\n position: fixed; top: 20px; left: 50%; transform: translateX(-50%);\n z-index: 9999999; padding: 10px 24px; border-radius: 10px;\n font: 14px -apple-system, sans-serif; color: #fff;\n display: none; box-shadow: 0 4px 20px rgba(0,0,0,0.3);\n }\n #ds-toast.ok { background: #1e3a2e; }\n #ds-toast.err { background: #3a1e1e; }\n #ds-toast.info { background: #1e2a3a; }\n `);\n\n // ====== DOM ======\n document.body.insertAdjacentHTML(\"beforeend\", `\n \n