// ==UserScript==
// @name 【移动端】百度系优化
// @namespace https://github.com/WhiteSevs/TamperMonkeyScript
// @version 2026.5.11
// @author WhiteSevs
// @description 用于【移动端】的百度系列产品优化,包括【百度搜索】、【百家号】、【百度贴吧】、【百度文库】、【百度经验】、【百度百科】、【百度知道】、【百度翻译】、【百度图片】、【百度地图】、【百度好看视频】、【百度爱企查】、【百度问题】、【百度识图】等
// @license GPL-3.0-only
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABZlJREFUeF7VW+1x2zAMhdpkjjobeIM2kzT+HfeuG6TeoHdNfsedpM4G3iDpHO1VDUjJIimC+CB1bvXTlkTwEQQeHqEOFrrWn/ob6OEjAHyAHl6ggxcA2B3vu8NCQ5pe25meKjy0/tyv4Dc8uonnrg42x2/dXjvuAOjq9b2HliC2B2Db/yAnP85aAcI6/74DXMDm+LVDr6q6mgKw3vZfAOBOZNEFXJUmwHoSDsK8Q2JHMwAGg58lgw73YDxAwLIXsfLzeytBaAeAZvXHaRDGqzzJB1YSSG5B2gFw2z++RvobbsDo/wwABk8CUMSU1L52AEiC33z0WUZQrr5/Yw/740O3UYE/3NwSgF5tQLJyptX3ALwcH7or9fivxKQJABWGRyu33vbIHTCNqq/jfWeai+mhnHXr2/4ZOkCiIr8S1zW5/7/gAWiDCYAkgv/fAFiCIMB1SGvXlkzi/Q3p8bXc9aY7W24BdRpM9+3A97GO0F5mLiACYAhOziiqEFEHsEzkNgFQkQFwPkUAnEtiVRcGN1/afocL2KdcXhkHZqtmzCbm1S8CIODis4rMeUEPuBXK2aCwaioQK1efBEAcjdEbLuE69AT2WcZo5VaKgqg2cGQBMLjh3JWxMEI1aO4JqAaxqhALorfcJKykIM1igGjwOdSzlRiAxOLovZPE3sCTRgkqbCcSRBdEPTFaOQkOvY2R4CIADKvvoagoRji3HWzCCa3gLRxyIgoTew4YtCnwYwC8kGnJw5geRSmVm7D2f3Hq7GEPl7BLAYwBsIgao8WVyox24o5+ewG2SoVKAeAFTcrScwBgoc6JnTEAlhee0wO2vV6DSOJVMwAsMcC58HBpJW6D+0++G3hBmxigYGQuaP2BuyxHKETrdOcZ07V/DQmAPQuw5aiAWo9zFB16VAEQkKg5EbIoO4w0rZj8yCuQOO1KxKlCO4hYZBMmSO1/0elOKf8VMstiALj8qvMCshxVr3wKRqbYGm+pAiBQorLsza3cL/jBlrUFKapqj4ZAECCIGWDGw0KPJelrkV97UWRDqkN6hsYRwVzFaZPQk4zF8vehPkeh4x1WdGhpMTjJvYebdPr/HATdVh3fF72HBUBrZfW+Lw8YGW+KAyUqrJ1shpyUaom0NSbfQcIZEUxAEauyq48/NvMAZjUiolRFY5OgqAAhS9aaACBw+3YA4LLltMixKcurQZMoizoAUmxCGaoGQDB5NHmG/tpSycXbQ0SZuR1lBkDJ8pYAwAFb2yxlAkA5+aU8YKobEmmeW/XwfzUAQt0+jfhPaR9Pgy0wzaNAmTkwVAAUJ++l72IFFxoTAHBwQW264qO48XcMZgMRcz+NXajxcqrPCsQAMCvP6gEZzuDlrISYkOk0baehBFzlgYkIgGLeNp4JnDygNQAeafGBqQwAqvmBkMJOhxnBsqd5eGEAxCCwADBlba5AyTVK0GlwGQ/w0Auk+nJ/QKmszTU40Acr5wFA0DpTBqB0UpQHgNLpzwUA6wUcAHR1lwDAFDjnA4AJiBwA9MlLCkC5yfGcABRTNC2JcbJWbgvQCs35AGAObeweoCExpWpwySwwlM6lPuIyALzmFktUtB4o9wDq6EzKBFPKWekB/HF5rucf40HSWkcSIYK6hr2JOKfM89LPc2wxAAcVafvGSiw4fDHV9CLbBLSYJ0KSAxIDCMnp0y7XeFkqZaUAcMf2PBXWNU24hqSkvKXmkX4XgBoCnjvIPqz0bXjcJzpsUcQDsNxBB6dV1P9fWwuMFjh3yzc+1hu53BvY1cehWQ8IQJD1AS83Ic2bxQKNGACXFVpsB5S2xquDn8GssKM01vQ1U57uFa38ZIJhkNOBqW+DnXeGD22q7tWjjkd0eabDB2IKHp1pQFFnEtUWMODU7JETKUJyNQLuP8f3n8xVfJL/F9CfBX10dPIcAAAAAElFTkSuQmCC
// @supportURL https://github.com/WhiteSevs/TamperMonkeyScript/issues
// @match *://*.baidu.com/*
// @match *://www.tieba.com/*
// @match *://jump2.bdimg.com/*
// @match *://uf9kyh.smartapps.cn/*
// @require https://fastly.jsdelivr.net/gh/WhiteSevs/TamperMonkeyScript@86be74b83fca4fa47521cded28377b35e1d7d2ac/lib/CoverUMD/index.js
// @require https://fastly.jsdelivr.net/gh/WhiteSevs/TamperMonkeyScript@86be74b83fca4fa47521cded28377b35e1d7d2ac/lib/showdown/index.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/utils@2.12.2/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/domutils@2.0.8/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/pops@4.2.8/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/qmsg@1.7.2/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/viewerjs@1.11.7/dist/viewer.js
// @require https://fastly.jsdelivr.net/npm/vue@3.5.34/dist/vue.global.prod.js
// @require https://fastly.jsdelivr.net/npm/pinia@3.0.4/dist/pinia.iife.prod.js
// @require https://fastly.jsdelivr.net/npm/vue-router@5.0.6/dist/vue-router.global.js
// @require https://fastly.jsdelivr.net/gh/WhiteSevs/TamperMonkeyScript@bfd9196f357c73ea5ac0398e71d982ee3bd6336b/lib/Element-Plus/index.full.js
// @require https://fastly.jsdelivr.net/npm/@element-plus/icons-vue@2.3.2/dist/index.iife.min.js
// @resource ElementPlusResourceCSS https://fastly.jsdelivr.net/npm/element-plus@2.14.0/dist/index.min.css
// @resource ViewerCSS https://fastly.jsdelivr.net/npm/viewerjs@1.11.7/dist/viewer.min.css
// @connect *
// @connect www.baidu.com
// @connect m.baidu.com
// @connect tieba.baidu.com
// @connect www.tieba.com
// @connect baike.baidu.com
// @connect chat.baidu.com
// @connect chat-ws.baidu.com
// @connect wappass.baidu.com
// @connect tiebaswan.baidu.com
// @grant GM_addStyle
// @grant GM_addValueChangeListener
// @grant GM_deleteValue
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_info
// @grant GM_listValues
// @grant GM_registerMenuCommand
// @grant GM_removeValueChangeListener
// @grant GM_setValue
// @grant GM_setValues
// @grant GM_unregisterMenuCommand
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==
(function (
qmsg,
_whitesev_domutils,
_whitesev_pops,
_whitesev_utils,
vue,
_element_plus_icons_vue,
vue_router,
element_plus,
viewerjs,
pinia
) {
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esmMin = (fn, res) => () => (fn && (res = fn((fn = 0))), res);
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), (cb = null)), mod.exports);
var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === "object") || typeof from === "function")
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
isNodeMode || !mod || !mod.__esModule
? __defProp(target, "default", {
value: mod,
enumerable: true,
})
: target,
mod
)
);
qmsg = __toESM(qmsg);
_whitesev_domutils = __toESM(_whitesev_domutils);
_whitesev_pops = __toESM(_whitesev_pops);
_whitesev_utils = __toESM(_whitesev_utils);
element_plus = __toESM(element_plus);
viewerjs = __toESM(viewerjs);
var s, _css;
var init__virtual_monkey_css = __esmMin(() => {
s = new Set();
_css = async (t) => {
if (s.has(t)) return;
s.add(t);
((cssText) => {
function addStyle(cssText) {
if (typeof GM_addStyle == "function") return GM_addStyle(cssText);
const $css = document.createElement("style");
$css.setAttribute("type", "text/css");
$css.setAttribute("data-type", "gm-css");
if (globalThis.trustedTypes)
$css.innerHTML = globalThis.trustedTypes
.createPolicy("safe-innerHTML", { createHTML: (html) => html })
.createHTML(cssText);
else $css.innerHTML = cssText;
(document.head || document.documentElement).appendChild($css);
return $css;
}
addStyle(cssText);
})(t);
};
});
init__virtual_monkey_css();
_css(
' .follow-forum-container[data-v-758fe620]{background:#f2f2f4;padding:10px}.follow-forum-list-container[data-v-758fe620]{background:#fff;border-radius:12px;margin:10px 0;padding:10px}.follow-forum-item[data-v-758fe620]{align-items:flex-start;width:50%;max-width:50%;margin:10px 0;display:flex}.follow-forum-avatar[data-v-758fe620]{border-radius:12px}.follow-forum-item-right-container[data-v-758fe620]{width:inherit;flex-direction:column;margin:0 10px;display:flex}.follow-forum-item-name[data-v-758fe620]{width:-webkit-fill-available;align-items:center;width:-moz-available;display:flex}.follow-forum-item-level[data-level][data-v-758fe620]{text-align:center;background:var(--v19518d6b);color:var(--v794e15f0);border-radius:3px;margin:5px;padding:2px;font-size:.6rem;font-weight:700;line-height:.6rem}.follow-forum-item-level[data-level="0"][data-v-758fe620],.follow-forum-item-level[data-level="1"][data-v-758fe620],.follow-forum-item-level[data-level="2"][data-v-758fe620],.follow-forum-item-level[data-level="3"][data-v-758fe620]{background:var(--v65eba3f4)}.follow-forum-item-level[data-level="4"][data-v-758fe620],.follow-forum-item-level[data-level="5"][data-v-758fe620],.follow-forum-item-level[data-level="6"][data-v-758fe620],.follow-forum-item-level[data-level="7"][data-v-758fe620],.follow-forum-item-level[data-level="8"][data-v-758fe620],.follow-forum-item-level[data-level="9"][data-v-758fe620]{background:var(--v65ebb2fe)}.follow-forum-item-level[data-level="10"][data-v-758fe620],.follow-forum-item-level[data-level="11"][data-v-758fe620],.follow-forum-item-level[data-level="12"][data-v-758fe620],.follow-forum-item-level[data-level="13"][data-v-758fe620],.follow-forum-item-level[data-level="14"][data-v-758fe620],.follow-forum-item-level[data-level="15"][data-v-758fe620]{background:var(--cce84758)}.follow-forum-item-level[data-level="16"][data-v-758fe620],.follow-forum-item-level[data-level="17"][data-v-758fe620],.follow-forum-item-level[data-level="18"][data-v-758fe620]{background:var(--cce2d2de)}.follow-forum-item-info[data-v-758fe620]{word-wrap:break-word}.posts-container-item[data-v-df752779]{width:-webkit-fill-available;width:-moz-available}.posts-item-title[data-v-df752779]{font-weight:700}.posts-item-title[data-v-df752779],.posts-item-content[data-v-df752779],.posts-item-media-container[data-v-df752779]{margin:10px 0}.posts-item-footer[data-v-df752779]{margin:15px 0 5px}.posts-item-footer .el-col[data-v-df752779]{text-align:center}.posts-item-footer-icon-container[data-v-df752779]{justify-content:center;align-items:center;gap:0 6px;display:flex}.posts-item-right-user-info[data-v-df752779]{padding:0 10px}.posts-container[data-v-9deec8c4]{background:#f2f2f4;padding:10px}.posts-container-item[data-v-9deec8c4]{background:#fff;border-radius:12px;margin:10px 0;padding:10px}.posts-item-title[data-v-9deec8c4]{font-weight:700}.posts-item-title[data-v-9deec8c4],.posts-item-content[data-v-9deec8c4],.posts-item-media-container[data-v-9deec8c4]{margin:10px 0}.posts-item-footer[data-v-9deec8c4]{margin:15px 0 5px}.posts-item-footer .el-col[data-v-9deec8c4]{text-align:center}.posts-item-footer-icon-container[data-v-9deec8c4]{justify-content:center;align-items:center;gap:0 6px;display:flex}.posts-item-right-user-info[data-v-9deec8c4]{padding:0 10px}#main[data-v-d96b1de2]{z-index:1000;width:100%;height:100%}.big-text[data-v-d96b1de2]{font-weight:700}.top-container[data-v-d96b1de2]{width:-webkit-fill-available;width:-moz-available;padding:15px 15px 0}.user-info-bg[data-v-d96b1de2]{width:100%;height:100px}.user-info-bg-main[data-v-d96b1de2]{background:url(https://tb2.bdstatic.com/tb/mobile/suser/img/home_card_back_6cdfca5.jpg) 0 0/100% no-repeat;width:100%;height:160px;position:absolute}.user-avatar-top-background[data-v-d96b1de2]{background:#fff;border-top-left-radius:12px;border-top-right-radius:12px;width:100%;height:40%;margin:0;padding:0;position:absolute;transform:translateY(100%)}.user-info-container[data-v-d96b1de2]{padding:0 10px}.nav-left-arrow-icon[data-v-ac59e7b9]{align-content:center;padding-left:0!important}.nav-title[data-v-ac59e7b9]{text-align:center;padding:10px;font-weight:700}.user-avatar[data-v-ac59e7b9]{text-align:center;padding-bottom:20px}.user-info-item[data-v-ac59e7b9]{flex-wrap:wrap;padding:10px;display:flex}.user-desc-key[data-v-ac59e7b9]{width:60px;display:block}.user-end-text[data-v-ac59e7b9]{padding:0 20px}.user-top[data-v-fa0574d8]{width:100%;height:40px;position:relative}.top-left-arrow-icon[data-v-fa0574d8]{align-content:center;padding-left:0!important}.top-title-name[data-v-fa0574d8]{text-align:center;padding:10px}.user-main[data-v-fa0574d8]{width:100%;height:calc(100% - 40px);padding:0;position:absolute;inset:40px 0 0}.user-container[data-v-fa0574d8]{padding:0 10px}.user-container .el-scrollbar__view[data-v-fa0574d8]{height:100%}.user-item[data-v-fa0574d8]{margin:10px 0}.user-item-row[data-v-fa0574d8]{justify-content:space-between;align-items:center;display:flex}.user-item-row-center[data-v-fa0574d8]{padding:0 10px}.user-name[data-v-fa0574d8],.user-sign-text[data-v-fa0574d8]{text-align:left}.user-sign-text[data-v-fa0574d8]{color:#a2a2a2}.user-follow-btn[data-v-fa0574d8]{float:right}.user-info[data-v-fa0574d8]{display:grid}.user-item-row-left[data-v-fa0574d8]{display:flex}.user-item-row-right[data-v-fa0574d8]{float:right}.user-top[data-v-df4567f8]{width:100%;height:40px;position:relative}.top-left-arrow-icon[data-v-df4567f8]{align-content:center;padding-left:0!important}.top-title-name[data-v-df4567f8]{text-align:center;padding:10px}.user-main[data-v-df4567f8]{width:100%;height:calc(100% - 40px);padding:0;position:absolute;inset:40px 0 0}.user-container[data-v-df4567f8]{padding:0 10px}.user-container .el-scrollbar__view[data-v-df4567f8]{height:100%}.user-item[data-v-df4567f8]{margin:10px 0}.user-item-row[data-v-df4567f8]{justify-content:space-between;align-items:center;display:flex}.user-item-row-center[data-v-df4567f8]{align-content:center;padding:0 10px}.user-name[data-v-df4567f8],.user-sign-text[data-v-df4567f8]{text-align:left}.user-sign-text[data-v-df4567f8]{color:#a2a2a2}.user-follow-btn[data-v-df4567f8]{float:right}.user-info[data-v-df4567f8]{display:grid}.user-item-row-left[data-v-df4567f8]{display:flex}.user-item-row-right[data-v-df4567f8]{float:right}.router-view-container[data-v-29990e55]{padding:20px}.router-view-container .layout-item[data-v-29990e55]{align-items:center;gap:10px;padding:10px 0;display:flex}.router-view-container .layout-icon img[data-v-29990e55]{width:100%;height:100%}.router-view-container .layout-text[data-v-29990e55]{flex:1}.post-list-item[data-v-449d5239]{--forum-icon-size:56px;border-bottom:5px solid #efefef;flex-direction:column;gap:10px;padding:10px 15px;display:flex}.post-list-item[data-v-449d5239]:last-child{border-bottom:0}.user-info[data-v-449d5239]{align-items:center;gap:5px;display:flex}.user-time[data-v-449d5239]{color:#999;font-size:.8em}.user-avatar img[data-v-449d5239]{border-radius:50%;width:35px;height:35px}.reply-content[data-v-449d5239]{color:#4a4a4a;font-size:.9em}.post-info[data-v-449d5239]{color:#434343;background-color:#efefef;border-radius:6px;align-items:center;display:flex}.post-info__inner[data-v-449d5239]{align-items:center;width:100%;padding:8px;display:flex}.post-content[data-v-449d5239]{line-clamp:2;-webkit-line-clamp:2;color:#545454;-webkit-box-orient:vertical;margin-left:5px;display:-webkit-box;overflow:hidden}.post-image[data-v-449d5239]{width:var(--forum-icon-size);height:var(--forum-icon-size)}.post-image img[data-v-449d5239]{width:inherit;height:inherit;border-radius:6px}.fname-text[data-v-449d5239]{color:#999}.bottom-msg[data-v-449d5239]{text-align:center;color:#999;padding:10px 0}.forum-name[data-v-449d5239]{color:#848691;font-size:14px;font-style:normal;font-weight:400;overflow:hidden}.post-list-item[data-v-ca89eb7d]{--forum-icon-size:56px;border-bottom:5px solid #efefef;flex-direction:column;gap:10px;padding:10px 15px;display:flex}.post-list-item .biao[data-v-ca89eb7d]{vertical-align:-10%;background:#eee;border-radius:4px;-ms-flex-negative:0;-webkit-flex-shrink:0;width:4px;height:16px;margin-right:5px;display:inline-block}.post-list-item[data-v-ca89eb7d]:last-child{border-bottom:0}.user-info[data-v-ca89eb7d]{align-items:center;gap:5px;display:flex}.user-time[data-v-ca89eb7d]{color:#999;font-size:.8em}.user-avatar img[data-v-ca89eb7d]{border-radius:50%;width:35px;height:35px}.reply-content p[data-v-ca89eb7d]{font-size:.9em}.reply-content .quote-user[data-v-ca89eb7d]{color:#848691;margin-top:2px;padding-left:4px}.post-info[data-v-ca89eb7d]{color:#434343;background-color:#efefef;border-radius:6px;align-items:center;display:flex}.post-info__inner[data-v-ca89eb7d]{align-items:center;width:100%;padding:8px;display:flex}.post-content[data-v-ca89eb7d]{line-clamp:2;-webkit-line-clamp:2;color:#545454;-webkit-box-orient:vertical;margin-left:5px;display:-webkit-box;overflow:hidden}.post-image[data-v-ca89eb7d]{width:var(--forum-icon-size);height:var(--forum-icon-size)}.post-image img[data-v-ca89eb7d]{width:inherit;height:inherit;border-radius:6px}.fname-text[data-v-ca89eb7d]{color:#999}.bottom-msg[data-v-ca89eb7d]{text-align:center;color:#999;padding:10px 0}.forum-name[data-v-ca89eb7d]{color:#848691;font-size:14px;font-style:normal;font-weight:400;overflow:hidden}.bottom-msg[data-v-47090b9c]{text-align:center;color:#999;padding:10px 0}.user-top[data-v-306ab0b3]{--el-header-height:40px;background:#fff;align-items:center;display:flex;position:fixed;top:0;left:0;right:0}.top-nav-container[data-v-306ab0b3]{align-items:center;width:100%}.top-title-name[data-v-306ab0b3]{text-align:center;position:absolute;left:50%;transform:translate(-50%)}.main[data-v-306ab0b3]{margin:40px 0 0;padding:0}#small-toolbar[data-v-6db624a6]{z-index:1000;background:#fff;align-items:center;width:100%;height:.56rem;display:flex;position:fixed;bottom:0}#small-toolbar .icon[data-v-6db624a6]{width:.2rem;height:.2rem}#small-toolbar #reply-editor[data-v-6db624a6]{flex:1}#small-toolbar .small-editor-toolbar[data-v-6db624a6]{flex:1;align-items:center;width:100%;margin:10px 15px;font-size:.16rem;line-height:.16rem;display:flex;position:relative}#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-6db624a6]{cursor:default;background:#e9e9e9;border:0;border-radius:.06rem;outline:none;width:100%;padding:.06rem;font-size:.14rem;line-height:.14rem}#small-toolbar .small-editor-toolbar .small-editor-toolbar-emoji-btn[data-v-6db624a6]{position:absolute;top:50%;right:.06rem;transform:translateY(-50%)}#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-6db624a6]:focus,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-6db624a6]:visited,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-6db624a6]:focus-within,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-6db624a6]:focus-visible{border:0;outline:none}#small-toolbar .gm-reply-other-toolbar[data-v-6db624a6]{flex:0 auto;align-items:safe center;display:flex}#small-toolbar .gm-reply-other-toolbar .reply-comment-count[data-v-6db624a6],#small-toolbar .gm-reply-other-toolbar .reply-good-count[data-v-6db624a6]{flex-direction:column;align-items:center;padding:8px;display:flex}#small-toolbar .gm-reply-other-toolbar .reply-comment-count p.text[data-v-6db624a6],#small-toolbar .gm-reply-other-toolbar .reply-good-count p.text[data-v-6db624a6]{font-size:.1rem}.tiptap p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#adb5bd;pointer-events:none;height:0}#reply-editor .tiptap{width:100%;height:100%;font-size:.16rem;outline:0!important}.tiptap-input-image{width:.18rem;height:.18rem}#reply-editor[data-v-5c00d425]{background-color:#e5e5e5;border-radius:5px;height:100%;padding:.06rem;overflow:auto}.icon-active[data-v-e3390787]{fill:#7557ff}#full-toolbar[data-v-e3390787]{z-index:100099;background:#fff;flex-flow:column;align-items:center;width:100%;display:flex;position:fixed;bottom:0}#full-toolbar .full-toolbar-top-reply-user[data-v-e3390787]{text-overflow:ellipsis;white-space:nowrap;color:#adb5bd;width:-webkit-fill-available;width:-moz-available;padding-top:.06rem;padding-left:.2rem;overflow:hidden}#full-toolbar .full-toolbar-top-container[data-v-e3390787]{width:-moz-available;align-items:end;width:-webkit-fill-available;height:.6rem;padding:.06rem .1rem;display:flex}#full-toolbar .full-toolbar-top-container .full-toolbar-top-left-container[data-v-e3390787]{flex-direction:column;flex:1;height:100%;margin:0 .1rem;display:flex;overflow:hidden}#full-toolbar .full-toolbar-top-container .full-toolbar-top-right-container[data-v-e3390787]{flex-direction:column;flex:0 auto;justify-content:space-between;align-items:center;height:100%;display:flex}#full-toolbar .full-toolbar-bottom-container[data-v-e3390787]{margin:.06rem auto .06rem 0;padding:0 0 .06rem}#full-toolbar .full-toolbar-bottom-container .full-toolbar-emoji-btn[data-v-e3390787],#full-toolbar .full-toolbar-bottom-container .full-toolbar-panel-at-btn[data-v-e3390787]{flex-direction:column;align-items:center;margin:0 20px;display:flex}#full-toolbar .emoji-panel[data-v-e3390787]{background-color:#efefef;width:100%;height:30vh;overflow:auto}.emoji-panel-huaji[data-v-e3390787]{padding:.03rem;overflow-y:auto}.emoji-panel-huaji .el-avatar[data-v-e3390787]{margin:16px}#full-toolbar[data-v-e3390787]:has(.full-toolbar-top-container[data-full=true]){height:100%;height:-webkit-fill-available}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-container[data-v-e3390787]{height:100%;height:-webkit-fill-available}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) #reply-editor[data-v-e3390787]{height:100%;height:-webkit-fill-available}:is(#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-reply-user[data-v-e3390787],#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-right-container[data-v-e3390787]){display:none}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-container[data-v-e3390787]{flex-direction:column}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-left-container[data-v-e3390787]{width:-webkit-fill-available;width:-moz-available}.full-toolbar-top-nav-container[data-v-e3390787]{width:-webkit-fill-available;justify-content:space-between;align-items:center;width:-moz-available;padding:.16rem;display:flex}#full-toolbar .full-toolbar-top-container{max-height:calc(100vh - .12rem - 40px)}#full-toolbar[data-show-bottom-panel=true] .full-toolbar-top-container{max-height:calc(70vh - .12rem - 40px)}\n/*$vite$:1*/ '
);
__commonJSMin((exports, module) => {
init__virtual_monkey_css();
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJSMin = (cb, mod) => () => (
mod || (cb((mod = { exports: {} }).exports, mod), (cb = null)),
mod.exports
);
var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === "object") || typeof from === "function")
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
isNodeMode || !mod || !mod.__esModule
? __defProp(target, "default", {
value: mod,
enumerable: true,
})
: target,
mod
)
);
var _GM_addValueChangeListener =
typeof GM_addValueChangeListener != "undefined" ? GM_addValueChangeListener : void 0;
var _GM_deleteValue = typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0;
var _GM_getResourceText = typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0;
var _GM_getValue = typeof GM_getValue != "undefined" ? GM_getValue : void 0;
var _GM_info = typeof GM_info != "undefined" ? GM_info : void 0;
var _GM_listValues = typeof GM_listValues != "undefined" ? GM_listValues : void 0;
var _GM_registerMenuCommand = typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0;
var _GM_removeValueChangeListener =
typeof GM_removeValueChangeListener != "undefined" ? GM_removeValueChangeListener : void 0;
var _GM_setValue = typeof GM_setValue != "undefined" ? GM_setValue : void 0;
var _GM_setValues = typeof GM_setValues != "undefined" ? GM_setValues : void 0;
var _GM_unregisterMenuCommand = typeof GM_unregisterMenuCommand != "undefined" ? GM_unregisterMenuCommand : void 0;
var _GM_xmlhttpRequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0;
var _unsafeWindow = typeof unsafeWindow != "undefined" ? unsafeWindow : void 0;
var _monkeyWindow = window;
var GM_RESOURCE_MAPPING = {
ElementPlus: {
keyName: "ElementPlusResourceCSS",
url: "https://fastly.jsdelivr.net/npm/element-plus@latest/dist/index.min.css",
},
Viewer: {
keyName: "ViewerCSS",
url: "https://fastly.jsdelivr.net/npm/viewerjs@latest/dist/viewer.min.css",
},
Hljs: {
keyName: "HljsCSS",
url: "https://fastly.jsdelivr.net/npm/highlight.js@latest/styles/github-dark.min.css",
},
};
var PanelSettingConfig = {
qmsg_config_position: {
key: "qmsg-config-position",
defaultValue: "bottom",
},
qmsg_config_maxnums: {
key: "qmsg-config-maxnums",
defaultValue: 3,
},
qmsg_config_showreverse: {
key: "qmsg-config-showreverse",
defaultValue: false,
},
httpx_cookie_manager_enable: {
key: "httpx-use-cookie-enable",
defaultValue: false,
},
httpx_cookie_manager_use_document_cookie: {
key: "httpx-use-document-cookie",
defaultValue: false,
},
};
var CommonUtil = {
waitRemove(...args) {
args.forEach((selector) => {
if (typeof selector !== "string") return;
_whitesev_domutils.default.waitNodeList(selector).then((nodeList) => {
nodeList.forEach(($el) => $el.remove());
});
});
},
createBlockCSSNode(...args) {
let selectorList = [];
if (args.length === 0) return;
if (args.length === 1 && typeof args[0] === "string" && args[0].trim() === "") return;
args.forEach((selector) => {
if (Array.isArray(selector)) selectorList = selectorList.concat(selector);
else selectorList.push(selector);
});
return _whitesev_domutils.default.createElement("style", {
type: "text/css",
innerHTML: `${selectorList.join(",\n")}{display: none !important;}`,
});
},
addBlockCSS(...args) {
let selectorList = [];
if (args.length === 0) return;
if (args.length === 1 && typeof args[0] === "string" && args[0].trim() === "") return;
args.forEach((selector) => {
if (Array.isArray(selector)) selectorList = selectorList.concat(selector);
else selectorList.push(selector);
});
selectorList = selectorList.map((it) => it.trim()).filter((it) => it !== "");
if (selectorList.length) return addStyle$1(`${selectorList.join(",\n")}{display: none !important;}`);
},
setGMResourceCSS(resourceMapData) {
const cssText = typeof _GM_getResourceText === "function" ? _GM_getResourceText(resourceMapData.keyName) : null;
if (typeof cssText === "string" && cssText) return addStyle$1(cssText);
else return CommonUtil.loadStyleLink(resourceMapData.url);
},
async loadStyleLink(url) {
let $link = document.createElement("link");
$link.rel = "stylesheet";
$link.type = "text/css";
$link.href = url;
return new Promise((resolve) => {
_whitesev_domutils.default.onReady(() => {
document.head.appendChild($link);
resolve($link);
});
});
},
async loadScript(url) {
let $script = document.createElement("script");
$script.src = url;
return new Promise((resolve) => {
$script.onload = () => {
resolve(null);
};
(document.head || document.documentElement).appendChild($script);
});
},
fixUrl(url) {
url = url.trim();
if (url.startsWith("data:")) return url;
if (url.match(/^http(s|):\/\//i)) return url;
else if (url.startsWith("//")) {
if (url.startsWith("///")) {
} else url = window.location.protocol + url;
return url;
} else {
if (!url.startsWith("/")) url += "/";
url = window.location.origin + url;
return url;
}
},
fixHttps(url) {
if (url.startsWith("https://")) return url;
if (!url.startsWith("http://")) return url;
try {
let urlInstance = new URL(url);
urlInstance.protocol = "https:";
return urlInstance.toString();
} catch {
return url;
}
},
lockScroll(...args) {
let $hidden = document.createElement("style");
$hidden.innerHTML = `
.pops-overflow-hidden-important {
overflow: hidden !important;
}
`;
let $elList = [document.documentElement, document.body].concat(...(args || []));
$elList.forEach(($el) => {
$el.classList.add("pops-overflow-hidden-important");
});
(document.head || document.documentElement).appendChild($hidden);
return {
recovery() {
$elList.forEach(($el) => {
$el.classList.remove("pops-overflow-hidden-important");
});
$hidden.remove();
},
};
},
async getClipboardText() {
function readClipboardText(resolve) {
navigator.clipboard
.readText()
.then((clipboardText) => {
resolve(clipboardText);
})
.catch((error) => {
log.error("读取剪贴板内容失败👉", error);
resolve("");
});
}
function requestPermissionsWithClipboard(resolve) {
navigator.permissions
.query({ name: "clipboard-read" })
.then(() => {
readClipboardText(resolve);
})
.catch((error) => {
log.error("申请剪贴板权限失败,尝试直接读取👉", error.message ?? error.name ?? error.stack);
readClipboardText(resolve);
});
}
function checkClipboardApi() {
if (typeof navigator?.clipboard?.readText !== "function") return false;
if (typeof navigator?.permissions?.query !== "function") return false;
return true;
}
return new Promise((resolve) => {
if (!checkClipboardApi()) {
resolve("");
return;
}
if (document.hasFocus()) requestPermissionsWithClipboard(resolve);
else
window.addEventListener(
"focus",
() => {
requestPermissionsWithClipboard(resolve);
},
{ once: true }
);
});
},
escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(//g, ">")
.replace(/"/g, """)
.replace(/'/g, "'")
.replace(/©/g, "©")
.replace(/®/g, "®")
.replace(/™/g, "™")
.replace(/→/g, "→")
.replace(/←/g, "←")
.replace(/↑/g, "↑")
.replace(/↓/g, "↓")
.replace(/—/g, "—")
.replace(/–/g, "–")
.replace(/…/g, "…")
.replace(/ /g, " ")
.replace(/\r\n/g, "
")
.replace(/\r/g, "
")
.replace(/\n/g, "
")
.replace(/\t/g, " ");
},
interval(fn, intervalTime, timeout = 5e3) {
let timeId;
let maxTimeout = timeout - intervalTime;
let intervalTimeCount = intervalTime;
let loop = async (isTimeout) => {
const result = await fn(isTimeout);
if ((typeof result === "boolean" && result) || isTimeout) {
utils.workerClearTimeout(timeId);
return;
}
intervalTimeCount += intervalTime;
if (intervalTimeCount > maxTimeout) {
loop(true);
return;
}
timeId = utils.workerSetTimeout(() => {
loop(false);
}, intervalTime);
};
loop(false);
},
findParentNode($el, selector, parentSelector) {
if (parentSelector) {
let $parent = _whitesev_domutils.default.closest($el, parentSelector);
if ($parent) return $parent.querySelector(selector);
} else {
if (_whitesev_domutils.default.matches($el, selector)) return $el;
return _whitesev_domutils.default.closest($el, selector);
}
},
toStr(data, space = 2) {
const undefinedReplacedStr = `__undefined__placeholder__replaced__str__` + performance.now();
return JSON.stringify(
data,
(key, value) => {
return value === void 0 ? undefinedReplacedStr : value;
},
space
).replace(new RegExp(`"${undefinedReplacedStr}"`, "g"), "undefined");
},
isVerticalScreen() {
return !globalThis.screen.orientation.type.includes("landscape");
},
isMobileDevice(size = 768) {
if (this.isVerticalScreen()) return globalThis.innerWidth < size;
else return globalThis.innerHeight < size;
},
isTopWindow() {
const win = typeof _unsafeWindow === "object" && _unsafeWindow != null ? _unsafeWindow : window;
return win.top === win.self;
},
formatVideoDuration(duration) {
if (typeof duration !== "number") duration = parseInt(duration);
if (isNaN(duration)) return duration.toString();
const zeroPadding = function (num) {
if (num < 10) return `0${num}`;
else return num;
};
if (duration < 60) return `0:${zeroPadding(duration)}`;
else if (duration >= 60 && duration < 3600) return `${Math.floor(duration / 60)}:${zeroPadding(duration % 60)}`;
else {
const hours = Math.floor(duration / 3600);
const minutes = Math.floor(duration / 60) % 60;
const seconds = duration % 60;
return `${hours}:${zeroPadding(minutes)}:${zeroPadding(seconds)}`;
}
},
formatTimeStamp(time, endTime) {
if (typeof time === "number") {
if (time < 0xe8d4a51000) {
const padZeroLength = String(Date.now()).length - String(time).length;
time = time * Math.pow(10, padZeroLength);
}
}
let result = time;
let oldTime = new Date(typeof time === "string" ? time.replace(/-/g, "/") : time);
let timeDifference = new Date(endTime ?? Date.now()).getTime() - oldTime.getTime();
let days = Math.floor(timeDifference / (24 * 3600 * 1e3));
if (days > 0)
if (days > 7) result = utils.formatTime(oldTime.getTime());
else result = days + "天前";
else {
let leave1 = timeDifference % (24 * 3600 * 1e3);
let hours = Math.floor(leave1 / (3600 * 1e3));
if (hours > 0) result = hours + "小时前";
else {
let leave2 = leave1 % (3600 * 1e3);
let minutes = Math.floor(leave2 / (60 * 1e3));
if (minutes > 0) result = minutes + "分钟前";
else {
let leave3 = leave2 % (60 * 1e3);
result = Math.round(leave3 / 1e3) + "秒前";
}
}
}
return result;
},
};
var utils = _whitesev_utils.default.noConflict();
var domUtils = _whitesev_domutils.default.noConflict();
var __pops__ = _whitesev_pops.default;
var log = new utils.Log(_GM_info, _unsafeWindow.console || _monkeyWindow.console);
var SCRIPT_NAME = _GM_info?.script?.name || void 0;
var AnyTouch = _whitesev_pops.default.fn.Utils.AnyTouch();
log.config({
debug: false,
logMaxCount: 250,
autoClearConsole: true,
tag: true,
});
var getPageMaxZIndex = () => {
const deviation = 100;
const popsZIndex = _whitesev_pops.default.fn.InstanceUtils.getPopsMaxZIndex()?.zIndex ?? 0;
const pointZIndex = utils.getMaxZIndexNodeInfoFromPoint()[0]?.zIndex ?? 0;
return Math.max(deviation, popsZIndex, pointZIndex);
};
qmsg.default.config({
isHTML: true,
autoClose: true,
showClose: false,
consoleLogContent(qmsgInst) {
const qmsgType = qmsgInst.setting.type;
if (qmsgType === "loading") return false;
const content = qmsgInst.setting.content;
if (qmsgType === "warning") log.warn(content);
else if (qmsgType === "error") log.error(content);
else log.info(content);
return false;
},
get position() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_position.key,
PanelSettingConfig.qmsg_config_position.defaultValue
);
},
get maxNums() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_maxnums.key,
PanelSettingConfig.qmsg_config_maxnums.defaultValue
);
},
get showReverse() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_showreverse.key,
PanelSettingConfig.qmsg_config_showreverse.defaultValue
);
},
get zIndex() {
return getPageMaxZIndex();
},
});
__pops__.GlobalConfig.setGlobalConfig({
zIndex: () => {
return getPageMaxZIndex();
},
mask: {
enable: true,
clickEvent: {
toClose: false,
toHide: false,
},
},
drag: true,
});
var MenuRegister = new utils.GM_Menu({
GM_getValue: _GM_getValue,
GM_setValue: _GM_setValue,
GM_registerMenuCommand: _GM_registerMenuCommand,
GM_unregisterMenuCommand: _GM_unregisterMenuCommand,
});
var httpx = new utils.Httpx({
xmlHttpRequest: _GM_xmlhttpRequest,
logDetails: false,
});
httpx.interceptors.request.use((data) => {
return data;
});
httpx.interceptors.response.use(
(response) => {
return response;
},
(data) => {
log.error("[Httpx-HttpxRequest.response] 响应错误", { data });
if (data.type === "onabort") qmsg.default.warning("请求取消", { consoleLogContent: true });
else if (data.type === "onerror") qmsg.default.error("请求异常", { consoleLogContent: true });
else if (data.type === "ontimeout") qmsg.default.error("请求超时", { consoleLogContent: true });
else qmsg.default.error("其它错误", { consoleLogContent: true });
return data;
}
);
var OriginPrototype = {
Object: {
defineProperty: _unsafeWindow.Object.defineProperty,
keys: _unsafeWindow.Object.keys,
values: _unsafeWindow.Object.values,
},
Function: {
apply: _unsafeWindow.Function.prototype.apply,
call: _unsafeWindow.Function.prototype.call,
},
Element: { appendChild: _unsafeWindow.Element.prototype.appendChild },
setTimeout: _unsafeWindow.setTimeout.bind(_unsafeWindow),
clearTimeout: _unsafeWindow.clearTimeout.bind(_unsafeWindow),
setInterval: _unsafeWindow.setInterval.bind(_unsafeWindow),
clearInterval: _unsafeWindow.clearInterval.bind(_unsafeWindow),
};
var addStyle$1 = domUtils.addStyle.bind(domUtils);
CommonUtil.addBlockCSS.bind(CommonUtil);
var $ = _whitesev_domutils.default.selector.bind(_whitesev_domutils.default);
var $$ = _whitesev_domutils.default.selectorAll.bind(_whitesev_domutils.default);
var VUE_ROOT_ID = "vite-app";
var MountVue = async function (rootComponent, plugins = []) {
CommonUtil.setGMResourceCSS(GM_RESOURCE_MAPPING.ElementPlus);
await _whitesev_domutils.default.onReady();
const app = (0, vue.createApp)(rootComponent);
const $mount = _whitesev_domutils.default.createElement("div", { id: VUE_ROOT_ID });
if (ElementPlusIconsVue != null)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) app.component(key, component);
document.body.appendChild($mount);
plugins.forEach((item) => {
app.use(item);
});
return app.mount($mount);
};
var cookieManager = new utils.CookieManagerService({ baseCookieHandler: "GM_cookie" });
if (!cookieManager.isSupportGM_cookie)
if (cookieManager.isSupportCookieStore) cookieManager.setOptions({ baseCookieHandler: "cookieStore" });
else cookieManager.setOptions({ baseCookieHandler: "document.cookie" });
new utils.DocumentCookieHandler();
var KEY = "GM_Panel";
var ATTRIBUTE_INIT = "data-init";
var ATTRIBUTE_KEY = "data-key";
var ATTRIBUTE_DEFAULT_VALUE = "data-default-value";
var ATTRIBUTE_INIT_MORE_VALUE = "data-init-more-value";
var ATTRIBUTE_PLUGIN_SEARCH_CONFIG = "data-plugin-search-config";
var PROPS_STORAGE_API = "data-storage-api";
var PanelSizeUtil = {
followBrowserSize: false,
get width() {
return PanelSizeUtil.followBrowserSize ? globalThis.outerWidth : globalThis.innerWidth;
},
get height() {
return PanelSizeUtil.followBrowserSize ? globalThis.outerHeight : globalThis.innerHeight;
},
};
var PanelUISize = {
setting: {
get width() {
if (PanelSizeUtil.width < 550) return "88vw";
else if (PanelSizeUtil.width < 700) return "550px";
else return "700px";
},
get height() {
if (PanelSizeUtil.height < 450) return "70vh";
else if (PanelSizeUtil.height < 550) return "450px";
else return "550px";
},
},
settingMiddle: {
get width() {
return PanelSizeUtil.width < 350 ? "88vw" : "350px";
},
get height() {
return PanelSizeUtil.height < 450 ? "88vh" : "450px";
},
},
settingBig: {
get width() {
return PanelSizeUtil.width < 800 ? "92vw" : "800px";
},
get height() {
return PanelSizeUtil.height < 600 ? "80vh" : "600px";
},
},
info: {
get width() {
return PanelSizeUtil.width < 350 ? "88vw" : "350px";
},
get height() {
return PanelSizeUtil.height < 250 ? "88vh" : "250px";
},
},
};
var PanelContent = {
$data: {
__contentConfig: null,
get contentConfig() {
if (this.__contentConfig == null) this.__contentConfig = new utils.Dictionary();
return this.__contentConfig;
},
__defaultBottomContentConfig: [],
},
addContentConfig(configList) {
if (!Array.isArray(configList)) configList = [configList];
let index = this.$data.contentConfig.keys().length;
this.$data.contentConfig.set(index, configList);
},
getAllContentConfig() {
return this.$data.contentConfig.values().flat();
},
getConfig(index = 0) {
return this.$data.contentConfig.get(index) ?? [];
},
getDefaultBottomContentConfig(config) {
if (this.$data.__defaultBottomContentConfig.length) return this.$data.__defaultBottomContentConfig;
let isDoubleClick = false;
let timer = void 0;
const translateCallback = (text, translateMap) => {
if (config && typeof config.translateCallback === "function")
return config.translateCallback(text, translateMap);
else {
if (typeof translateMap === "object" && translateMap)
for (const key in translateMap) text = text.replaceAll(`{{${key}}}`, translateMap[key]);
return text;
}
};
const exportToFile = (fileName, fileData) => {
if (typeof fileData !== "string") fileData = CommonUtil.toStr(fileData);
const blob = new Blob([fileData]);
const blobUrl = globalThis.URL.createObjectURL(blob);
domUtils
.createElement("a", {
href: blobUrl,
download: fileName,
})
.click();
utils.workerSetTimeout(() => {
globalThis.URL.revokeObjectURL(blobUrl);
}, 500);
};
const dbclick_callback = () => {
const importConfig = (importEndCallBack) => {
const $alert = __pops__.alert({
title: {
text: translateCallback("请选择导入方式"),
position: "center",
},
content: {
text: `
${translateCallback("本地导入")}
${translateCallback("网络导入")}
${translateCallback("剪贴板导入")}
`,
html: true,
},
btn: {
ok: { enable: false },
close: {
enable: true,
callback(details) {
details.close();
},
},
},
drag: true,
mask: { enable: true },
width: PanelUISize.info.width,
height: PanelUISize.info.height,
style: `
.btn-control{
display: inline-block;
margin: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
cursor: pointer;
}
.btn-control:hover{
color: #409eff;
border-color: #c6e2ff;
background-color: #ecf5ff;
}`,
});
const $local = $alert.$shadowRoot.querySelector(".btn-control[data-mode='local']");
const $network = $alert.$shadowRoot.querySelector(".btn-control[data-mode='network']");
const $clipboard = $alert.$shadowRoot.querySelector(".btn-control[data-mode='clipboard']");
const updateConfigToStorage = async (data) => {
if (confirm(translateCallback("是否清空脚本存储的配置?(如果点击取消按钮,则仅做配置覆盖处理)")))
if (typeof _GM_listValues === "function")
if (typeof _GM_deleteValue === "function") {
_GM_listValues().forEach((key) => {
_GM_deleteValue(key);
});
qmsg.default.success(translateCallback("已清空脚本存储的配置"));
} else qmsg.default.error(translateCallback("不支持GM_deleteValue函数,无法执行删除脚本配置"));
else qmsg.default.error(translateCallback("不支持GM_listValues函数,无法清空脚本存储的配置"));
if (typeof _GM_setValues === "function") _GM_setValues(data);
else
Object.keys(data).forEach((key) => {
const value = data[key];
_GM_setValue(key, value);
});
qmsg.default.success(translateCallback("配置导入完毕"));
importEndCallBack?.();
};
const importFile = (configText) => {
return new Promise(async (resolve) => {
const data = utils.toJSON(configText);
if (Object.keys(data).length === 0) qmsg.default.warning(translateCallback("解析为空配置,不导入"));
else await updateConfigToStorage(data);
resolve(true);
});
};
domUtils.on($local, "click", (event) => {
domUtils.preventEvent(event);
$alert.close();
const $input = domUtils.createElement("input", {
type: "file",
accept: ".json",
});
domUtils.on($input, ["propertychange", "input"], () => {
if (!$input.files?.length) return;
const uploadFile = $input.files[0];
const fileReader = new FileReader();
fileReader.onload = () => {
importFile(fileReader.result);
};
fileReader.readAsText(uploadFile, "UTF-8");
});
$input.click();
});
domUtils.on($network, "click", (event) => {
domUtils.preventEvent(event);
$alert.close();
const $prompt = __pops__.prompt({
title: {
text: translateCallback("网络导入"),
position: "center",
},
content: {
text: "",
placeholder: translateCallback("请填写URL"),
focus: true,
},
btn: {
close: {
enable: true,
callback(details) {
details.close();
},
},
ok: {
text: translateCallback("导入"),
callback: async (details) => {
const url = details.text;
if (utils.isNull(url)) {
qmsg.default.error(translateCallback("请填入完整的url"));
return;
}
const $loading = qmsg.default.loading(translateCallback("正在获取配置..."));
const response = await httpx.get(url, { allowInterceptConfig: false });
$loading.close();
if (!response.status) {
log.error(response);
qmsg.default.error(translateCallback("获取配置失败"), { consoleLogContent: true });
return;
}
if (!(await importFile(response.data.responseText))) return;
details.close();
},
},
cancel: { enable: false },
},
drag: true,
mask: { enable: true },
width: PanelUISize.info.width,
height: "auto",
});
const $promptInput = $prompt.$shadowRoot.querySelector("input");
const $promptOk = $prompt.$shadowRoot.querySelector(".pops-prompt-btn-ok");
domUtils.on($promptInput, ["input", "propertychange"], () => {
if (domUtils.val($promptInput) === "") domUtils.attr($promptOk, "disabled", "true");
else domUtils.removeAttr($promptOk, "disabled");
});
domUtils.onKeyboard($promptInput, "keydown", (keyName, keyValue, otherCodeList) => {
if (keyName === "Enter" && otherCodeList.length === 0) {
if (domUtils.val($promptInput) !== "") domUtils.emit($promptOk, "click");
}
});
domUtils.emit($promptInput, "input");
});
domUtils.on($clipboard, "click", async (event) => {
domUtils.preventEvent(event);
$alert.close();
let clipboardText = await CommonUtil.getClipboardText();
if (clipboardText.trim() === "") {
qmsg.default.warning(translateCallback("获取到的剪贴板内容为空"));
return;
}
if (!(await importFile(clipboardText))) return;
});
};
const exportConfig = (
fileName = `${SCRIPT_NAME}_panel-setting-${utils.formatTime(Date.now(), "yyyy_MM_dd_HH_mm_ss")}.json`,
fileData
) => {
const $alert = __pops__.alert({
title: {
text: translateCallback("请选择导出方式"),
position: "center",
},
content: {
text: `
${translateCallback("导出至文件")}
${translateCallback("导出至剪贴板")}
`,
html: true,
},
btn: {
ok: { enable: false },
close: {
enable: true,
callback(details) {
details.close();
},
},
},
drag: true,
mask: { enable: true },
width: PanelUISize.info.width,
height: PanelUISize.info.height,
style: `
.btn-control{
display: inline-block;
margin: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
cursor: pointer;
}
.btn-control:hover{
color: #409eff;
border-color: #c6e2ff;
background-color: #ecf5ff;
}`,
});
const $exportToFile = $alert.$shadowRoot.querySelector(".btn-control[data-mode='export-to-file']");
const $exportToClipboard = $alert.$shadowRoot.querySelector(
".btn-control[data-mode='export-to-clipboard']"
);
domUtils.on($exportToFile, "click", (event) => {
domUtils.preventEvent(event);
try {
exportToFile(fileName, fileData);
$alert.close();
} catch (error) {
qmsg.default.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.on($exportToClipboard, "click", async () => {
if (await utils.copy(fileData)) {
qmsg.default.success(translateCallback("复制成功"));
$alert.close();
} else qmsg.default.error(translateCallback("复制失败"));
});
};
const $textarea = __pops__
.confirm({
title: {
text: translateCallback("配置"),
position: "center",
},
content: {
text: ``,
html: true,
},
btn: {
ok: {
enable: true,
type: "primary",
text: translateCallback("导入"),
callback() {
importConfig();
},
},
cancel: {
enable: true,
text: translateCallback("导出"),
callback() {
exportConfig(void 0, configDataStr);
},
},
},
width: PanelSizeUtil.width < 450 ? "90vw" : "450px",
height: "auto",
style: `
.pops-content textarea {
--textarea-bd-color: #dcdfe6;
display: inline-block;
resize: vertical;
padding: 5px 15px;
margin: 0;
line-height: normal;
box-sizing: border-box;
color: #606266;
border: 0;
border-radius: 0;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: none;
width: 100%;
height: 100%;
appearance: none;
resize: none;
}
.pops-content textarea{
height: 500px;
}
.pops-content textarea:focus {
--textarea-bd-color: #3677f0;
}
.pops-content textarea:hover {
--textarea-bd-color: #c0c4cc;
}
`,
})
.$shadowRoot.querySelector("textarea");
const configData = {};
if (typeof _GM_listValues === "function")
_GM_listValues().forEach((key) => {
const value = _GM_getValue(key);
Reflect.set(configData, key, value);
});
else {
qmsg.default.warning(translateCallback("不支持函数GM_listValues,仅导出菜单配置"));
const panelLocalValue = _GM_getValue(KEY);
Reflect.set(configData, KEY, panelLocalValue);
}
const configDataStr = CommonUtil.toStr(configData);
$textarea.value = configDataStr;
};
const click_callback = () => {
let supportURL = _GM_info?.script?.supportURL || _GM_info?.script?.namespace;
if (typeof supportURL === "string" && utils.isNotNull(supportURL)) window.open(supportURL, "_blank");
};
return [
{
id: "script-version",
title: translateCallback(`版本:{{version}}`, {
version: _GM_info?.script?.version || translateCallback("未知"),
}),
isBottom: true,
views: [],
clickFirstCallback() {
return false;
},
afterRender(config) {
new AnyTouch(config.$asideLiElement).on("tap", function () {
clearTimeout(timer);
timer = void 0;
if (isDoubleClick) {
isDoubleClick = false;
dbclick_callback();
} else {
timer = setTimeout(() => {
isDoubleClick = false;
click_callback();
}, 200);
isDoubleClick = true;
}
});
},
},
];
},
setDefaultBottomContentConfig(config) {
this.$data.__defaultBottomContentConfig = config;
},
};
var PanelMenu = {
$data: {
__menuOption: [
{
key: "show_pops_panel_setting",
text: "⚙ 设置",
autoReload: false,
isStoreValue: false,
showText(text) {
return text;
},
callback: () => {
Panel.showPanel(PanelContent.getConfig(0));
},
},
],
get menuOption() {
return this.__menuOption;
},
},
init() {
this.initExtensionsMenu();
},
initExtensionsMenu() {
if (!CommonUtil.isTopWindow()) return;
MenuRegister.add(this.$data.menuOption);
},
addMenuOption(option) {
if (!Array.isArray(option)) option = [option];
this.$data.menuOption.push(...option);
},
updateMenuOption(option) {
if (!Array.isArray(option)) option = [option];
option.forEach((optionItem) => {
let findIndex = this.$data.menuOption.findIndex((it) => {
return it.key === optionItem.key;
});
if (findIndex !== -1) this.$data.menuOption[findIndex] = optionItem;
});
},
getMenuOption(index = 0) {
return this.$data.menuOption[index];
},
deleteMenuOption(index = 0) {
this.$data.menuOption.splice(index, 1);
},
};
var PanelMenuResultsHandler = class {
data = {
storeNodeList: [],
destoryFnList: [],
};
option = {};
constructor(option) {
this.option = option;
}
handlerResult(enableValue, args) {
const dynamicMenuStoreNodeList = [];
const dynamicDestoryFnList = [];
let resultValueList = [];
if (Array.isArray(args)) resultValueList = resultValueList.concat(args);
else {
const handleArgs = (obj) => {
if (typeof obj === "object" && obj != null)
if (obj instanceof Element) resultValueList.push(obj);
else if (Array.isArray(obj)) handleArgs(obj);
else {
const { $css, destory } = obj;
if ($css != null) {
if (Array.isArray($css)) resultValueList = resultValueList.concat($css);
else if ($css instanceof Element) resultValueList.push($css);
}
if (typeof destory === "function") resultValueList.push(destory);
}
else resultValueList.push(obj);
};
handleArgs(args);
}
const handleResult = (it) => {
if (it == null) return;
if (it instanceof Element) {
dynamicMenuStoreNodeList.push(it);
return;
}
if (typeof it === "function") {
dynamicDestoryFnList.push(it);
return;
}
};
for (const it of resultValueList) {
const flag = handleResult(it);
if (typeof flag === "boolean" && !flag) break;
if (Array.isArray(it))
for (const it2 of it) {
const flag2 = handleResult(it2);
if (typeof flag2 === "boolean" && !flag2) break;
}
}
this.clearStoreNodeList();
this.execDestoryFnAndClear();
if (enableValue) {
this.data.storeNodeList = this.data.storeNodeList.concat(dynamicMenuStoreNodeList);
this.data.destoryFnList = this.data.destoryFnList.concat(dynamicDestoryFnList);
}
}
getEnableStatus(key) {
const value = this.option.getValue(key);
return Boolean(value);
}
clearStoreNodeList = () => {
for (let index = this.data.storeNodeList.length - 1; index >= 0; index--) {
this.data.storeNodeList[index]?.remove();
this.data.storeNodeList.splice(index, 1);
}
};
execDestoryFnAndClear = () => {
for (let index = this.data.destoryFnList.length - 1; index >= 0; index--) {
const destoryFnItem = this.data.destoryFnList[index];
destoryFnItem();
this.data.destoryFnList.splice(index, 1);
}
};
checkMenuExec() {
let flag = false;
if (typeof this.option.checkExec === "function") flag = this.option.checkExec(this.option.keyList);
else flag = this.option.keyList.every((key) => this.getEnableStatus(key));
return flag;
}
};
var StorageUtils = class {
storageKey;
listenerData;
cacheData;
callbacks = [];
constructor(key) {
if (typeof key === "string") {
const trimKey = key.trim();
if (trimKey == "") throw new Error("key can not be empty string");
this.storageKey = trimKey;
} else throw new TypeError("key must be a string");
this.listenerData = new _whitesev_utils.default.Dictionary();
this.getLocalValue = this.getLocalValue.bind(this);
this.setLocalValue = this.setLocalValue.bind(this);
this.destory = this.destory.bind(this);
this.set = this.set.bind(this);
this.get = this.get.bind(this);
this.getAll = this.getAll.bind(this);
this.delete = this.delete.bind(this);
this.has = this.has.bind(this);
this.keys = this.keys.bind(this);
this.values = this.values.bind(this);
this.clear = this.clear.bind(this);
this.addValueChangeListener = this.addValueChangeListener.bind(this);
this.removeValueChangeListener = this.removeValueChangeListener.bind(this);
this.emitValueChangeListener = this.emitValueChangeListener.bind(this);
}
[Symbol.dispose]() {
this.destory();
}
async [Symbol.asyncDispose]() {
this.destory();
}
destory() {
this.cacheData = null;
for (let index = this.callbacks.length - 1; index >= 0; index--) {
const cb = this.callbacks[index];
cb();
this.callbacks.splice(index, 1);
}
}
getLocalValue() {
if (this.cacheData == null) {
let localValue = _GM_getValue(this.storageKey);
if (localValue == null) {
localValue = {};
this.setLocalValue(localValue);
}
this.destory();
this.cacheData = localValue;
const listenerId = _GM_addValueChangeListener(this.storageKey, (name, oldValue, newValue) => {
this.cacheData = null;
this.cacheData = newValue;
});
this.callbacks.push(() => {
_GM_removeValueChangeListener(listenerId);
});
return localValue;
} else return this.cacheData;
}
setLocalValue(value) {
this.cacheData = null;
this.cacheData = value;
_GM_setValue(this.storageKey, value);
}
set(key, value) {
const oldValue = this.get(key);
const localValue = this.getLocalValue();
Reflect.set(localValue, key, value);
this.setLocalValue(localValue);
this.emitValueChangeListener(key, value, oldValue);
}
get(key, defaultValue) {
const localValue = this.getLocalValue();
return Reflect.get(localValue, key) ?? defaultValue;
}
getAll() {
return this.getLocalValue();
}
delete(key) {
const oldValue = this.get(key);
const localValue = this.getLocalValue();
Reflect.deleteProperty(localValue, key);
this.setLocalValue(localValue);
this.emitValueChangeListener(key, void 0, oldValue);
}
has(key) {
const localValue = this.getLocalValue();
return Reflect.has(localValue, key);
}
keys() {
const localValue = this.getLocalValue();
return Reflect.ownKeys(localValue);
}
values() {
const localValue = this.getLocalValue();
return Reflect.ownKeys(localValue).map((key) => Reflect.get(localValue, key));
}
clear() {
this.destory();
_GM_deleteValue(this.storageKey);
}
addValueChangeListener(key, callback) {
const listenerId = Math.random();
const listenerData = this.listenerData.get(key) || [];
listenerData.push({
id: listenerId,
key,
callback,
});
this.listenerData.set(key, listenerData);
return listenerId;
}
removeValueChangeListener(listenerId) {
let flag = false;
for (const [key, listenerData] of this.listenerData.entries()) {
for (let index = 0; index < listenerData.length; index++) {
const value = listenerData[index];
if (
(typeof listenerId === "string" && value.key === listenerId) ||
(typeof listenerId === "number" && value.id === listenerId)
) {
listenerData.splice(index, 1);
index--;
flag = true;
}
}
this.listenerData.set(key, listenerData);
}
return flag;
}
async emitValueChangeListener(...args) {
const [key, newValue, oldValue] = args;
if (!this.listenerData.has(key)) return;
const listenerData = this.listenerData.get(key);
for (let index = 0; index < listenerData.length; index++) {
const data = listenerData[index];
if (typeof data.callback === "function") {
let __newValue;
let __oldValue;
if (args.length === 1) {
} else if (args.length === 2) __newValue = newValue;
else if (args.length === 3) {
__newValue = newValue;
__oldValue = oldValue;
}
await data.callback(key, __newValue, __oldValue);
}
}
}
};
var PopsPanelStorageApi = new StorageUtils(KEY);
var Panel = {
$data: {
__contentConfigInitDefaultValue: null,
__onceExecMenuData: null,
__urlChangeReloadMenuExecOnce: null,
__onceExecData: null,
__panelConfig: {},
$panel: null,
panelContent: [],
get contentConfigInitDefaultValue() {
if (this.__contentConfigInitDefaultValue == null)
this.__contentConfigInitDefaultValue = new utils.Dictionary();
return this.__contentConfigInitDefaultValue;
},
contentConfigInitDisabledKeys: [],
get onceExecMenuData() {
if (this.__onceExecMenuData == null) this.__onceExecMenuData = new utils.Dictionary();
return this.__onceExecMenuData;
},
get urlChangeReloadMenuExecOnce() {
if (this.__urlChangeReloadMenuExecOnce == null) this.__urlChangeReloadMenuExecOnce = new utils.Dictionary();
return this.__urlChangeReloadMenuExecOnce;
},
get onceExecData() {
if (this.__onceExecData == null) this.__onceExecData = new utils.Dictionary();
return this.__onceExecData;
},
get scriptName() {
return SCRIPT_NAME;
},
get panelConfig() {
return this.__panelConfig;
},
set panelConfig(value) {
this.__panelConfig = value;
},
key: KEY,
attributeKeyName: ATTRIBUTE_KEY,
attributeDefaultValueName: ATTRIBUTE_DEFAULT_VALUE,
},
init() {
this.initContentDefaultValue();
PanelMenu.init();
},
initContentDefaultValue() {
const initDefaultValue = (config) => {
if (!config.attributes) return;
if (config.type === "button" || config.type === "container" || config.type === "deepMenu") return;
const attributes = config.attributes;
const __attr_init__ = attributes[ATTRIBUTE_INIT];
if (typeof __attr_init__ === "function") {
const __attr_result__ = __attr_init__();
if (typeof __attr_result__ === "boolean" && !__attr_result__) return;
}
const menuDefaultConfig = new Map();
const key = attributes[ATTRIBUTE_KEY];
if (key != null) {
const defaultValue = attributes[ATTRIBUTE_DEFAULT_VALUE];
menuDefaultConfig.set(key, defaultValue);
}
const moreMenuDefaultConfig = attributes[ATTRIBUTE_INIT_MORE_VALUE];
if (typeof moreMenuDefaultConfig === "object" && moreMenuDefaultConfig)
Object.keys(moreMenuDefaultConfig).forEach((key) => {
const defaultValue = moreMenuDefaultConfig[key];
menuDefaultConfig.set(key, defaultValue);
});
if (!menuDefaultConfig.size) {
log.warn("请先配置键", config);
return;
}
if (config.type === "switch") {
const disabled = typeof config.disabled === "function" ? config.disabled() : config.disabled;
if (typeof disabled === "boolean" && disabled)
this.$data.contentConfigInitDisabledKeys.push(...menuDefaultConfig.keys());
}
for (const [__key, __defaultValue] of menuDefaultConfig.entries())
this.setDefaultValue(__key, __defaultValue);
};
const loopInitDefaultValue = (configList) => {
for (let index = 0; index < configList.length; index++) {
const configItem = configList[index];
initDefaultValue(configItem);
const childViews = configItem.views;
if (childViews && Array.isArray(childViews)) loopInitDefaultValue(childViews);
}
};
const contentConfigList = [...PanelContent.getAllContentConfig()];
for (let index = 0; index < contentConfigList.length; index++) {
const leftContentConfigItem = contentConfigList[index];
if (!leftContentConfigItem.views) continue;
const rightContentConfigList = leftContentConfigItem.views;
if (rightContentConfigList && Array.isArray(rightContentConfigList))
loopInitDefaultValue(rightContentConfigList);
}
this.$data.contentConfigInitDisabledKeys = [...new Set(this.$data.contentConfigInitDisabledKeys)];
},
setDefaultValue(key, defaultValue) {
if (this.$data.contentConfigInitDefaultValue.has(key))
log.warn("该key已存在,初始化默认值失败: ", {
key,
initValue: this.$data.contentConfigInitDefaultValue.get(key),
});
this.$data.contentConfigInitDefaultValue.set(key, defaultValue);
},
getDefaultValue(key) {
return this.$data.contentConfigInitDefaultValue.get(key);
},
setValue(key, value) {
PopsPanelStorageApi.set(key, value);
},
getValue(key, defaultValue) {
const localValue = PopsPanelStorageApi.get(key);
if (localValue == null) {
if (this.$data.contentConfigInitDefaultValue.has(key))
return this.$data.contentConfigInitDefaultValue.get(key);
return defaultValue;
}
return localValue;
},
deleteValue(key) {
PopsPanelStorageApi.delete(key);
},
hasKey(key) {
return PopsPanelStorageApi.has(key);
},
addValueChangeListener(key, callback, option) {
const listenerId = PopsPanelStorageApi.addValueChangeListener(key, callback);
if (option?.immediate || option?.immediateAll) {
const value = this.getValue(key);
if (option?.immediate) callback(key, value, value);
else if (option?.immediateAll) Panel.emitMenuValueChange(key, value, value);
}
return listenerId;
},
removeValueChangeListener(listenerId) {
PopsPanelStorageApi.removeValueChangeListener(listenerId);
},
emitMenuValueChange(key, newValue, oldValue) {
PopsPanelStorageApi.emitValueChangeListener(key, newValue, oldValue);
},
async exec(queryKey, callback, checkExec, once = true) {
let queryKeyFn;
if (typeof queryKey === "string" || Array.isArray(queryKey)) queryKeyFn = () => queryKey;
else queryKeyFn = queryKey;
let isArrayKey = false;
const queryKeyResult = queryKeyFn();
let keyList = [];
if (Array.isArray(queryKeyResult)) {
isArrayKey = true;
keyList = queryKeyResult;
} else keyList.push(queryKeyResult);
const findNotInDataKey = keyList.find((it) => !this.$data.contentConfigInitDefaultValue.has(it));
if (findNotInDataKey) {
log.warn(`${findNotInDataKey} 键不存在`);
return;
}
const storageKey = JSON.stringify(keyList);
if (once) {
if (this.$data.onceExecMenuData.has(storageKey)) return this.$data.onceExecMenuData.get(storageKey);
}
const listenerIdList = [];
const panelMenuResultsHandler = new PanelMenuResultsHandler({
keyList,
getValue: (key) => {
const value = this.getValue(key);
return Boolean(value);
},
checkExec(keyList) {
let flag = false;
if (typeof checkExec === "function") flag = checkExec(keyList);
else flag = keyList.every((key) => this.getValue(key));
return flag;
},
});
const valueChangeCallback = async (valueOption) => {
const execFlag = panelMenuResultsHandler.checkMenuExec();
let callbackResult = [];
if (execFlag) {
const valueList = keyList.map((key) => this.getValue(key));
callbackResult = await callback({
key: keyList,
triggerKey: valueOption?.key,
value: isArrayKey ? valueList : valueList[0],
addStoreValue: (...args) => {
return panelMenuResultsHandler.handlerResult(execFlag, args);
},
});
}
panelMenuResultsHandler.handlerResult(execFlag, callbackResult);
};
if (once)
keyList.forEach((key) => {
const listenerId = this.addValueChangeListener(key, (key, newValue, oldValue) => {
return valueChangeCallback({
key,
newValue,
oldValue,
});
});
listenerIdList.push(listenerId);
});
await valueChangeCallback();
const result = {
checkMenuExec: panelMenuResultsHandler.checkMenuExec.bind(panelMenuResultsHandler),
keyList,
reload() {
this.clearStoreNodeList();
this.execDestoryFnAndClear();
valueChangeCallback();
},
clear() {
panelMenuResultsHandler.clearStoreNodeList();
this.execDestoryFnAndClear();
this.removeValueChangeListener();
this.clearOnceExecMenuData();
},
clearStoreNodeList: panelMenuResultsHandler.clearStoreNodeList.bind(panelMenuResultsHandler),
execDestoryFnAndClear: panelMenuResultsHandler.execDestoryFnAndClear.bind(panelMenuResultsHandler),
removeValueChangeListener: () => {
listenerIdList.forEach((listenerId) => {
this.removeValueChangeListener(listenerId);
});
},
clearOnceExecMenuData() {
if (once) Panel.$data.onceExecMenuData.delete(storageKey);
},
};
this.$data.onceExecMenuData.set(storageKey, result);
return result;
},
async execMenu(key, callback, isReverse = false, once = false) {
return await this.exec(
key,
async (...args) => {
return await callback(...args);
},
(keyList) => {
return keyList.every((__key__) => {
let flag = !!this.getValue(__key__);
if (Panel.$data.contentConfigInitDisabledKeys.includes(__key__)) {
flag = false;
log.warn(`.execMenu${once ? "Once" : ""} ${__key__} 被禁用`);
}
if (isReverse) flag = !flag;
return flag;
});
},
once
);
},
async execMenuOnce(key, callback, isReverse = false, listenUrlChange = false) {
const result = await this.execMenu(key, callback, isReverse, true);
if (listenUrlChange) {
if (result) {
const urlChangeCallback = () => {
result.reload();
};
this.removeUrlChangeWithExecMenuOnceListener(key);
this.addUrlChangeWithExecMenuOnceListener(key, urlChangeCallback);
}
}
return result;
},
async execMoreMenu(menus, allExecCallback, isReverse = false, once = false, listenUrlChange = false) {
const results = await Promise.all(
menus.map(async ([key, callback]) => {
return await this.execMenu(
key,
(...args) => {
return callback(...args);
},
isReverse,
once
);
})
);
const panelMenuResultsHandler = new PanelMenuResultsHandler({
keyList: menus.map(([key]) => key),
getValue: (key) => {
const value = this.getValue(key);
return Boolean(value);
},
});
const listenerIdList = [];
const __destory__ = (removeListener = false) => {
panelMenuResultsHandler.clearStoreNodeList();
panelMenuResultsHandler.execDestoryFnAndClear();
if (removeListener) {
for (const listenerId of listenerIdList) this.removeValueChangeListener(listenerId);
for (const result of results) if (result) this.removeUrlChangeWithExecMenuOnceListener(result.keyList);
}
};
const __allExecCallback__ = () => {
const allExecFlag = results.every((result) => {
if (result) return result.checkMenuExec();
else return true;
});
__destory__(false);
if (allExecFlag) {
const execResult = allExecCallback();
panelMenuResultsHandler.handlerResult(allExecFlag, execResult);
}
};
__allExecCallback__();
for (const result of results)
if (result) {
const listenerId = this.addValueChangeListener(result.keyList[0], () => {
__allExecCallback__();
});
listenerIdList.push(listenerId);
if (listenUrlChange) {
const urlChangeCallback = () => {
result.reload();
};
this.removeUrlChangeWithExecMenuOnceListener(result.keyList);
this.addUrlChangeWithExecMenuOnceListener(result.keyList, urlChangeCallback);
}
}
return {
clear() {
for (const result of results) result?.clear();
this.execDestoryFnAndClear();
this.removeValueChangeListener();
},
execDestoryFnAndClear() {
for (const result of results) result?.execDestoryFnAndClear();
__destory__(false);
},
removeValueChangeListener() {
for (const result of results) result?.removeValueChangeListener();
__destory__(true);
},
};
},
async execMoreMenuOnce(menus, allExecCallback, isReverse = false, listenUrlChange = false) {
return await this.execMoreMenu(menus, allExecCallback, isReverse, true, listenUrlChange);
},
deleteExecMenuOnce(key) {
key = this.transformKey(key);
this.$data.onceExecMenuData.delete(key);
this.$data.urlChangeReloadMenuExecOnce.delete(key);
return PopsPanelStorageApi.removeValueChangeListener(key);
},
onceExec(key, callback, runWithMenuEnable = false) {
key = this.transformKey(key);
if (typeof key !== "string") throw new TypeError("key 必须是字符串");
if (this.$data.onceExecData.has(key)) return;
if (runWithMenuEnable) {
if (
(Array.isArray(key) ? key : [key]).findIndex((it) => {
if (!!!Panel.getValue(it)) return true;
}) !== -1
)
return;
}
callback();
this.$data.onceExecData.set(key, 1);
},
deleteOnceExec(key) {
key = this.transformKey(key);
this.$data.onceExecData.delete(key);
},
addUrlChangeWithExecMenuOnceListener(key, callback) {
key = this.transformKey(key);
this.$data.urlChangeReloadMenuExecOnce.set(key, callback);
return {
off: () => {
return this.removeUrlChangeWithExecMenuOnceListener(key);
},
};
},
removeUrlChangeWithExecMenuOnceListener(key) {
key = this.transformKey(key);
this.$data.urlChangeReloadMenuExecOnce.delete(key);
},
hasUrlChangeWithExecMenuOnceListener(key) {
key = this.transformKey(key);
return this.$data.urlChangeReloadMenuExecOnce.has(key);
},
async emitUrlChangeWithExecMenuOnceEvent(config) {
const values = this.$data.urlChangeReloadMenuExecOnce.values();
for (const callback of values) await callback(config);
},
showPanel(
content,
title = `${SCRIPT_NAME}-设置`,
preventDefaultContentConfig = false,
preventRegisterSearchPlugin = false
) {
this.$data.$panel = null;
this.$data.panelContent = [];
const checkHasBottomVersionContentConfig =
content.findIndex((it) => {
return (
(typeof it.isBottom === "function" ? it.isBottom() : Boolean(it.isBottom)) && it.id === "script-version"
);
}) !== -1;
if (!preventDefaultContentConfig && !checkHasBottomVersionContentConfig)
content.push(...PanelContent.getDefaultBottomContentConfig());
const $panel = __pops__.panel({
title: {
text: title,
position: "center",
html: false,
style: "",
},
content,
btn: {
close: {
enable: true,
callback: (details) => {
details.close();
this.$data.$panel = null;
},
},
},
mask: {
enable: true,
clickEvent: {
toClose: true,
toHide: false,
},
clickCallBack: (originalRun) => {
originalRun();
this.$data.$panel = null;
},
},
width: PanelUISize.setting.width,
height: PanelUISize.setting.height,
drag: true,
only: true,
style: `
.pops-switch-shortcut-wrapper{
margin-right: 5px;
display: inline-flex;
}
.pops-switch-shortcut-wrapper:hover .pops-bottom-icon{
cursor: pointer;
}
`,
...this.$data.panelConfig,
});
this.$data.$panel = $panel;
this.$data.panelContent = content;
if (!preventRegisterSearchPlugin)
this.registerConfigSearch({
$panel,
content,
});
return {
$panel,
content,
};
},
registerConfigSearch(config) {
const { $panel, content } = config;
const translateCallback = (text, translateMap) => {
if (typeof config.translateCallback === "function") return config.translateCallback(text, translateMap);
else {
if (typeof translateMap === "object" && translateMap)
for (const key in translateMap) text = text.replaceAll(`{{${key}}}`, translateMap[key]);
return text;
}
};
const asyncQueryProperty = async (target, handler) => {
if (target == null) return;
const handleResult = await handler(target);
if (handleResult && typeof handleResult.isFind === "boolean" && handleResult.isFind) return handleResult.data;
return await asyncQueryProperty(handleResult.data, handler);
};
const scrollToElementAndListen = ($el, callback) => {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
callback?.();
observer.disconnect();
}
});
},
{
root: null,
threshold: 1,
}
);
observer.observe($el);
$el.scrollIntoView({
behavior: "smooth",
block: "center",
});
};
const addFlashingClass = ($el) => {
const flashingClassName = "pops-flashing";
domUtils.onAnimationend($el, () => {
$el.classList.remove(flashingClassName);
});
$el.classList.add(flashingClassName);
};
const dbclick_callback = (evt) => {
if (evt.type === "dblclick" && isMobileTouch) return;
domUtils.preventEvent(evt);
const $alert = __pops__.alert({
title: {
text: translateCallback("搜索配置"),
position: "center",
},
content: {
text: `
`,
html: true,
},
btn: { ok: { enable: false } },
mask: { clickEvent: { toClose: true } },
width: PanelUISize.settingMiddle.width,
height: "auto",
drag: true,
style: `
${__pops__.config.cssText.panelCSS}
.search-wrapper{
border-bottom: 1px solid rgb(235, 238, 245, 1);
}
.pops-content:has(.search-result-wrapper:empty) .search-wrapper{
border-bottom: 0;
}
.search-config-text{
width: 100%;
border: 0;
height: 32px;
padding: 0px 10px;
outline: none;
}
.search-result-wrapper{
max-height: 400px;
overflow: auto;
}
.search-result-item{
cursor: pointer;
padding: 5px 10px;
display: flex;
flex-direction: column;
}
.search-result-item:hover{
background-color: #D8F1FD;
}
.search-result-item-path{
display: flex;
align-items: center;
flex-wrap: wrap;
}
.search-result-item-description{
font-size: 0.8em;
color: #6c6c6c;
}
${config.searchDialogStyle ?? ""}
`,
});
const $searchInput = $alert.$shadowRoot.querySelector(".search-config-text");
const $searchResultWrapper = $alert.$shadowRoot.querySelector(".search-result-wrapper");
$searchInput.focus();
const clearSearchResult = () => {
domUtils.empty($searchResultWrapper);
};
const createSearchResultItem = (pathInfo) => {
const searchPath = utils.queryProperty(pathInfo, (target) => {
if (target?.next)
return {
isFind: false,
data: target.next,
};
else
return {
isFind: true,
data: target,
};
});
const $item = domUtils.createElement("div", {
className: "search-result-item",
innerHTML: `
${searchPath.matchedData?.path}
${searchPath.matchedData?.description ?? ""}
`,
});
const panelHandlerComponents = __pops__.fn.PanelHandlerComponents();
domUtils.on($item, "click", () => {
const $targetAsideItem = $panel.$shadowRoot.querySelectorAll(
"aside.pops-panel-aside .pops-panel-aside-top-container li"
)[pathInfo.index];
if (!$targetAsideItem) {
qmsg.default.error(translateCallback(`左侧项下标{{index}}不存在`, { index: pathInfo.index }));
return;
}
$targetAsideItem.scrollIntoView({
behavior: "smooth",
block: "center",
});
$targetAsideItem.click();
asyncQueryProperty(pathInfo.next, async (target) => {
if (target?.next) {
const $findDeepMenu = await domUtils.waitNode(() => {
return Array.from($panel.$shadowRoot.querySelectorAll(".pops-panel-deepMenu-nav-item")).find(
($deepMenu) => {
const viewConfig = Reflect.get($deepMenu, panelHandlerComponents.$data.nodeStoreConfigKey);
return typeof viewConfig === "object" && viewConfig != null && viewConfig.text === target.name;
}
);
}, 2500);
if ($findDeepMenu) $findDeepMenu.click();
else {
qmsg.default.error(translateCallback("未找到对应的二级菜单"));
return {
isFind: true,
data: target,
};
}
return {
isFind: false,
data: target.next,
};
} else {
const $findTargetMenu = await domUtils.waitNode(() => {
return Array.from(
$panel.$shadowRoot.querySelectorAll(`li:not(.pops-panel-deepMenu-nav-item)`)
).find(($menuItem) => {
return (
Reflect.get($menuItem, panelHandlerComponents.$data.nodeStoreConfigKey) ===
target.matchedData?.formConfig
);
});
}, 2500);
if ($findTargetMenu) {
scrollToElementAndListen($findTargetMenu);
const $fold = $findTargetMenu.closest(`.pops-panel-forms-fold[data-fold-enable]`);
if ($fold) {
$fold.querySelector(".pops-panel-forms-fold-container").click();
await utils.sleep(500);
}
scrollToElementAndListen($findTargetMenu, () => {
addFlashingClass($findTargetMenu);
});
} else qmsg.default.error(translateCallback("未找到对应的菜单项"));
return {
isFind: true,
data: target,
};
}
});
});
return $item;
};
const execSearch = (searchText) => {
const searchTextRegExp = new RegExp(searchText, "i");
const searchConfigResult = [];
const loopContentConfig = (configList, path) => {
for (let index = 0; index < configList.length; index++) {
const configItem = configList[index];
const childViewConfig = configItem.views;
if (childViewConfig && Array.isArray(childViewConfig)) {
const deepMenuPath = utils.deepClone(path);
if (configItem.type === "deepMenu") {
const deepNext = utils.queryProperty(deepMenuPath, (target) => {
if (target?.next)
return {
isFind: false,
data: target.next,
};
else
return {
isFind: true,
data: target,
};
});
deepNext.next = { name: configItem.text };
}
loopContentConfig(childViewConfig, deepMenuPath);
} else {
let text;
let description;
if (configItem.type === "own") {
let searchConfig = Reflect.get(configItem.attributes || {}, ATTRIBUTE_PLUGIN_SEARCH_CONFIG);
if (searchConfig) {
if (typeof searchConfig === "function") searchConfig = searchConfig();
if (typeof searchConfig.text === "string") text = searchConfig.text;
if (typeof searchConfig.desc === "string") description = searchConfig.desc;
}
} else {
text = configItem.text;
description = Reflect.get(configItem, "description");
}
const delayMatchedTextList = [text, description];
const matchedIndex = delayMatchedTextList.findIndex((configText) => {
if (typeof configText !== "string") return;
return configText.match(searchTextRegExp);
});
if (matchedIndex !== -1) {
const matchedPath = utils.deepClone(path);
const deepNext = utils.queryProperty(matchedPath, (target) => {
if (target?.next)
return {
isFind: false,
data: target.next,
};
else
return {
isFind: true,
data: target,
};
});
deepNext.next = {
name: text,
matchedData: {
path: "",
formConfig: configItem,
matchedText: delayMatchedTextList[matchedIndex],
description,
},
};
const pathList = [];
utils.queryProperty(matchedPath, (target) => {
const name = target?.name;
if (typeof name === "string" && name.trim() !== "") pathList.push(name);
if (target?.next)
return {
isFind: false,
data: target.next,
};
else
return {
isFind: true,
data: target,
};
});
const pathStr = pathList.join(CommonUtil.escapeHtml(" - "));
deepNext.next.matchedData.path = pathStr;
searchConfigResult.push(matchedPath);
}
}
}
};
for (let index = 0; index < content.length; index++) {
const leftContentConfigItem = content[index];
if (!leftContentConfigItem.views) continue;
if (leftContentConfigItem.isBottom && leftContentConfigItem.id === "script-version") continue;
const rightContentConfigList = leftContentConfigItem.views;
if (rightContentConfigList && Array.isArray(rightContentConfigList)) {
let text = leftContentConfigItem.title;
if (typeof text === "function") text = text();
loopContentConfig(rightContentConfigList, {
index,
name: text,
});
}
}
const $fragment = document.createDocumentFragment();
for (const pathInfo of searchConfigResult) {
const $resultItem = createSearchResultItem(pathInfo);
$fragment.appendChild($resultItem);
}
clearSearchResult();
$searchResultWrapper.append($fragment);
};
domUtils.on(
$searchInput,
"input",
utils.debounce((evt2) => {
domUtils.preventEvent(evt2);
const searchText = domUtils.val($searchInput).trim();
if (searchText === "") {
clearSearchResult();
return;
}
execSearch(searchText);
}, 200)
);
};
$panel.$shadowRoot
.querySelectorAll(`aside.pops-panel-aside .pops-panel-aside-item:not(#script-version)`)
.forEach(($asideItem) => {
domUtils.on($asideItem, "dblclick", dbclick_callback);
});
const clickMap = new WeakMap();
let isDoubleClick = false;
let timer = void 0;
let isMobileTouch = false;
domUtils.on(
$panel.$shadowRoot,
"touchend",
`aside.pops-panel-aside .pops-panel-aside-item:not(#script-version)`,
(evt, $selector) => {
isMobileTouch = true;
clearTimeout(timer);
timer = void 0;
if (isDoubleClick && clickMap.has($selector)) {
isDoubleClick = false;
clickMap.delete($selector);
dbclick_callback(evt);
} else {
timer = setTimeout(() => {
isDoubleClick = false;
}, 200);
isDoubleClick = true;
clickMap.set($selector, evt);
}
},
{ capture: true }
);
$panel.$shadowRoot.appendChild(
domUtils.createElement("style", {
type: "text/css",
textContent: `
.pops-flashing{
animation: double-blink 1.5s ease-in-out;
}
@keyframes double-blink {
0% {
background-color: initial;
}
25% {
background-color: yellow;
}
50% {
background-color: initial;
}
75% {
background-color: yellow;
}
100% {
background-color: initial;
}
}
`,
})
);
},
transformKey(key) {
if (Array.isArray(key))
if (key.length > 1) {
const keyArray = key.sort();
return JSON.stringify(keyArray);
} else return key[0];
else return key;
},
getDynamicValue(key, defaultValue) {
let isInit = false;
let __value = defaultValue;
const listenerId = this.addValueChangeListener(key, (_, newValue) => {
__value = newValue;
});
return {
get value() {
if (!isInit) {
isInit = true;
__value = Panel.getValue(key, defaultValue);
}
return __value;
},
destory() {
Panel.removeValueChangeListener(listenerId);
},
};
},
};
var LoadingView = class {
config;
loadingViewElement;
loadingViewHTML;
loadingViewIconHTML;
constructor(withIcon, isEnd) {
this.config = {
className: "gm-load-view",
textClassName: "gm-load-view-text",
iconClassName: "gm-load-view-icon",
outSideClassName: "gm-load-view-icon-outside",
withInClassName: "gm-load-view-icon-within",
};
this.loadingViewElement = void 0;
this.loadingViewHTML = `
Loading...
`.trim();
this.loadingViewIconHTML = `
`.trim();
this.addStyle();
this.initLoadingView(withIcon, isEnd);
}
addStyle() {
if (this.isExistsCSS()) return;
const cssText = `
.${this.config.className}{
margin: 0.08rem;
background: #fff;
font-size: 15px;
text-align: center;
width: inherit;
border-radius: 0.12rem;
}
.${this.config.iconClassName}{
width: 45px;
}
.${this.config.className},
.${this.config.iconClassName}{
height: 45px;
line-height: 45px;
display: flex;
align-items: center;
justify-content: center;
}
.${this.config.outSideClassName},
.${this.config.withInClassName}{
position: absolute;
margin-left: 140px;
border: 5px solid rgba(0, 183, 229, 0.9);
opacity: .9;
border-radius: 50px;
width: 20px;
height: 20px;
margin: 0 auto;
}
.${this.config.outSideClassName}{
background-color: rgba(0, 0, 0, 0);
border-right: 5px solid rgba(0, 0, 0, 0);
border-left: 5px solid rgba(0, 0, 0, 0);
box-shadow: 0 0 35px #2187e7;
-moz-animation: spinPulse 1s infinite ease-in-out;
-webkit-animation: spinPulse 1s infinite ease-in-out;
-o-animation: spinPulse 1s infinite ease-in-out;
-ms-animation: spinPulse 1s infinite ease-in-out;
}
.${this.config.withInClassName}{
background: rgba(0, 0, 0, 0) no-repeat center center;
border-top: 5px solid rgba(0, 0, 0, 0);
border-bottom: 5px solid rgba(0, 0, 0, 0);
box-shadow: 0 0 15px #2187e7;
-moz-animation: spinoffPulse 3s infinite linear;
-webkit-animation: spinoffPulse 3s infinite linear;
-o-animation: spinoffPulse 3s infinite linear;
-ms-animation: spinoffPulse 3s infinite linear;
}
@-moz-keyframes spinPulse{0%{-moz-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050}
50%{-moz-transform:rotate(145deg);opacity:1}
100%{-moz-transform:rotate(-320deg);opacity:0}
}
@-moz-keyframes spinoffPulse{0%{-moz-transform:rotate(0)}
100%{-moz-transform:rotate(360deg)}
}
@-webkit-keyframes spinPulse{0%{-webkit-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050}
50%{-webkit-transform:rotate(145deg);opacity:1}
100%{-webkit-transform:rotate(-320deg);opacity:0}
}
@-webkit-keyframes spinoffPulse{0%{-webkit-transform:rotate(0)}
100%{-webkit-transform:rotate(360deg)}
}
@-o-keyframes spinPulse{0%{-o-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050}
50%{-o-transform:rotate(145deg);opacity:1}
100%{-o-transform:rotate(-320deg);opacity:0}
}
@-o-keyframes spinoffPulse{0%{-o-transform:rotate(0)}
100%{-o-transform:rotate(360deg)}
}
@-ms-keyframes spinPulse{0%{-ms-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050}
50%{-ms-transform:rotate(145deg);opacity:1}
100%{-ms-transform:rotate(-320deg);opacity:0}
}
@-ms-keyframes spinoffPulse{0%{-ms-transform:rotate(0)}
100%{-ms-transform:rotate(360deg)}
}
`;
const $style = domUtils.addStyle(cssText);
$style.setAttribute("data-from", "loadingView");
$style.setAttribute("type", "text/css");
}
get $el() {
return this.getLoadingViewElement();
}
get $icon() {
return this.getIconElement();
}
initLoadingView(withIcon = false, isEnd = true) {
this.setLoadingViewElement();
const $wrapperFirst = domUtils.createElement("div", { innerHTML: this.loadingViewHTML }).firstChild;
if (withIcon) {
const $iconWrapper = domUtils.createElement("div", { innerHTML: this.loadingViewIconHTML });
if (isEnd) $wrapperFirst.appendChild($iconWrapper.firstChild);
else $wrapperFirst.insertBefore($iconWrapper.firstChild, $wrapperFirst.firstChild);
}
this.setLoadingViewElement($wrapperFirst);
return $wrapperFirst;
}
setLoadingViewElement(element) {
this.loadingViewElement = element;
}
getLoadingViewElement() {
if (!this.loadingViewElement) throw new TypeError("object loadingViewElement is null");
return this.loadingViewElement;
}
getIconElement() {
return this.$el.querySelector("." + this.config.iconClassName);
}
show() {
domUtils.show(this.$el, false);
}
hide() {
domUtils.hide(this.$el, false);
}
showIcon() {
const $icon = this.$icon;
if ($icon) domUtils.show($icon, false);
}
hideIcon() {
const $icon = this.$icon;
if ($icon) domUtils.hide($icon, false);
}
setText(text, withIcon = false, isEnd = true) {
domUtils.html(this.$el, `${text}`);
if (withIcon) {
let $icon = this.$icon;
if (!$icon) {
$icon = domUtils.createElement("div", { innerHTML: this.loadingViewIconHTML }).firstChild;
if (isEnd) this.$el.appendChild($icon);
else this.$el.insertBefore($icon, this.$el.firstChild);
}
this.showIcon();
} else this.$icon?.remove();
}
setHTML(text) {
domUtils.html(this.$el, text);
}
destory() {
this.$el?.remove();
this.setLoadingViewElement();
}
removeAll() {
document.querySelectorAll("." + this.config.className).forEach(($it) => $it.remove());
}
isExists() {
return !!document.querySelector(`.${this.config.className}`);
}
isExistsIcon() {
return !!this.$icon;
}
isExistsText() {
return !!this.$el.querySelector(`.${this.config.textClassName}`);
}
isExistsCSS() {
return !!document.querySelector("style[data-from='loadingView'][type='text/css']");
}
};
_monkeyWindow.showdown || _unsafeWindow.showdown;
var loadingView = new LoadingView(true);
var RouterBuilder = class RouterBuilder {
__href__;
get __href() {
return this.__href__ || globalThis.location.href;
}
__origin = {
value: void 0,
type: "same",
};
__protocol = {
value: void 0,
type: "same",
};
__host = {
value: void 0,
type: "same",
hasPort: false,
};
__pathname = {
value: void 0,
type: "same",
};
__searchParams = { value: new Set() };
otherInstResultWithOr = false;
constructor(href) {
if (typeof href === "string") this.href(href);
}
href(url) {
this.__href__ = url;
return this;
}
origin(origin) {
this.__origin = {
value: origin,
type: "same",
};
return this;
}
originStartsWith(origin) {
this.__origin = {
value: origin,
type: "startsWith",
};
return this;
}
originEndsWith(origin) {
this.__origin = {
value: origin,
type: "endsWith",
};
return this;
}
originIncludes(origin) {
this.__origin = {
value: origin,
type: "includes",
};
return this;
}
originMatch(origin) {
this.__origin = {
value: origin,
type: "match",
};
return this;
}
protocol(protocol) {
this.__protocol = {
value: protocol,
type: "same",
};
return this;
}
protocolStartsWith(protocol) {
this.__protocol = {
value: protocol,
type: "startsWith",
};
return this;
}
protocolEndsWith(protocol) {
this.__protocol = {
value: protocol,
type: "endsWith",
};
return this;
}
protocolIncludes(protocol) {
this.__protocol = {
value: protocol,
type: "includes",
};
return this;
}
protocolMatch(protocol) {
this.__protocol = {
value: protocol,
type: "match",
};
return this;
}
host(host) {
this.__host = {
value: host,
type: "same",
hasPort: true,
};
return this;
}
hostStartsWith(host) {
this.__host = {
value: host,
type: "startsWith",
hasPort: true,
};
return this;
}
hostEndsWith(host) {
this.__host = {
value: host,
type: "endsWith",
hasPort: true,
};
return this;
}
hostIncludes(host) {
this.__host = {
value: host,
type: "includes",
hasPort: true,
};
return this;
}
hostMatch(host) {
this.__host = {
value: host,
type: "match",
hasPort: true,
};
return this;
}
hostName(hostName) {
this.__host = {
value: hostName,
type: "same",
hasPort: false,
};
return this;
}
hostNameStartsWith(hostName) {
this.__host = {
value: hostName,
type: "startsWith",
hasPort: false,
};
return this;
}
hostNameEndsWith(hostName) {
this.__host = {
value: hostName,
type: "endsWith",
hasPort: false,
};
return this;
}
hostNameIncludes(hostName) {
this.__host = {
value: hostName,
type: "includes",
hasPort: false,
};
return this;
}
hostNameMatch(hostName) {
this.__host = {
value: hostName,
type: "match",
hasPort: false,
};
return this;
}
pathname(pathname) {
this.__pathname = {
value: pathname,
type: "same",
};
return this;
}
pathnameStartsWith(pathname) {
this.__pathname = {
value: pathname,
type: "startsWith",
};
return this;
}
pathnameEndsWith(pathname) {
this.__pathname = {
value: pathname,
type: "endsWith",
};
return this;
}
pathnameIncludes(pathname) {
this.__pathname = {
value: pathname,
type: "includes",
};
return this;
}
pathnameMatch(pathname) {
this.__pathname = {
value: pathname,
type: "match",
};
return this;
}
searchParams(name, value) {
this.__searchParams.value.add({
name,
value,
});
return this;
}
search(value) {
this.__searchParams.value.add({
name: "",
value,
type: "same",
});
return this;
}
searchStartsWith(value) {
this.__searchParams.value.add({
name: "",
value,
type: "startsWith",
});
return this;
}
searchEndsWith(value) {
this.__searchParams.value.add({
name: "",
value,
type: "endsWith",
});
return this;
}
searchIncludes(value) {
this.__searchParams.value.add({
name: "",
value,
type: "includes",
});
return this;
}
searchMatch(value) {
this.__searchParams.value.add({
name: "",
value,
type: "match",
});
return this;
}
build() {
if (!this.__host.value) throw new TypeError("host or hostName should be required");
let url = `${this.__protocol.value || "https"}://${this.__host.value}${this.__pathname.value || "/"}`;
if (this.__searchParams.value.size > 0) {
const searhList = [];
this.__searchParams.value.forEach((it) => {
if (typeof it.name === "string") {
let value = "";
if (typeof it.value === "string" || typeof it.value === "number" || typeof it.value === "boolean")
value = it.value.toString();
searhList.push(`${encodeURIComponent(it.name)}=${encodeURIComponent(value)}`);
}
});
if (searhList.length) url += `?${searhList.join("&")}`;
}
return url;
}
or(href) {
this.otherInstResultWithOr = this.otherInstResultWithOr || this.r();
const routerBuilder = new RouterBuilder(href);
routerBuilder.otherInstResultWithOr = this.otherInstResultWithOr;
return routerBuilder;
}
r() {
if (this.otherInstResultWithOr) return this.otherInstResultWithOr;
const urlInst = new URL(this.__href);
return [
() => {
if (this.__origin.value)
if (this.__origin.type === "same")
if (typeof this.__origin.value === "string") return urlInst.origin === this.__origin.value;
else throw new TypeError("origin value should be string by type " + this.__origin.type);
else if (this.__origin.type === "startsWith")
if (typeof this.__origin.value === "string") return urlInst.origin.startsWith(this.__origin.value);
else throw new TypeError("origin value should be string by type " + this.__origin.type);
else if (this.__origin.type === "endsWith")
if (typeof this.__origin.value === "string") return urlInst.origin.endsWith(this.__origin.value);
else throw new TypeError("origin value should be string by type " + this.__origin.type);
else if (this.__origin.type === "includes")
if (typeof this.__origin.value === "string") return urlInst.origin.includes(this.__origin.value);
else throw new TypeError("origin value should be string by type " + this.__origin.type);
else if (this.__origin.type === "match")
if (this.__origin.value instanceof RegExp) return this.__origin.value.test(urlInst.origin);
else if (typeof this.__origin.value === "string") return urlInst.origin.match(this.__origin.value);
else throw new TypeError("origin value should be RegExp or string by type " + this.__origin.type);
else throw new TypeError("origin type should be same or startsWith or endsWith or includes or match");
else return true;
},
() => {
if (this.__protocol.value)
if (this.__protocol.type === "same")
if (typeof this.__protocol.value === "string") return urlInst.protocol === this.__protocol.value;
else throw new TypeError("protocol value should be string by type " + this.__protocol.type);
else if (this.__protocol.type === "startsWith")
if (typeof this.__protocol.value === "string")
return urlInst.protocol.startsWith(this.__protocol.value);
else throw new TypeError("protocol value should be string by type " + this.__protocol.type);
else if (this.__protocol.type === "endsWith")
if (typeof this.__protocol.value === "string") return urlInst.protocol.endsWith(this.__protocol.value);
else throw new TypeError("protocol value should be string by type " + this.__protocol.type);
else if (this.__protocol.type === "includes")
if (typeof this.__protocol.value === "string") return urlInst.protocol.includes(this.__protocol.value);
else throw new TypeError("protocol value should be string by type " + this.__protocol.type);
else if (this.__protocol.type === "match")
if (this.__protocol.value instanceof RegExp) return this.__protocol.value.test(urlInst.protocol);
else if (typeof this.__protocol.value === "string")
return urlInst.protocol.match(this.__protocol.value);
else throw new TypeError("protocol value should be RegExp or string by type " + this.__protocol.type);
else throw new TypeError("protocol type should be same,startsWith,endsWith,includes,match");
else return true;
},
() => {
if (this.__host.value) {
const host = this.__host.hasPort ? urlInst.host : urlInst.hostname;
if (this.__host.type === "same")
if (typeof this.__host.value === "string") return this.__host.value === host;
else throw new TypeError("host value should be string by type " + this.__host.type);
else if (this.__host.type === "startsWith")
if (typeof this.__host.value === "string") return host.startsWith(this.__host.value);
else throw new TypeError("host value should be string by type " + this.__host.type);
else if (this.__host.type === "endsWith")
if (typeof this.__host.value === "string") return host.endsWith(this.__host.value);
else throw new TypeError("host value should be string by type " + this.__host.type);
else if (this.__host.type === "includes")
if (typeof this.__host.value === "string") return host.includes(this.__host.value);
else throw new TypeError("host value should be string by type " + this.__host.type);
else if (this.__host.type === "match")
if (this.__host.value instanceof RegExp) return this.__host.value.test(host);
else if (typeof this.__host.value === "string") return host.match(this.__host.value);
else throw new TypeError("host value should be RegExp or string by type " + this.__host.type);
else throw new TypeError("host type should be same,startsWith,endsWith,includes,match");
} else return true;
},
() => {
if (this.__pathname.value)
if (this.__pathname.type === "same")
if (typeof this.__pathname.value === "string") return urlInst.pathname === this.__pathname.value;
else throw new TypeError("pathname value should be string by type " + this.__pathname.type);
else if (this.__pathname.type === "startsWith")
if (typeof this.__pathname.value === "string")
return urlInst.pathname.startsWith(this.__pathname.value);
else throw new TypeError("pathname value should be string by type " + this.__pathname.type);
else if (this.__pathname.type === "endsWith")
if (typeof this.__pathname.value === "string") return urlInst.pathname.endsWith(this.__pathname.value);
else throw new TypeError("pathname value should be string by type " + this.__pathname.type);
else if (this.__pathname.type === "includes")
if (typeof this.__pathname.value === "string") return urlInst.pathname.includes(this.__pathname.value);
else throw new TypeError("pathname value should be string by type " + this.__pathname.type);
else if (this.__pathname.type === "match")
if (this.__pathname.value instanceof RegExp) return this.__pathname.value.test(urlInst.pathname);
else if (typeof this.__pathname.value === "string")
return urlInst.pathname.match(this.__pathname.value);
else throw new TypeError("pathname value should be RegExp or string by type " + this.__pathname.type);
else throw new TypeError("pathname type should be same,startsWith,endsWith,includes,match");
else return true;
},
() => {
let flag = true;
const searchParamsList = [];
this.__searchParams.value.forEach((item) => {
searchParamsList.push(item);
});
for (let index = 0; index < searchParamsList.length; index++) {
const item = searchParamsList[index];
if (item.type)
if (item.type === "same")
if (
typeof item.value === "string" ||
typeof item.value === "number" ||
typeof item.value === "boolean"
)
return urlInst.search === item.value.toString();
else throw new TypeError("search value should be string、number、boolean by type " + item.type);
else if (item.type === "startsWith")
if (
typeof item.value === "string" ||
typeof item.value === "number" ||
typeof item.value === "boolean"
)
return urlInst.search.startsWith(item.value.toString());
else throw new TypeError("search value should be string、number、boolean by type " + item.type);
else if (item.type === "endsWith")
if (
typeof item.value === "string" ||
typeof item.value === "number" ||
typeof item.value === "boolean"
)
return urlInst.search.endsWith(item.value.toString());
else throw new TypeError("search value should be string、number、boolean by type " + item.type);
else if (item.type === "includes")
if (
typeof item.value === "string" ||
typeof item.value === "number" ||
typeof item.value === "boolean"
)
return urlInst.search.includes(item.value.toString());
else throw new TypeError("search value should be string、number、boolean by type " + item.type);
else if (item.type === "match")
if (item.value instanceof RegExp) return item.value.test(urlInst.search);
else if (
typeof item.value === "string" ||
typeof item.value === "number" ||
typeof item.value === "boolean"
)
return urlInst.search.match(item.value.toString());
else
throw new TypeError("search value should be RegExp、string、number、boolean by type " + item.type);
else throw new TypeError("search type should be same, startsWith, endsWith, includes, match");
else if (typeof item.name === "string") {
let value = item.value;
if (
value == null ||
typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean"
) {
value = value == null ? void 0 : value.toString();
if (!urlInst.searchParams.has(item.name, value)) {
flag = false;
break;
}
} else if (value instanceof RegExp) {
const targetValue = urlInst.searchParams.get(item.name);
if (targetValue) {
if (!value.test(targetValue)) {
flag = false;
break;
}
} else {
flag = false;
break;
}
} else
throw new TypeError("searchParams value should be string, RegExp, boolean, number, null, undefined");
} else if (item.name instanceof RegExp) {
let targetKey = void 0;
let targetValue = void 0;
urlInst.searchParams.forEach((__value__, __key__) => {
if (!targetKey && __key__.match(item.name)) {
targetKey = __key__;
targetValue = __value__;
}
});
if (targetKey) {
let value = item.value;
if (value == null) {
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
value = value.toString();
flag = value === targetValue;
if (!flag) break;
} else if (value instanceof RegExp)
if (targetValue) {
if (!value.test(targetValue)) {
flag = false;
break;
}
} else {
flag = false;
break;
}
else
throw new TypeError(
"searchParams value should be string, RegExp, boolean, number, null, undefined"
);
} else {
flag = false;
break;
}
} else throw new TypeError("searchParams name should be string or RegExp");
}
return flag;
},
].every((it) => it());
}
};
var RouterUtil = {
host(host, href) {
return RouterUtil.builder(href).host(host);
},
hostName(name, href) {
return RouterUtil.builder(href).hostName(name);
},
search(value, href) {
return RouterUtil.builder(href).search(value);
},
seachParams(name, value, href) {
return RouterUtil.builder(href).searchParams(name, value);
},
pathname(name, href) {
return RouterUtil.builder(href).pathname(name);
},
protocol(protocol, href) {
return RouterUtil.builder(href).protocol(protocol);
},
builder(href) {
return new RouterBuilder(href);
},
};
var BaiduRouter = {
isSearch() {
return RouterUtil.builder()
.hostNameMatch(/^(m[0-9]{0,2}|www).baidu.com$/g)
.r();
},
isSearchBh() {
return this.isSearch() && RouterUtil.builder().pathnameStartsWith("/bh").r();
},
isSearchVideo() {
return this.isSearch() && RouterUtil.builder().pathnameStartsWith("/video/page").r();
},
isSearchHome() {
return (
this.isSearch() &&
RouterUtil.pathname("/").r() &&
(RouterUtil.search("").r() || RouterUtil.builder().searchStartsWith("?").r())
);
},
isSearchVSearch() {
return this.isSearch() && RouterUtil.builder().pathnameStartsWith("/sf/vsearch").r();
},
isSearchVSearch_image_content() {
return this.isSearch() && RouterUtil.builder().searchParams("pd", "image_content").r();
},
isSearchVSearch_note() {
return this.isSearchVSearch() && RouterUtil.builder().searchParams("pd", "note").r();
},
isSearchWenDaTab() {
return this.isSearchVSearch() && RouterUtil.builder().searchParams("pd", "wenda_tab").r();
},
isHealth() {
return this.isSearchBh() || RouterUtil.hostName("health.baidu.com").r();
},
isBaiJiaHao() {
return RouterUtil.hostName("baijiahao.baidu.com").r();
},
isTieBa() {
return (
RouterUtil.builder()
.hostNameMatch(/^(tieba|ala|static.tieba|nba|fexclick|youhua|tiebaswan).baidu.com$/g)
.r() ||
RouterUtil.hostName("jump2.bdimg.com").r() ||
RouterUtil.hostName("www.tieba.com").r()
);
},
isTieBaPost() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/p/").r();
},
isTieBaNewTopic() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/mo/q/newtopic/topicTemplate").r();
},
isTieBaHottopic() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/hottopic/browse/hottopic").r();
},
isTieBaHybrid() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/mo/q/hybrid/search").r();
},
isTieBaHybridUserGrowBase() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/mo/q/hybrid-usergrow-base/commentFocus").r();
},
isTieBaCheckUrl() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/mo/q/checkurl").r();
},
isTieBaNei() {
return this.isTieBa() && RouterUtil.pathname("/f").r();
},
isTieBaIndex() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/index").r();
},
isTieBaHome() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/home/main").r();
},
isTieBaCollectionCenter() {
return this.isTieBa() && RouterUtil.builder().pathnameStartsWith("/mo/q/hybrid-main-user/collectionCenter").r();
},
isWenKu() {
return RouterUtil.hostName("wk.baidu.com").or().hostName("tanbi.baidu.com").r();
},
isJingYan() {
return RouterUtil.hostName("jingyan.baidu.com").r();
},
isBaiKe() {
return RouterUtil.hostName("baike.baidu.com").or().hostName("wapbaike.baidu.com").r();
},
isBaiKeTaShuo() {
return this.isBaiKe() && RouterUtil.builder().pathnameStartsWith("/tashuo").r();
},
isZhiDao() {
return RouterUtil.hostName("zhidao.baidu.com").r();
},
isFanYi() {
return RouterUtil.hostName("fanyi.baidu.com").r();
},
isFanYiApp() {
return RouterUtil.hostName("fanyi-app.baidu.com").r();
},
isImage() {
return RouterUtil.hostName("image.baidu.com").r();
},
isMap() {
return RouterUtil.hostName("map.baidu.com").r();
},
isMbd() {
return RouterUtil.hostName("mbd.baidu.com").r();
},
isXue() {
return RouterUtil.hostName("xue.baidu.com").r();
},
isAiQiCha() {
return RouterUtil.hostName("aiqicha.baidu.com").r();
},
isPos() {
return RouterUtil.hostName("pos.baidu.com").r();
},
isHaoKan() {
return RouterUtil.hostName("haokan.baidu.com").r();
},
isGraph() {
return RouterUtil.hostName("graph.baidu.com").r();
},
isPan() {
return RouterUtil.hostName("pan.baidu.com").r();
},
isYiYan() {
return RouterUtil.hostName("yiyan.baidu.com").r();
},
isChat() {
return RouterUtil.hostName("chat.baidu.com").r();
},
isMiniJiaoYu() {
return RouterUtil.hostName("uf9kyh.smartapps.cn").r();
},
isEasyLearn() {
return RouterUtil.hostName("easylearn.baidu.com").r();
},
isISite() {
return RouterUtil.hostName("isite.baidu.com").pathnameStartsWith("/site/wjz2tdly").r();
},
isAiStudy() {
return RouterUtil.hostName("aistudy.baidu.com").r();
},
isSmartApps_Tieba() {
return RouterUtil.hostName("byokpg.smartapps.baidu.com").r();
},
isWappass() {
return RouterUtil.hostName("wappass.baidu.com").r();
},
};
var shield_default$20 =
'div.header-down-app,\ndiv.active-enter,\ndiv.app-enter,\ndiv.coupon-active,\ndiv.cpc-adv-container,\ndiv.detail-footer.detail-footer-test,\ndiv.index-more[data-show-id="indexMoreExposure"] {\n display: none !important;\n}\n.bread-crumbs.has-down,\n.border-bottom-line {\n top: 0 !important;\n}\n';
var BaiduAiQiCha = {
init() {
addStyle$1(shield_default$20);
log.info("插入CSS规则");
this.camouflageBottomPopup();
Panel.execMenuOnce("baidu_aiqicha_shield_carousel", () => {
return this.shieldCarousel();
});
Panel.execMenuOnce("baidu_aiqicha_shield_industry_host_news", () => {
return this.shieldIndustryHostNews();
});
},
camouflageBottomPopup() {
log.info("伪装为已经弹窗过了");
_unsafeWindow.localStorage.setItem("coupon_bottom_popup", new Date().getTime().toString());
},
shieldCarousel() {
log.info("屏蔽轮播图");
return CommonUtil.addBlockCSS("div.index-banner-container.van-swipe");
},
shieldIndustryHostNews() {
log.info("屏蔽行业热点新闻");
return CommonUtil.addBlockCSS(" div.hot-news");
},
};
var BaiduAiStudy = {
init() {
addStyle$1("");
log.info("插入CSS规则");
Panel.execMenuOnce("baidu_ai_study_shieldBottomToolBar", () => {
return this.shieldBottomToolBar();
});
Panel.execMenuOnce("baidu_ai_study_autoExpandFullText", () => {
return this.autoExpandFullText();
});
},
shieldBottomToolBar() {
log.info("屏蔽底部工具栏");
return CommonUtil.addBlockCSS(".gt-edu-h5-c-article-bottom");
},
autoExpandFullText() {
log.info("自动展开全文");
return [
CommonUtil.addBlockCSS(".gt-edu-h5-c-article-content .content-wrapper .detail-wrapper .unfold-wrapper"),
addStyle$1(`
.gt-edu-h5-c-article-content .content-wrapper .detail-wrapper{
max-height: unset !important;
}
`),
];
},
};
var BaiduData = { search: { isHijack_onClick: false } };
var BaiduHook = {
$isHook: {
windowBoxJSBefore: false,
objectDefineProperty_search: false,
windowJQueryAppend: false,
windowOpenBox: false,
windowWebpackJsonp_tieba: false,
windowWebpackJsonp_haokan: false,
window_openContentBox: false,
functionCall_baijiahao_map: false,
},
$data: {
functionApply: [],
functionCall: [],
elementAppendChild: [],
setTimeout: [],
windowDefine: [],
},
functionApply(mode) {
this.$data.functionApply.push(mode);
if (this.$data.functionApply.length > 1) {
log.info("Function.property.apply hook新增劫持参数:" + mode);
return;
}
let that = this;
log.info("初始化Function.property.apply hook");
_unsafeWindow.Function.prototype.apply = function (...args) {
if (that.$data.functionApply.includes("copy"))
try {
let firstParam = args[1];
if (
args.length === 2 &&
typeof firstParam === "object" &&
"" + firstParam === "[object Arguments]" &&
firstParam.length === 1 &&
typeof firstParam[0] === "object" &&
firstParam[0] != null &&
"appName" in firstParam[0] &&
"checkTokenCopied" in firstParam[0] &&
"deeplink" in firstParam[0] &&
"scheme" in firstParam[0] &&
"token" in firstParam[0] &&
"useDeeplink" in firstParam[0]
) {
log.success("劫持复制到剪贴板函数", ...firstParam);
return new Promise(function (resolve) {
log.success("修改参数并劫持复制到剪贴板返回true");
resolve({ status: true });
});
}
} catch (error) {}
if (that.$data.functionApply.includes("scheme"))
try {
let firstParam = args[1];
if (
args.length === 2 &&
typeof firstParam === "object" &&
"" + firstParam === "[object Arguments]" &&
firstParam.length === 2 &&
firstParam[1] === "scheme"
) {
log.success("劫持Scheme", ...firstParam);
return;
}
} catch (error) {}
return OriginPrototype.Function.apply.call(this, ...args);
};
},
functionCall(mode) {
this.$data.functionCall.push(mode);
if (this.$data.functionCall.length > 1) {
log.info("Function.property.call hook新增劫持参数:" + mode);
return;
}
log.info("初始化Function.property.call hook");
let originCall = _unsafeWindow.Function.prototype.call;
_unsafeWindow.Function.prototype.call = function (...args) {
let result = originCall.apply(this, args);
if (mode === "baijiahao_invoke") {
if (
args.length === 4 &&
typeof args[1]?.["exports"] === "object" &&
"execCopy" in args[1]?.["exports"] &&
"invokeApp" in args[1]?.["exports"] &&
"invokeMarket" in args[1]?.["exports"] &&
"invokeTpApp" in args[1]?.["exports"]
) {
args[1]["exports"]["execCopy"] = function (...args) {
return new Promise((resolve) => {
log.success("阻止调用execCopy", args);
resolve(null);
});
};
args[1]["exports"]["invokeApp"] = function (...args) {
return new Promise((resolve) => {
log.success("阻止调用invokeApp", args);
resolve(null);
});
};
args[1]["exports"]["invokeMarket"] = function (...args) {
return new Promise((resolve) => {
log.success("阻止调用invokeMarket", args);
resolve(null);
});
};
args[1]["exports"]["invokeTpApp"] = function (...args) {
return new Promise((resolve) => {
log.success("阻止调用invokeTpApp", args);
resolve(null);
});
};
} else if (
args.length === 2 &&
args[0] === void 0 &&
args[1] != null &&
"arg" in args[1] &&
"delegate" in args[1] &&
"done" in args[1] &&
"method" in args[1] &&
"next" in args[1] &&
"prev" in args[1]
) {
log.success("修改参数", args[1]);
args[1]["method"] = "return";
args[1]["next"] = "end";
args[1]["prev"] = 24;
}
} else if (mode === "map") {
if (
args.length === 2 &&
args[0] === void 0 &&
args[1] != null &&
"arg" in args[1] &&
"delegate" in args[1] &&
"done" in args[1] &&
"method" in args[1] &&
"next" in args[1] &&
"prev" in args[1]
) {
log.success("修改参数", args[1]);
args[1]["method"] = "return";
args[1]["next"] = "end";
args[1]["prev"] = 24;
}
}
return result;
};
},
windowDefine(path, requirePathList, callback) {
this.$data.windowDefine.push({
path,
requirePathList,
callback,
});
if (this.$data.windowDefine.length > 1) {
log.info("define hook新增劫持参数:" + path);
return;
}
let that = this;
let safeDefine = void 0;
let unsafeDefine = function (...args) {
let define_path = args[0];
let define_requrePathList = args[1];
args[2];
for (let index = 0; index < that.$data.windowDefine.length; index++) {
let hookConfig = that.$data.windowDefine[index];
if (
hookConfig.path === define_path &&
JSON.stringify(hookConfig.requirePathList) === JSON.stringify(define_requrePathList)
) {
args[2] = hookConfig.callback;
break;
}
}
safeDefine(...args);
};
unsafeDefine.prototype.amd = {};
OriginPrototype.Object.defineProperty(_unsafeWindow, "define", {
get() {
if (safeDefine == null) return;
return unsafeDefine;
},
set(v) {
log.success("define ==> ", v);
safeDefine = v;
},
});
},
objectDefineProperty_search(menuKeyName) {
if (this.$isHook.objectDefineProperty_search) return;
this.$isHook.objectDefineProperty_search = true;
_unsafeWindow.Object.defineProperty = function (target, propertyKey, _attributes) {
if (propertyKey === "_onClick") {
BaiduData.search.isHijack_onClick = true;
log.info("成功劫持_onClick", arguments);
let oldFn = _attributes["value"];
_attributes["value"] = function (event) {
let eventNode = this._getNode(event.target);
let eventNodeName = this._getType(eventNode);
if (eventNodeName === "link") {
let linkProps = this._getLinkProps(eventNode);
log.success("点击事件-linkProps信息", linkProps);
if (!linkProps.href) {
domUtils.emit(document, "click", event, false);
return;
}
domUtils.preventEvent(event);
if (Panel.getValue("baidu_search_hijack__onClick_to_blank")) {
log.success("新标签页打开: " + linkProps.href);
window.open(linkProps.href, "_blank");
} else window.location.href = linkProps.href;
} else {
log.success("点击事件-this._getType(eventNode)不为link", eventNodeName, event);
oldFn.call(this, ...arguments);
}
};
}
return OriginPrototype.Object.defineProperty.call(this, ...arguments);
};
},
elementAppendChild(
handleCallBack = function (element) {
if (element instanceof HTMLIFrameElement) {
if (typeof element?.src === "string" && !element.src.startsWith("http")) {
log.success("劫持iframe唤醒:" + element.src, element);
return true;
}
}
}
) {
this.$data.elementAppendChild.push(handleCallBack);
if (this.$data.elementAppendChild.length > 1) {
log.info("Element.prototype.appendChild hook新增劫持判断回调");
return;
}
_unsafeWindow.Element.prototype.appendChild = function (element) {
if (typeof handleCallBack === "function") {
if (handleCallBack(element)) return;
}
return OriginPrototype.Element.appendChild.call(this, ...arguments);
};
},
windowJQueryAppend() {
if (this.$isHook.windowJQueryAppend) return;
this.$isHook.windowJQueryAppend = true;
let originAppend = _unsafeWindow.$.fn.append;
_unsafeWindow.$.fn.append = function (params) {
if (typeof params === "string") {
params = params.trim();
if (params.startsWith('