// ==UserScript==
// @name 破解百度网盘/百度文库/抖音下载限制
// @namespace tools
// @version 3.2.0
// @author 大角牛软件科技
// @description 【2025】破解百度网盘下载限制,百度文库等下载限制,完全免费下载。 网盘必看教程:https://u2233.vip/BDWP/word.html 文库必看教程:https://u2233.vip/BDWK/word.html 右下角没出现红色按钮必看:https://u2233.vip/QUEST/word.html 联系作者/用户QQ群: 685904930
// @license Viewing License
// @icon https://dl-test.infiniteworlds.com.cn/Monkeys/static/img/favicon.ico
// @match *://pan.baidu.com/*
// @match *://yun.baidu.com/*
// @match *://wenku.baidu.com/*
// @match *://www.douyin.com/*
// @require https://registry.npmmirror.com/vue/3.5.18/files/dist/vue.global.prod.js
// @require data:application/javascript,%3Bwindow.Vue%20%3D%20Vue%3B
// @require https://registry.npmmirror.com/element-plus/2.10.5/files/dist/index.full.min.js
// @resource ElementPlus https://registry.npmmirror.com/element-plus/2.10.5/files/dist/index.css
// @connect dl-test.infiniteworlds.com.cn
// @connect wan.baidu.com
// @connect localhost
// @grant GM_addElement
// @grant GM_addStyle
// @grant GM_addValueChangeListener
// @grant GM_cookie
// @grant GM_deleteValue
// @grant GM_deleteValues
// @grant GM_download
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @grant GM_getTab
// @grant GM_getTabs
// @grant GM_getValue
// @grant GM_getValues
// @grant GM_info
// @grant GM_listValues
// @grant GM_log
// @grant GM_notification
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// @grant GM_removeValueChangeListener
// @grant GM_saveTab
// @grant GM_setClipboard
// @grant GM_setValue
// @grant GM_setValues
// @grant GM_unregisterMenuCommand
// @grant GM_webRequest
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @antifeature ads 服务器及脚本运维需要成本,因此引入了广告
// @noframes
// @downloadURL https://update.greasyfork.icu/scripts/544796/%E7%A0%B4%E8%A7%A3%E7%99%BE%E5%BA%A6%E7%BD%91%E7%9B%98%E7%99%BE%E5%BA%A6%E6%96%87%E5%BA%93%E6%8A%96%E9%9F%B3%E4%B8%8B%E8%BD%BD%E9%99%90%E5%88%B6.user.js
// @updateURL https://update.greasyfork.icu/scripts/544796/%E7%A0%B4%E8%A7%A3%E7%99%BE%E5%BA%A6%E7%BD%91%E7%9B%98%E7%99%BE%E5%BA%A6%E6%96%87%E5%BA%93%E6%8A%96%E9%9F%B3%E4%B8%8B%E8%BD%BD%E9%99%90%E5%88%B6.meta.js
// ==/UserScript==
/*
* 查看许可(Viewing License)
*
* 版权声明
* 版权所有 © [2025] [大角牛软件科技]。保留所有权利。
*
* 许可证声明
* 本协议适用于 [破解百度网盘/百度文库下载限制] 及其所有相关文件和代码(以下统称“软件”)。软件以开源形式提供,但仅允许查看,禁止使用、修改或分发。
*
* 授权条款
* 1. 查看许可:任何人可以查看本软件的源代码,但仅限于个人学习和研究目的。
* 2. 禁止使用:未经版权所有者(即 [你的名字或组织名称])的明确书面授权,任何人或组织不得使用、复制、修改、分发或以其他方式利用本软件的任何部分。
* 3. 明确授权:任何希望使用、修改或分发本软件的个人或组织,必须向版权所有者提交书面申请,说明使用目的、范围和方式。版权所有者有权根据自身判断决定是否授予授权。
*
* 限制条款
* 1. 禁止未经授权的使用:未经版权所有者明确授权,任何人或组织不得使用、复制、修改、分发或以其他方式利用本软件的任何部分。
* 2. 禁止商业使用:未经版权所有者明确授权,任何人或组织不得将本软件用于商业目的,包括但不限于在商业网站、应用程序或其他商业服务中使用。
* 3. 禁止分发:未经版权所有者明确授权,任何人或组织不得将本软件或其任何修改版本分发给第三方。
* 4. 禁止修改:未经版权所有者明确授权,任何人或组织不得对本软件进行任何形式的修改。
*
* 法律声明
* 1. 版权保护:本软件受版权法保护。未经授权的使用、复制、修改或分发将构成侵权行为,版权所有者有权依法追究侵权者的法律责任。
* 2. 免责声明:本软件按“原样”提供,不提供任何形式的明示或暗示的保证,包括但不限于对适销性、特定用途的适用性或不侵权的保证。在任何情况下,版权所有者均不对因使用或无法使用本软件而产生的任何直接、间接、偶然、特殊或后果性损害承担责任。
*
* 附加条款
* 1. 协议变更:版权所有者有权随时修改本协议的条款。任何修改将在版权所有者通知后立即生效。
* 2. 解释权:本协议的最终解释权归版权所有者所有。
*/
(e => { if (typeof GM_addStyle == "function") { GM_addStyle(e); return } const t = document.createElement("style"); t.textContent = e, document.head.append(t) })(' .download-assistant[data-v-29ed8f79]{position:fixed;bottom:2vw;right:2vw;z-index:999}.download-button[data-v-29ed8f79]{width:100px;height:100px;cursor:pointer;transition:all .5s cubic-bezier(.175,.885,.32,1.275);position:relative}.download-button[data-v-29ed8f79]:hover,.download-button.active[data-v-29ed8f79]{transform:scale(.35)}.fire[data-v-29ed8f79]{top:0;width:100px;height:100px;background-color:#ff8100;border-radius:50%;z-index:2;transform:scale(.3)}.download-button[data-v-29ed8f79]:before,.download-button[data-v-29ed8f79]:after{content:"";position:absolute;inset:30% 0 0 50%;width:250px;height:230px;background-color:#fbe05d33;border-radius:50%;z-index:1;animation:fireBlazes-29ed8f79 1s infinite linear}.download-button[data-v-29ed8f79]:after{width:300px;height:260px;animation-duration:1.4s;animation-direction:reverse}.fire__tongue[data-v-29ed8f79]{position:absolute;display:block;width:40px;height:50px;border-top:0;border-bottom:50px solid #ff8100;border-left:20px solid rgba(255,255,255,0);border-right:20px solid rgba(255,255,255,0);box-sizing:border-box}.fire__tongue--1[data-v-29ed8f79]{top:-22px;left:6px;animation:tonguesDance-29ed8f79 .3s infinite linear}.fire__tongue--2[data-v-29ed8f79]{top:-64px;left:0;right:0;height:70px;margin:auto;border-bottom:70px solid #ff8100;animation:tonguesDance-29ed8f79 .3s infinite -.2s linear}.fire__tongue--3[data-v-29ed8f79]{top:-17px;right:4px;animation:tonguesDance-29ed8f79 .3s infinite -.4s linear}.fire__eye[data-v-29ed8f79]{position:absolute;top:20px;width:14px;height:14px;background-color:#000;border-radius:50%;border:2px solid #ffffff;transform:rotate(45deg);animation:fireBlinks-29ed8f79 4s infinite linear}.fire__eye--right[data-v-29ed8f79]{left:24px}.fire__eye--left[data-v-29ed8f79]{right:24px}.fire__mouth[data-v-29ed8f79]{position:absolute;top:48px;left:0;right:0;width:24px;height:4px;margin:auto;background-color:#000;border-radius:2px;overflow:hidden;animation:fireChews-29ed8f79 8s infinite linear}.fire__food[data-v-29ed8f79]{position:absolute;top:52px;left:50px;width:80px;height:8px;background-color:#904612;border-radius:2px;transform:rotate(30deg);transform-origin:left;animation:fireEats-29ed8f79 8s infinite linear}.fire__food[data-v-29ed8f79]:after{content:"";position:absolute;top:-20px;right:-14px;width:16px;height:20px;background-color:#057d05;border-top-left-radius:84%;border-bottom-right-radius:84%}@keyframes tonguesDance-29ed8f79{0%{transform:translate(0)}33%{transform:translate(1px)}66%{transform:translate(-1px)}to{transform:translate(0)}}@keyframes fireBlinks-29ed8f79{0%{background-color:#000;border-color:#fff}50%{background-color:#000;border-color:#fff}51%{background-color:#fff0;border-top-color:#fff0;border-left-color:#fff0;border-bottom-color:#000;border-right-color:#000}53%{background-color:#fff0;border-top-color:#fff0;border-left-color:#fff0;border-bottom-color:#000;border-right-color:#000}54%{background-color:#000;border-color:#fff}to{background-color:#000;border-color:#fff}}@keyframes fireChews-29ed8f79{0%{height:4px;border-radius:2px}49%{height:4px;border-radius:2px}50%{height:24px;border-radius:50%}51%{height:4px}52%{height:24px}53%{height:4px}54%{height:24px}55%{height:4px}56%{height:24px}57%{height:4px}58%{height:24px}59%{height:4px;border-radius:50%}60%{height:4px;border-radius:2px;transform:translateY(0)}62%{transform:translateY(5px)}64%{transform:translateY(0)}66%{transform:translateY(5px)}68%{transform:translateY(0)}70%{transform:translateY(5px)}72%{transform:translateY(0)}to{height:4px}}@keyframes fireEats-29ed8f79{0%{opacity:0;width:80px}49%{opacity:0;width:80px}50%{opacity:1;width:80px}59%{opacity:1;width:0}60%{opacity:0;width:0}to{opacity:0;width:0}}@keyframes fireBlazes-29ed8f79{0%{transform:translate(-50%,-50%) rotate(0)}to{transform:translate(-50%,-50%) rotate(360deg)}}@media (max-width: 480px){.download-assistant[data-v-29ed8f79]{bottom:20px;right:20px}.download-button[data-v-29ed8f79]{width:70px;height:70px}}.webview-container[data-v-d5bf9a60]{position:relative;overflow:hidden}.loading-overlay[data-v-d5bf9a60]{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#ffffffe6;z-index:10}.loading-spinner[data-v-d5bf9a60]{width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #3498db;border-radius:50%;animation:spin-d5bf9a60 1s linear infinite}.error-overlay[data-v-d5bf9a60]{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fffffff2;z-index:10}.error-content[data-v-d5bf9a60]{text-align:center;padding:20px}.error-content h3[data-v-d5bf9a60]{color:#e74c3c;margin-bottom:10px}.error-content p[data-v-d5bf9a60]{color:#666;margin-bottom:20px}.retry-btn[data-v-d5bf9a60]{background:#3498db;color:#fff;border:none;padding:10px 20px;border-radius:4px;cursor:pointer;font-size:14px}.retry-btn[data-v-d5bf9a60]:hover{background:#2980b9}.iframe[data-v-d5bf9a60]{width:100%;height:100%;border:none}@keyframes spin-d5bf9a60{to{transform:rotate(360deg)}}[data-v-1c526f40] .el-drawer__body{padding:0;height:100%;position:relative}.drawer-header[data-v-1c526f40]{height:50px;background:#fff;border-bottom:1px solid #e8e8e8;display:flex;align-items:center;justify-content:space-between;padding:0 20px}.header-title[data-v-1c526f40]{display:flex;align-items:center;gap:10px;color:#333;font-weight:500;font-size:15px}.header-icon[data-v-1c526f40]{font-size:20px}.header-text[data-v-1c526f40]{font-size:15px;letter-spacing:.3px;font-weight:bolder}.header-close-btn[data-v-1c526f40]{background:#ff4757;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:all .2s;width:26px;height:26px;box-shadow:0 2px 4px #ff475733}.header-close-btn[data-v-1c526f40]:hover{background:#ff3838;box-shadow:0 4px 8px #ff47574d}.close-icon[data-v-1c526f40]{font-size:18px;color:#fff;font-weight:500}.drawer-content[data-v-1c526f40]{width:100%;height:calc(100% - 50px);overflow:hidden;display:flex;flex-direction:column}.disabled-content[data-v-1c526f40]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;text-align:center}.disabled-icon[data-v-1c526f40]{font-size:48px;margin-bottom:16px}.disabled-content p[data-v-1c526f40]{margin:0;color:#6c757d;font-size:14px}.el-drawer__header{margin-bottom:0!important}body{font-size:14px!important}a{text-decoration:none!important}:where(*,*:before,*:after){box-sizing:border-box}:where(html){-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;line-height:1.15}:where(body){margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:where(img,picture,video,canvas,svg,iframe,embed,object){display:block}:where(img,svg){height:auto}:where(iframe){border:0}:where(input,button,textarea,select){font:inherit;color:inherit}:where(button,[type=button],[type=reset],[type=submit]){-webkit-appearance:button}:where(textarea){resize:vertical}:where(fieldset){min-width:0;margin:0;padding:.35em .75em .625em;border:1px solid #a9a9a9}:where(legend){padding:0}:where(progress){vertical-align:baseline}:where(ol,ul){list-style:none;margin:0;padding:0}:where(blockquote,q){quotes:none}:where(blockquote:before,blockquote:after,q:before,q:after){content:"";content:none}:where(table){border-collapse:collapse;border-spacing:0}:where(th,td){padding:0;text-align:left}:where(main,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section){display:block}:where(summary){display:list-item}:where(template,[hidden]){display:none}:where(:focus-visible){outline:2px solid Highlight;outline-offset:2px}:where(:focus:not(:focus-visible)){outline:0}:where(html){color-scheme:light dark}:where(html){scrollbar-width:thin;scrollbar-color:#888 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#888;border-radius:4px}::-webkit-scrollbar-track{background:transparent}:where(iframe){width:100%} ');
(function (vue, ElementPlus) {
'use strict';
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _sfc_main$2 = {
name: "FireButton",
props: {
isProcessing: {
type: Boolean,
default: false
}
},
emits: ["click"],
methods: {
handleClick() {
this.$emit("click");
}
}
};
const _hoisted_1$2 = {
id: "download-assistant",
class: "download-assistant"
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
vue.createElementVNode("div", {
class: vue.normalizeClass(["download-button fire", { active: $props.isProcessing }]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.handleClick && $options.handleClick(...args))
}, _cache[1] || (_cache[1] = [
vue.createStaticVNode('', 7)
]), 2)
]);
}
const FireButton = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-29ed8f79"]]);
class WebViewCapabilities {
constructor(config2) {
this.config = config2;
this.capabilities = /* @__PURE__ */ new Map();
}
/**
* 注册能力
*/
register(capability) {
if (!capability.name) {
return;
}
this.capabilities.set(capability.name, capability);
if (typeof capability.onRegister === "function") {
capability.onRegister(this.config);
}
}
/**
* 移除能力
*/
unregister(name) {
const capability = this.capabilities.get(name);
if (capability && typeof capability.onUnregister === "function") {
capability.onUnregister();
}
this.capabilities.delete(name);
}
/**
* 处理消息
*/
handleMessage(message2, event) {
for (const [name, capability] of this.capabilities) {
if (typeof capability.handleMessage === "function") {
try {
if (capability.handleMessage(message2, event, this.config)) {
return true;
}
} catch (error) {
}
}
}
return false;
}
/**
* 获取能力
*/
get(name) {
return this.capabilities.get(name);
}
/**
* 销毁能力系统
*/
destroy() {
for (const [name, capability] of this.capabilities) {
if (typeof capability.onDestroy === "function") {
capability.onDestroy();
}
}
this.capabilities.clear();
}
}
const evalCapability = {
name: "eval",
onRegister(config2) {
this.config = config2;
},
handleMessage(message2, event, config2) {
if (message2.type === "eval") {
this.handleEval(message2, config2);
return true;
}
if (message2.type === "eval-sync") {
this.handleEvalSync(message2, config2);
return true;
}
return false;
},
handleEval(message, config) {
const requestId = message.requestId;
const { code } = message.data || message;
try {
const result = eval(code);
if (result && typeof result.then === "function") {
result.then((resolvedResult) => {
config.sendResponse(requestId, resolvedResult);
}).catch((error) => {
config.sendError(requestId, error.message);
});
} else {
config.sendResponse(requestId, result);
}
} catch (error) {
config.sendError(requestId, error.message);
}
},
handleEvalSync(message, config) {
const { code } = message.data || message;
try {
eval(code);
} catch (error) {
}
},
onDestroy() {
}
};
var _GM = /* @__PURE__ */ (() => typeof GM != "undefined" ? GM : void 0)();
var _GM_addElement = /* @__PURE__ */ (() => typeof GM_addElement != "undefined" ? GM_addElement : void 0)();
var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
var _GM_addValueChangeListener = /* @__PURE__ */ (() => typeof GM_addValueChangeListener != "undefined" ? GM_addValueChangeListener : void 0)();
var _GM_cookie = /* @__PURE__ */ (() => typeof GM_cookie != "undefined" ? GM_cookie : void 0)();
var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)();
var _GM_deleteValues = /* @__PURE__ */ (() => typeof GM_deleteValues != "undefined" ? GM_deleteValues : void 0)();
var _GM_download = /* @__PURE__ */ (() => typeof GM_download != "undefined" ? GM_download : void 0)();
var _GM_getResourceText = /* @__PURE__ */ (() => typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0)();
var _GM_getResourceURL = /* @__PURE__ */ (() => typeof GM_getResourceURL != "undefined" ? GM_getResourceURL : void 0)();
var _GM_getTab = /* @__PURE__ */ (() => typeof GM_getTab != "undefined" ? GM_getTab : void 0)();
var _GM_getTabs = /* @__PURE__ */ (() => typeof GM_getTabs != "undefined" ? GM_getTabs : void 0)();
var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
var _GM_getValues = /* @__PURE__ */ (() => typeof GM_getValues != "undefined" ? GM_getValues : void 0)();
var _GM_info = /* @__PURE__ */ (() => typeof GM_info != "undefined" ? GM_info : void 0)();
var _GM_listValues = /* @__PURE__ */ (() => typeof GM_listValues != "undefined" ? GM_listValues : void 0)();
var _GM_log = /* @__PURE__ */ (() => typeof GM_log != "undefined" ? GM_log : void 0)();
var _GM_notification = /* @__PURE__ */ (() => typeof GM_notification != "undefined" ? GM_notification : void 0)();
var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
var _GM_removeValueChangeListener = /* @__PURE__ */ (() => typeof GM_removeValueChangeListener != "undefined" ? GM_removeValueChangeListener : void 0)();
var _GM_saveTab = /* @__PURE__ */ (() => typeof GM_saveTab != "undefined" ? GM_saveTab : void 0)();
var _GM_setClipboard = /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)();
var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
var _GM_setValues = /* @__PURE__ */ (() => typeof GM_setValues != "undefined" ? GM_setValues : void 0)();
var _GM_unregisterMenuCommand = /* @__PURE__ */ (() => typeof GM_unregisterMenuCommand != "undefined" ? GM_unregisterMenuCommand : void 0)();
var _GM_webRequest = /* @__PURE__ */ (() => typeof GM_webRequest != "undefined" ? GM_webRequest : void 0)();
var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)();
var _monkeyWindow = /* @__PURE__ */ (() => window)();
const GM$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
GM: _GM,
GM_addElement: _GM_addElement,
GM_addStyle: _GM_addStyle,
GM_addValueChangeListener: _GM_addValueChangeListener,
GM_cookie: _GM_cookie,
GM_deleteValue: _GM_deleteValue,
GM_deleteValues: _GM_deleteValues,
GM_download: _GM_download,
GM_getResourceText: _GM_getResourceText,
GM_getResourceURL: _GM_getResourceURL,
GM_getTab: _GM_getTab,
GM_getTabs: _GM_getTabs,
GM_getValue: _GM_getValue,
GM_getValues: _GM_getValues,
GM_info: _GM_info,
GM_listValues: _GM_listValues,
GM_log: _GM_log,
GM_notification: _GM_notification,
GM_openInTab: _GM_openInTab,
GM_registerMenuCommand: _GM_registerMenuCommand,
GM_removeValueChangeListener: _GM_removeValueChangeListener,
GM_saveTab: _GM_saveTab,
GM_setClipboard: _GM_setClipboard,
GM_setValue: _GM_setValue,
GM_setValues: _GM_setValues,
GM_unregisterMenuCommand: _GM_unregisterMenuCommand,
GM_webRequest: _GM_webRequest,
GM_xmlhttpRequest: _GM_xmlhttpRequest,
monkeyWindow: _monkeyWindow,
unsafeWindow: _unsafeWindow
}, Symbol.toStringTag, { value: "Module" }));
class RequestCapability {
constructor() {
this.name = "request";
this.GM = GM$1;
this.isGMAvailable = !!_GM_xmlhttpRequest;
this.isBrowserEnv = typeof window !== "undefined" && typeof fetch !== "undefined";
}
/**
* 通用请求函数
* @param {Object} options - 请求配置
* @param {string} options.method - HTTP 方法
* @param {string} options.url - 请求 URL
* @param {Object} options.headers - 请求头
* @param {string} options.data - 请求体数据
* @returns {Promise} 返回 Promise,resolve 的数据是解析后的响应
*/
async request(options) {
const { method = "GET", url, headers = {}, data } = options;
if (this.isGMAvailable) {
return this.gmRequest(options);
}
if (this.isBrowserEnv) {
return this.fetchRequest(options);
}
throw new Error("当前环境不支持发送 HTTP 请求");
}
/**
* 使用油猴 GM API 发送请求
*/
gmRequest(options) {
const { method, url, headers, data } = options;
return new Promise((resolve, reject) => {
try {
this.GM.GM_xmlhttpRequest({
method: method || "GET",
url,
headers: headers || {},
data,
onload: function (response) {
try {
const parsedData = typeof response.responseText === "string" ? JSON.parse(response.responseText) : response.responseText;
resolve(parsedData);
} catch (e) {
resolve(response.responseText);
}
},
onerror: function (error) {
reject(new Error(`GM 请求失败: ${error.message || "未知错误"}`));
},
ontimeout: function () {
reject(new Error("GM 请求超时"));
}
});
} catch (error) {
reject(new Error(`GM API 调用失败: ${error.message}`));
}
});
}
/**
* 使用浏览器原生 fetch API 发送请求
*/
async fetchRequest(options) {
const { method, url, headers, data } = options;
try {
const fetchOptions = {
method: method || "GET",
headers: headers || {}
};
if (data && method !== "GET" && method !== "HEAD") {
fetchOptions.body = data;
}
const response = await fetch(url, fetchOptions);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const responseText = await response.text();
try {
return JSON.parse(responseText);
} catch (e) {
return responseText;
}
} catch (error) {
throw new Error(`Fetch 请求失败: ${error.message}`);
}
}
onRegister(config2) {
this.config = config2;
}
handleMessage(message2, event, config2) {
if (message2.type === "request") {
this.handleRequest(message2, config2);
return true;
}
return false;
}
async handleRequest(message2, config2) {
const requestId2 = message2.requestId;
const requestOptions = message2.data;
try {
const response = await this.request(requestOptions);
config2.sendResponse(requestId2, response);
} catch (error) {
config2.sendError(requestId2, error.message);
}
}
onDestroy() {
}
}
const requestCapability = new RequestCapability();
const _sfc_main$1 = {
name: "WebView",
props: {
src: { type: String, required: true },
width: { type: [String, Number], default: "100%" },
height: { type: [String, Number], default: "100%" }
},
data() {
return {
loading: true,
error: null,
capabilities: null
};
},
computed: {
containerStyle() {
return {
width: typeof this.width === "number" ? `${this.width}px` : this.width,
height: typeof this.height === "number" ? `${this.height}px` : this.height
};
}
},
mounted() {
this.initCapabilities();
window.addEventListener("message", this.handleMessage);
},
beforeDestroy() {
window.removeEventListener("message", this.handleMessage);
if (this.capabilities) {
this.capabilities.destroy();
}
},
methods: {
initCapabilities() {
this.capabilities = new WebViewCapabilities({
sendResponse: this.sendResponse,
sendError: this.sendError
});
evalCapability.onRegister({
sendResponse: this.sendResponse,
sendError: this.sendError,
capabilities: this.capabilities
});
this.capabilities.register(evalCapability);
requestCapability.onRegister({
sendResponse: this.sendResponse,
sendError: this.sendError,
capabilities: this.capabilities
});
this.capabilities.register(requestCapability);
},
onLoad() {
this.loading = false;
this.error = null;
this.$emit("load");
},
onError() {
this.loading = false;
this.error = "页面加载失败";
this.$emit("error");
},
retry() {
this.loading = true;
this.error = null;
this.$refs.iframeRef.src = this.src;
},
handleMessage(event) {
try {
const message2 = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
if (message2?.type && this.capabilities) {
this.capabilities.handleMessage(message2, event);
}
} catch (err) {
}
},
sendResponse(requestId2, data) {
const iframeWindow = this.$refs.iframeRef?.contentWindow;
if (iframeWindow) {
iframeWindow.postMessage({ type: "response", data, requestId: requestId2 }, "*");
}
},
sendError(requestId2, error) {
const iframeWindow = this.$refs.iframeRef?.contentWindow;
if (iframeWindow) {
iframeWindow.postMessage({ type: "error", error, requestId: requestId2 }, "*");
}
}
}
};
const _hoisted_1$1 = {
key: 0,
class: "loading-overlay"
};
const _hoisted_2$1 = {
key: 1,
class: "error-overlay"
};
const _hoisted_3$1 = { class: "error-content" };
const _hoisted_4$1 = ["src"];
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("div", {
class: "webview-container",
style: vue.normalizeStyle($options.containerStyle)
}, [
$data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, _cache[3] || (_cache[3] = [
vue.createElementVNode("div", { class: "loading-spinner" }, null, -1)
]))) : vue.createCommentVNode("", true),
$data.error ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
vue.createElementVNode("div", _hoisted_3$1, [
_cache[4] || (_cache[4] = vue.createElementVNode("h3", null, "加载失败", -1)),
vue.createElementVNode("p", null, vue.toDisplayString($data.error), 1),
vue.createElementVNode("button", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.retry && $options.retry(...args)),
class: "retry-btn"
}, "重试加载组件")
])
])) : vue.createCommentVNode("", true),
!$data.error ? (vue.openBlock(), vue.createElementBlock("iframe", {
key: 2,
ref: "iframeRef",
src: $props.src,
class: "iframe",
onLoad: _cache[1] || (_cache[1] = (...args) => $options.onLoad && $options.onLoad(...args)),
onError: _cache[2] || (_cache[2] = (...args) => $options.onError && $options.onError(...args))
}, null, 40, _hoisted_4$1)) : vue.createCommentVNode("", true)
], 4);
}
const WebView = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-d5bf9a60"]]);
const _sfc_main = {
name: "App",
components: {
FireButton,
WebView
},
data() {
return {
fireDialogVisible: false,
config: null,
loading: true
};
},
async created() {
await this.loadAppConfig();
},
computed: {
currentSite() {
if (!this.config) return { enabled: false, description: "配置加载中..." };
const host = window.location.host;
return this.config.UTILS.getCurrentSiteConfig(host);
},
currentWebViewSrc() {
return this.currentSite.webviewSrc;
}
},
methods: {
// 远程加载应用配置
async loadAppConfig() {
return new Promise((resolve, reject) => {
if (_unsafeWindow.$AppConfig) {
this.config = _unsafeWindow.$AppConfig;
this.loading = false;
resolve(this.config);
return;
}
_unsafeWindow.$AppConfigEndFn = (config2) => {
this.config = config2;
this.loading = false;
resolve(this.config);
};
const script = document.createElement("script");
script.src = "https://dl-test.infiniteworlds.com.cn/Monkeys/JS/app-config.js";
script.onerror = () => {
console.warn("[$AppConfig] 无法加载配置文件,脚本加载失败");
resolve(null);
};
document.head.appendChild(script);
});
},
// 显示火焰按钮弹窗
showFireDialog() {
this.fireDialogVisible = true;
}
}
};
const _hoisted_1 = { style: { "pointer-events": "none" } };
const _hoisted_2 = {
class: "drawer-header",
style: { "pointer-events": "auto" }
};
const _hoisted_3 = { class: "header-title" };
const _hoisted_4 = { class: "header-icon" };
const _hoisted_5 = { class: "header-text" };
const _hoisted_6 = {
key: 0,
class: "drawer-content"
};
const _hoisted_7 = {
key: 1,
class: "drawer-content disabled-content",
style: { "pointer-events": "auto" }
};
const _hoisted_8 = {
key: 2,
class: "drawer-content disabled-content",
style: { "pointer-events": "auto" }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_FireButton = vue.resolveComponent("FireButton");
const _component_WebView = vue.resolveComponent("WebView");
const _component_el_drawer = vue.resolveComponent("el-drawer");
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createVNode(_component_FireButton, {
onClick: $options.showFireDialog,
style: { "pointer-events": "auto" }
}, null, 8, ["onClick"]),
vue.createVNode(_component_el_drawer, {
modelValue: $data.fireDialogVisible,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.fireDialogVisible = $event),
size: $data.config?.UI_CONFIG?.drawerSize || 600,
modal: $data.config?.UI_CONFIG?.modal || false,
"lock-scroll": $data.config?.UI_CONFIG?.lockScroll || false,
direction: $data.config?.UI_CONFIG?.drawerDirection || "rtl",
"with-header": false,
"append-to-body": $data.config?.UI_CONFIG?.appendToBody || false,
"destroy-on-close": $data.config?.UI_CONFIG?.destroyOnClose || false
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", _hoisted_2, [
vue.createElementVNode("div", _hoisted_3, [
vue.createElementVNode("span", _hoisted_4, vue.toDisplayString($options.currentSite.icon || "📱"), 1),
vue.createElementVNode("span", _hoisted_5, vue.toDisplayString($options.currentSite.name || "大角牛脚本"), 1)
]),
vue.createElementVNode("button", {
class: "header-close-btn",
onClick: _cache[0] || (_cache[0] = ($event) => $data.fireDialogVisible = false),
title: "关闭不影响程序运行"
}, _cache[2] || (_cache[2] = [
vue.createElementVNode("span", { class: "close-icon" }, "×", -1)
]))
]),
$options.currentSite.enabled ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
vue.createVNode(_component_WebView, {
src: $options.currentWebViewSrc,
style: { "pointer-events": "auto" }
}, null, 8, ["src"])
])) : !$data.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
_cache[3] || (_cache[3] = vue.createElementVNode("div", { class: "disabled-icon" }, "🚫", -1)),
vue.createElementVNode("p", null, vue.toDisplayString($options.currentSite.description || "暂不支持此网站"), 1)
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, _cache[4] || (_cache[4] = [
vue.createElementVNode("div", { class: "disabled-icon" }, "⏳", -1),
vue.createElementVNode("p", null, "配置加载中...", -1)
])))
]),
_: 1
}, 8, ["modelValue", "size", "modal", "lock-scroll", "direction", "append-to-body", "destroy-on-close"])
]);
}
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1c526f40"]]);
const cssLoader = (e) => {
const t = GM_getResourceText(e);
return GM_addStyle(t), t;
};
cssLoader("ElementPlus");
const appContainer = document.createElement("div");
document.body.appendChild(appContainer);
vue.createApp(App).use(ElementPlus).mount(appContainer);
})(Vue, ElementPlus);