// ==UserScript==
// @name 【移动端】百度系优化
// @namespace https://github.com/WhiteSevs/TamperMonkeyScript
// @version 2025.8.27
// @author WhiteSevs
// @description 用于【移动端】的百度系列产品优化,包括【百度搜索】、【百家号】、【百度贴吧】、【百度文库】、【百度经验】、【百度百科】、【百度知道】、【百度翻译】、【百度图片】、【百度地图】、【百度好看视频】、【百度爱企查】、【百度问题】、【百度识图】等
// @license GPL-3.0-only
// @icon data:image/png;base64,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
// @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.7.5/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/domutils@1.6.5/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/pops@2.3.6/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/qmsg@1.4.0/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/viewerjs@1.11.7/dist/viewer.min.js
// @require https://fastly.jsdelivr.net/npm/vue@3.5.20/dist/vue.global.prod.js
// @require https://fastly.jsdelivr.net/npm/vue-demi@0.14.10/lib/index.iife.min.js
// @require https://fastly.jsdelivr.net/npm/pinia@3.0.3/dist/pinia.iife.prod.js
// @require https://fastly.jsdelivr.net/npm/vue-router@4.5.1/dist/vue-router.global.js
// @require https://fastly.jsdelivr.net/gh/WhiteSevs/TamperMonkeyScript@aab44c2d00b25ba1d78ffb8ee690c1b41aea01db/lib/Element-Plus/index.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.11.1/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_deleteValue
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_info
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @grant GM_unregisterMenuCommand
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @run-at document-start
// @downloadURL none
// ==/UserScript==
(function (Qmsg, DOMUtils, Utils, pops, vue, Viewer, pinia, iconsVue, vueDemi, vueRouter, ElementPlus) {
'use strict';
const a=new Set;const importCSS = async t=>{a.has(t)||(a.add(t),(n=>{function r(d){let e=document.createElement("style");if(e.setAttribute("type","text/css"),e.setAttribute("data-type","gm-css"),globalThis.trustedTypes){const l=globalThis.trustedTypes.createPolicy("safe-innerHTML",{createHTML:i=>i});e.innerHTML=l.createHTML(d);}else e.innerHTML=d;return (document.head||document.documentElement).appendChild(e),e}if(typeof GM_addStyle=="function"){GM_addStyle(n);return}r(n);})(t));};
importCSS(' @charset "UTF-8";#small-toolbar[data-v-bd816662]{position:fixed;bottom:0;width:100%;background:#fff;height:.56rem;display:flex;align-items:center;z-index:1000}#small-toolbar .icon[data-v-bd816662]{width:.2rem;height:.2rem}#small-toolbar #reply-editor[data-v-bd816662]{flex:1}#small-toolbar .small-editor-toolbar[data-v-bd816662]{flex:1;margin:10px 15px;width:100%;font-size:.16rem;line-height:.16rem;display:flex;align-items:center;position:relative}#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-bd816662]{width:100%;background:#e9e9e9;border-radius:.06rem;padding:.06rem;border:0;outline:none;font-size:.14rem;line-height:.14rem;cursor:default}#small-toolbar .small-editor-toolbar .small-editor-toolbar-emoji-btn[data-v-bd816662]{position:absolute;top:50%;right:.06rem;transform:translateY(-50%)}#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-bd816662]:focus,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-bd816662]:visited,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-bd816662]:focus-within,#small-toolbar .small-editor-toolbar .small-editor-toolbar-input[data-v-bd816662]:focus-visible{border:0;outline:none}#small-toolbar .gm-reply-other-toolbar[data-v-bd816662]{flex:0 auto;display:flex;align-items:safe center}#small-toolbar .gm-reply-other-toolbar .reply-comment-count[data-v-bd816662],#small-toolbar .gm-reply-other-toolbar .reply-good-count[data-v-bd816662]{padding:8px;display:flex;flex-direction:column;align-items:center}#small-toolbar .gm-reply-other-toolbar .reply-comment-count p.text[data-v-bd816662],#small-toolbar .gm-reply-other-toolbar .reply-good-count p.text[data-v-bd816662]{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%;outline:0!important;font-size:.16rem}.tiptap-input-image{width:.18rem;height:.18rem}#reply-editor[data-v-515fa91d]{overflow:auto;background-color:#e5e5e5;padding:.06rem;height:100%;border-radius:5px}.icon-active[data-v-16c51a10]{fill:#7557ff}#full-toolbar[data-v-16c51a10]{position:fixed;bottom:0;width:100%;background:#fff;display:flex;align-items:center;z-index:100099;flex-flow:column}#full-toolbar .full-toolbar-top-reply-user[data-v-16c51a10]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#adb5bd;width:-webkit-fill-available;width:-moz-available;padding-left:.2rem;padding-top:.06rem}#full-toolbar .full-toolbar-top-container[data-v-16c51a10]{display:flex;align-items:end;width:-moz-available;width:-webkit-fill-available;padding:.06rem .1rem;height:.6rem}#full-toolbar .full-toolbar-top-container .full-toolbar-top-left-container[data-v-16c51a10]{display:flex;flex-direction:column;flex:1;overflow:hidden;margin:0px .1rem;height:100%}#full-toolbar .full-toolbar-top-container .full-toolbar-top-right-container[data-v-16c51a10]{flex:0 auto;display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:100%}#full-toolbar .full-toolbar-bottom-container[data-v-16c51a10]{margin:.06rem 0;padding:0px 0px .06rem;margin-right:auto}#full-toolbar .full-toolbar-bottom-container .full-toolbar-emoji-btn[data-v-16c51a10],#full-toolbar .full-toolbar-bottom-container .full-toolbar-panel-at-btn[data-v-16c51a10]{margin:0 20px;display:flex;flex-direction:column;align-items:center}#full-toolbar .emoji-panel[data-v-16c51a10]{width:100%;height:30vh;background-color:#efefef;overflow:auto}.emoji-panel-huaji[data-v-16c51a10]{padding:.03rem;overflow-y:auto}.emoji-panel-huaji .el-avatar[data-v-16c51a10]{margin:16px}#full-toolbar[data-v-16c51a10]:has(.full-toolbar-top-container[data-full=true]){height:-moz-available;height:100%;height:-webkit-fill-available}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-container[data-v-16c51a10],#full-toolbar:has(.full-toolbar-top-container[data-full=true]) #reply-editor[data-v-16c51a10]{height:-moz-available;height:100%;height:-webkit-fill-available}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-reply-user[data-v-16c51a10],#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-right-container[data-v-16c51a10]{display:none}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-container[data-v-16c51a10]{flex-direction:column}#full-toolbar:has(.full-toolbar-top-container[data-full=true]) .full-toolbar-top-left-container[data-v-16c51a10]{width:-webkit-fill-available;width:-moz-available}.full-toolbar-top-nav-container[data-v-16c51a10]{display:flex;width:-webkit-fill-available;width:-moz-available;align-items:center;justify-content:space-between;padding:.16rem}#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)}.posts-container-item[data-v-03f2f267]{width:-webkit-fill-available;width:-moz-available}.posts-item-title[data-v-03f2f267]{font-weight:700}.posts-item-title[data-v-03f2f267],.posts-item-content[data-v-03f2f267],.posts-item-media-container[data-v-03f2f267]{margin:10px 0}.posts-item-footer[data-v-03f2f267]{margin:15px 0 5px}.posts-item-footer .el-col[data-v-03f2f267]{text-align:center}.posts-item-footer-icon-container[data-v-03f2f267]{display:flex;align-items:center;justify-content:center;gap:0px 6px}.posts-item-right-user-info[data-v-03f2f267]{padding:0 10px}.posts-container[data-v-c87cf9db]{background:#f2f2f4;padding:10px}.posts-container-item[data-v-c87cf9db]{background:#fff;border-radius:12px;margin:10px 0;padding:10px}.posts-item-title[data-v-c87cf9db]{font-weight:700}.posts-item-title[data-v-c87cf9db],.posts-item-content[data-v-c87cf9db],.posts-item-media-container[data-v-c87cf9db]{margin:10px 0}.posts-item-footer[data-v-c87cf9db]{margin:15px 0 5px}.posts-item-footer .el-col[data-v-c87cf9db]{text-align:center}.posts-item-footer-icon-container[data-v-c87cf9db]{display:flex;align-items:center;justify-content:center;gap:0px 6px}.posts-item-right-user-info[data-v-c87cf9db]{padding:0 10px}.follow-forum-container[data-v-fc2491a8]{background:#f2f2f4;padding:10px}.follow-forum-list-container[data-v-fc2491a8]{background:#fff;border-radius:12px;margin:10px 0;padding:10px}.follow-forum-item[data-v-fc2491a8]{width:50%;max-width:50%;display:flex;align-items:flex-start;margin:10px 0}.follow-forum-avatar[data-v-fc2491a8]{border-radius:12px}.follow-forum-item-right-container[data-v-fc2491a8]{margin:0 10px;width:inherit;display:flex;flex-direction:column}.follow-forum-item-name[data-v-fc2491a8]{display:flex;align-items:center;width:-webkit-fill-available;width:-moz-available}.follow-forum-item-level[data-level][data-v-fc2491a8]{margin:5px;padding:2px;border-radius:3px;font-size:.6rem;line-height:.6rem;font-weight:700;text-align:center;background:var(--c4fc5984);color:var(--632896fa)}.follow-forum-item-level[data-level="0"][data-v-fc2491a8],.follow-forum-item-level[data-level="1"][data-v-fc2491a8],.follow-forum-item-level[data-level="2"][data-v-fc2491a8],.follow-forum-item-level[data-level="3"][data-v-fc2491a8]{background:var(--67c41881)}.follow-forum-item-level[data-level="4"][data-v-fc2491a8],.follow-forum-item-level[data-level="5"][data-v-fc2491a8],.follow-forum-item-level[data-level="6"][data-v-fc2491a8],.follow-forum-item-level[data-level="7"][data-v-fc2491a8],.follow-forum-item-level[data-level="8"][data-v-fc2491a8],.follow-forum-item-level[data-level="9"][data-v-fc2491a8]{background:var(--67c4278b)}.follow-forum-item-level[data-level="10"][data-v-fc2491a8],.follow-forum-item-level[data-level="11"][data-v-fc2491a8],.follow-forum-item-level[data-level="12"][data-v-fc2491a8],.follow-forum-item-level[data-level="13"][data-v-fc2491a8],.follow-forum-item-level[data-level="14"][data-v-fc2491a8],.follow-forum-item-level[data-level="15"][data-v-fc2491a8]{background:var(--f1cd3cbe)}.follow-forum-item-level[data-level="16"][data-v-fc2491a8],.follow-forum-item-level[data-level="17"][data-v-fc2491a8],.follow-forum-item-level[data-level="18"][data-v-fc2491a8]{background:var(--f1c7c844)}.follow-forum-item-info[data-v-fc2491a8]{word-wrap:break-word}#main[data-v-c9e3d74e]{z-index:1000;width:100%;height:100%}.big-text[data-v-c9e3d74e]{font-weight:700}.top-container[data-v-c9e3d74e]{width:-webkit-fill-available;width:-moz-available;padding:15px 15px 0}.user-info-bg[data-v-c9e3d74e]{width:100%;height:100px}.user-info-bg-main[data-v-c9e3d74e]{width:100%;height:160px;position:absolute;background:url(https://tb2.bdstatic.com/tb/mobile/suser/img/home_card_back_6cdfca5.jpg);background-size:100%;background-repeat:no-repeat}.user-avatar-top-background[data-v-c9e3d74e]{position:absolute;width:100%;height:40%;padding:0;margin:0;border-top-left-radius:12px;border-top-right-radius:12px;background:#fff;transform:translateY(100%)}.user-info-container[data-v-c9e3d74e]{padding:0 10px}.nav-left-arrow-icon[data-v-8128767d]{align-content:center;padding-left:0!important}.nav-title[data-v-8128767d]{font-weight:700;text-align:center;padding:10px}.user-avatar[data-v-8128767d]{text-align:center;padding-bottom:20px}.user-info-item[data-v-8128767d]{display:flex;padding:10px;flex-wrap:wrap}.user-desc-key[data-v-8128767d]{width:60px;display:block}.user-end-text[data-v-8128767d]{padding:0 20px}.user-top[data-v-42d9f9f5]{height:40px;width:100%;position:relative}.top-left-arrow-icon[data-v-42d9f9f5]{align-content:center;padding-left:0!important}.top-title-name[data-v-42d9f9f5]{text-align:center;padding:10px}.user-main[data-v-42d9f9f5]{padding:0;position:absolute;inset:40px 0 0;width:100%;height:calc(100% - 40px)}.user-container[data-v-42d9f9f5]{padding:0 10px}.user-container .el-scrollbar__view[data-v-42d9f9f5]{height:100%}.user-item[data-v-42d9f9f5]{margin:10px 0}.user-item-row[data-v-42d9f9f5]{display:flex;align-items:center;justify-content:space-between}.user-item-row-center[data-v-42d9f9f5]{padding:0 10px}.user-name[data-v-42d9f9f5],.user-sign-text[data-v-42d9f9f5]{text-align:left}.user-sign-text[data-v-42d9f9f5]{color:#a2a2a2}.user-follow-btn[data-v-42d9f9f5]{float:right}.user-info[data-v-42d9f9f5]{display:grid}.user-item-row-left[data-v-42d9f9f5]{display:flex}.user-item-row-right[data-v-42d9f9f5]{float:right}.user-top[data-v-205eb1c6]{height:40px;width:100%;position:relative}.top-left-arrow-icon[data-v-205eb1c6]{align-content:center;padding-left:0!important}.top-title-name[data-v-205eb1c6]{text-align:center;padding:10px}.user-main[data-v-205eb1c6]{padding:0;position:absolute;inset:40px 0 0;width:100%;height:calc(100% - 40px)}.user-container[data-v-205eb1c6]{padding:0 10px}.user-container .el-scrollbar__view[data-v-205eb1c6]{height:100%}.user-item[data-v-205eb1c6]{margin:10px 0}.user-item-row[data-v-205eb1c6]{display:flex;align-items:center;justify-content:space-between}.user-item-row-center[data-v-205eb1c6]{padding:0 10px;align-content:center}.user-name[data-v-205eb1c6],.user-sign-text[data-v-205eb1c6]{text-align:left}.user-sign-text[data-v-205eb1c6]{color:#a2a2a2}.user-follow-btn[data-v-205eb1c6]{float:right}.user-info[data-v-205eb1c6]{display:grid}.user-item-row-left[data-v-205eb1c6]{display:flex}.user-item-row-right[data-v-205eb1c6]{float:right}.router-view-container[data-v-37c7691d]{padding:20px}.router-view-container .layout-item[data-v-37c7691d]{display:flex;align-items:center;gap:10px;padding:10px 0}.router-view-container .layout-icon img[data-v-37c7691d]{width:100%;height:100%}.router-view-container .layout-text[data-v-37c7691d]{flex:1}.post-list-item[data-v-449f473f]{display:flex;flex-direction:column;gap:10px;padding:10px 15px;border-bottom:5px solid #efefef}.post-list-item[data-v-449f473f]:last-child{border-bottom:0}.user-info[data-v-449f473f]{display:flex;align-items:center;gap:5px}.user-time[data-v-449f473f]{font-size:.8em;color:#999}.user-avatar img[data-v-449f473f]{width:35px;height:35px;border-radius:50%}.reply-content[data-v-449f473f]{font-size:.9em;color:#4a4a4a}.post-info[data-v-449f473f]{display:flex;align-items:center;background-color:#efefef;color:#434343;border-radius:6px}.post-info__inner[data-v-449f473f]{display:flex;align-items:center;height:100px;width:100%}.post-content[data-v-449f473f]{overflow:hidden;line-clamp:2;-webkit-line-clamp:2;display:-webkit-box;-webkit-box-orient:vertical;color:#545454;margin-left:5px}.post-image[data-v-449f473f]{width:100px;height:100px}.post-image img[data-v-449f473f]{width:inherit;height:inherit;border-radius:6px}.fname-text[data-v-449f473f]{color:#999}.bottom-msg[data-v-449f473f]{text-align:center;color:#999;padding:10px 0}.post-list-item[data-v-ec39056c]{display:flex;flex-direction:column;gap:10px;padding:10px 15px;border-bottom:5px solid #efefef}.post-list-item[data-v-ec39056c]:last-child{border-bottom:0}.user-info[data-v-ec39056c]{display:flex;align-items:center;gap:5px}.user-time[data-v-ec39056c]{font-size:.8em;color:#999}.user-avatar img[data-v-ec39056c]{width:35px;height:35px;border-radius:50%}.reply-content[data-v-ec39056c]{font-size:.9em;color:#4a4a4a}.post-info[data-v-ec39056c]{display:flex;align-items:center;background-color:#efefef;color:#434343;border-radius:6px}.post-info__inner[data-v-ec39056c]{display:flex;align-items:center;height:100px;width:100%}.post-content[data-v-ec39056c]{overflow:hidden;line-clamp:2;-webkit-line-clamp:2;display:-webkit-box;-webkit-box-orient:vertical;color:#545454;margin-left:5px}.post-info[data-v-ec39056c]:has(.quote-user){flex-direction:column;align-items:start;padding:10px;gap:10px}.post-info:has(.quote-user) .post-content[data-v-ec39056c]{flex:1;align-content:center;padding:0 10px;margin-left:0;background:#fff;height:inherit}.post-image[data-v-ec39056c]{width:100px;height:100px}.post-image img[data-v-ec39056c]{width:inherit;height:inherit;border-radius:6px}.fname-text[data-v-ec39056c]{color:#999}.bottom-msg[data-v-ec39056c],.bottom-msg[data-v-38eb1bd2]{text-align:center;color:#999;padding:10px 0}.user-top[data-v-3c912918]{--el-header-height: 40px;display:flex;align-items:center;position:fixed;top:0;left:0;right:0;background:#fff}.top-nav-container[data-v-3c912918]{align-items:center;width:100%}.top-title-name[data-v-3c912918]{text-align:center;position:absolute;left:50%;transform:translate(-50%)}.main[data-v-3c912918]{padding:0;margin:40px 0 0} ');
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var require_entrance_001 = __commonJS({
"entrance-CW-nnNLK.js"(exports, module) {
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_registerMenuCommand = (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
var _GM_setValue = (() => typeof GM_setValue != "undefined" ? GM_setValue : 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)();
const BaiduRouter = {
isSearch() {
return Boolean(
window.location.href.match(
/^http(s|):\/\/(m[0-9]{0,2}|www).baidu.com\/.*/g
)
);
},
isSearchBh() {
return Boolean(
this.isSearch() && window.location.pathname.startsWith("/bh")
);
},
isSearchVideo() {
return Boolean(
this.isSearch() && window.location.pathname.startsWith("/video/page")
);
},
isSearchHome() {
return Boolean(
window.location.href.match(
/^http(s|):\/\/(m[0-9]{0,2}|www).baidu.com\/$/g
) || window.location.href.match(
/^http(s|):\/\/(m[0-9]{0,2}|www).baidu.com\/(\?ref=|\?tn=|\?from=|#\/)/g
)
);
},
isSearchVSearch() {
return this.isSearch() && window.location.pathname.startsWith("/sf/vsearch");
},
isSearchVSearch_image_content() {
let searchParams = new URLSearchParams(window.location.search);
return this.isSearchVSearch() && searchParams.has("pd", "image_content");
},
isSearchVSearch_note() {
let searchParams = new URLSearchParams(window.location.search);
return this.isSearchVSearch() && searchParams.has("pd", "note");
},
isSearchWenDaTab() {
let searchParams = new URLSearchParams(window.location.search);
return this.isSearchVSearch() && searchParams.has("pd", "wenda_tab");
},
isBaiJiaHao() {
return Boolean(
window.location.href.match(/^http(s|):\/\/baijiahao.baidu.com/g)
);
},
isTieBa() {
return Boolean(
window.location.href.match(
/^http(s|):\/\/(tieba|ala|static.tieba|nba|fexclick|youhua|tiebaswan).baidu.com/g
) || window.location.href.match(/^http(s|):\/\/(www.tieba|jump2.bdimg).com/g)
);
},
isTieBaPost() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/p/")
);
},
isTieBaNewTopic() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/mo/q/newtopic/topicTemplate")
);
},
isTieBaHottopic() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/hottopic/browse/hottopic")
);
},
isTieBaHybrid() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/mo/q/hybrid/search")
);
},
isTieBaCheckUrl() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/mo/q/checkurl")
);
},
isTieBaNei() {
return Boolean(this.isTieBa() && window.location.pathname === "/f");
},
isTieBaIndex() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/index")
);
},
isTieBaHome() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith("/home/main")
);
},
isTieBaCollectionCenter() {
return Boolean(
this.isTieBa() && window.location.pathname.startsWith(
"/mo/q/hybrid-main-user/collectionCenter"
)
);
},
isWenKu() {
return Boolean(
window.location.href.match(/^http(s|):\/\/(wk|tanbi).baidu.com/g)
);
},
isJingYan() {
return Boolean(
window.location.href.match(/^http(s|):\/\/jingyan.baidu.com/g)
);
},
isBaiKe() {
return Boolean(
window.location.href.match(/^http(s|):\/\/(baike|wapbaike).baidu.com/g)
);
},
isBaiKeTaShuo() {
return Boolean(
this.isBaiKe() && window.location.pathname.startsWith("/tashuo")
);
},
isZhiDao() {
return Boolean(
window.location.href.match(/^http(s|):\/\/zhidao.baidu.com/g)
);
},
isFanYi() {
return Boolean(
window.location.href.match(/^http(s|):\/\/fanyi.baidu.com/g)
);
},
isFanYiApp() {
return Boolean(
window.location.href.match(/^http(s|):\/\/fanyi-app.baidu.com/g)
);
},
isImage() {
return Boolean(
window.location.href.match(/^http(s|):\/\/image.baidu.com/g)
);
},
isMap() {
return Boolean(window.location.href.match(/^http(s|):\/\/map.baidu.com/g));
},
isMbd() {
return Boolean(window.location.href.match(/^http(s|):\/\/mbd.baidu.com/g));
},
isXue() {
return Boolean(window.location.href.match(/^http(s|):\/\/xue.baidu.com/g));
},
isAiQiCha() {
return Boolean(
window.location.href.match(/^http(s|):\/\/aiqicha.baidu.com/g)
);
},
isPos() {
return Boolean(window.location.href.match(/^http(s|):\/\/pos.baidu.com/g));
},
isHaoKan() {
return Boolean(
window.location.href.match(/^http(s|):\/\/haokan.baidu.com/g)
);
},
isGraph() {
return Boolean(
window.location.href.match(/^http(s|):\/\/graph.baidu.com/g)
);
},
isPan() {
return Boolean(window.location.href.match(/^http(s|):\/\/pan.baidu.com/g));
},
isYiYan() {
return Boolean(
window.location.href.match(/^http(s|):\/\/yiyan.baidu.com/g)
);
},
isChat() {
return Boolean(window.location.href.match(/^http(s|):\/\/chat.baidu.com/g));
},
isMiniJiaoYu() {
return Boolean(
window.location.href.match(/^http(s|):\/\/uf9kyh.smartapps.cn/g)
);
},
isEasyLearn() {
return Boolean(
window.location.href.match(/^http(s|):\/\/easylearn.baidu.com/g)
);
},
isISite() {
return Boolean(
window.location.href.match(
/^http(s|):\/\/isite.baidu.com\/site\/wjz2tdly/g
)
);
},
isAiStudy() {
return Boolean(
window.location.href.match(/^http(s|):\/\/aistudy.baidu.com/g)
);
},
isSmartApps_Tieba() {
return Boolean(window.location.hostname === "byokpg.smartapps.baidu.com");
}
};
const KEY = "GM_Panel";
const ATTRIBUTE_INIT = "data-init";
const ATTRIBUTE_KEY = "data-key";
const ATTRIBUTE_DEFAULT_VALUE = "data-default-value";
const ATTRIBUTE_INIT_MORE_VALUE = "data-init-more-value";
const PROPS_STORAGE_API = "data-storage-api";
const PanelUISize = {
setting: {
get width() {
if (window.innerWidth < 550) {
return "88vw";
} else if (window.innerWidth < 700) {
return "550px";
} else {
return "700px";
}
},
get height() {
if (window.innerHeight < 450) {
return "70vh";
} else if (window.innerHeight < 550) {
return "450px";
} else {
return "550px";
}
}
},
settingMiddle: {
get width() {
return window.innerWidth < 350 ? "88vw" : "350px";
}
},
info: {
get width() {
return window.innerWidth < 350 ? "88vw" : "350px";
},
get height() {
return window.innerHeight < 250 ? "88vh" : "250px";
}
}
};
class StorageUtils {
storageKey;
listenerData;
constructor(key) {
if (typeof key === "string") {
let trimKey = key.trim();
if (trimKey == "") {
throw new Error("key参数不能为空字符串");
}
this.storageKey = trimKey;
} else {
throw new Error("key参数类型错误,必须是字符串");
}
this.listenerData = new Utils.Dictionary();
}
getLocalValue() {
let localValue = _GM_getValue(this.storageKey);
if (localValue == null) {
localValue = {};
this.setLocalValue(localValue);
}
return localValue;
}
setLocalValue(value) {
_GM_setValue(this.storageKey, value);
}
set(key, value) {
let oldValue = this.get(key);
let localValue = this.getLocalValue();
Reflect.set(localValue, key, value);
this.setLocalValue(localValue);
this.triggerValueChangeListener(key, oldValue, value);
}
get(key, defaultValue) {
let localValue = this.getLocalValue();
return Reflect.get(localValue, key) ?? defaultValue;
}
getAll() {
let localValue = this.getLocalValue();
return localValue;
}
delete(key) {
let oldValue = this.get(key);
let localValue = this.getLocalValue();
Reflect.deleteProperty(localValue, key);
this.setLocalValue(localValue);
this.triggerValueChangeListener(key, oldValue, void 0);
}
has(key) {
let localValue = this.getLocalValue();
return Reflect.has(localValue, key);
}
keys() {
let localValue = this.getLocalValue();
return Reflect.ownKeys(localValue);
}
values() {
let localValue = this.getLocalValue();
return Reflect.ownKeys(localValue).map(
(key) => Reflect.get(localValue, key)
);
}
clear() {
_GM_deleteValue(this.storageKey);
}
addValueChangeListener(key, callback) {
let listenerId = Math.random();
let 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;
}
triggerValueChangeListener(key, oldValue, newValue) {
if (!this.listenerData.has(key)) {
return;
}
let listenerData = this.listenerData.get(key);
for (let index = 0; index < listenerData.length; index++) {
const data = listenerData[index];
if (typeof data.callback === "function") {
let value = this.get(key);
let __newValue;
let __oldValue;
if (typeof oldValue !== "undefined" && arguments.length >= 2) {
__oldValue = oldValue;
} else {
__oldValue = value;
}
if (typeof newValue !== "undefined" && arguments.length > 2) {
__newValue = newValue;
} else {
__newValue = value;
}
data.callback(key, __oldValue, __newValue);
}
}
}
}
const PopsPanelStorageApi = new StorageUtils(KEY);
const PanelContent = {
$data: {
__contentConfig: null,
get contentConfig() {
if (this.__contentConfig == null) {
this.__contentConfig = new utils.Dictionary();
}
return this.__contentConfig;
}
},
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() {
return [
{
id: "script-version",
title: `版本:${_GM_info?.script?.version || "未知"}`,
isBottom: true,
forms: [],
clickFirstCallback(event, rightHeaderElement, rightContainerElement) {
let supportURL = _GM_info?.script?.supportURL || _GM_info?.script?.namespace;
if (typeof supportURL === "string" && utils.isNotNull(supportURL)) {
window.open(supportURL, "_blank");
}
return false;
}
}
];
}
};
const 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 (!Panel.isTopWindow()) {
return;
}
GM_Menu.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);
}
};
const CommonUtil = {
waitRemove(...args) {
args.forEach((selector) => {
if (typeof selector !== "string") {
return;
}
utils.waitNodeList(selector).then((nodeList) => {
nodeList.forEach(($el) => $el.remove());
});
});
},
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);
}
});
return addStyle$1(`${selectorList.join(",\n")}{display: none !important;}`);
},
setGMResourceCSS(resourceMapData) {
let cssText = typeof _GM_getResourceText === "function" ? _GM_getResourceText(resourceMapData.keyName) : null;
if (typeof cssText === "string" && cssText) {
addStyle$1(cssText);
} else {
CommonUtil.loadStyleLink(resourceMapData.url);
}
},
async loadStyleLink(url) {
let $link = document.createElement("link");
$link.rel = "stylesheet";
$link.type = "text/css";
$link.href = url;
DOMUtils.ready(() => {
document.head.appendChild($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.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;
}
let urlInstance = new URL(url);
urlInstance.protocol = "https:";
return urlInstance.toString();
},
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((permissionStatus) => {
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) => {
let 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 = DOMUtils.closest($el, parentSelector);
if ($parent) {
let $target = $parent.querySelector(selector);
return $target;
}
} else {
if (DOMUtils.matches($el, selector)) {
return $el;
}
let $parent = DOMUtils.closest($el, selector);
return $parent;
}
}
};
const Panel = {
$data: {
__contentConfigInitDefaultValue: null,
__onceExecMenuData: 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 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();
},
isTopWindow() {
return _unsafeWindow.top === _unsafeWindow.self;
},
initContentDefaultValue() {
const initDefaultValue = (config) => {
if (!config.attributes) {
return;
}
if (config.type === "button" || config.type === "forms" || config.type === "deepMenu") {
return;
}
let menuDefaultConfig = new Map();
let key = config.attributes[ATTRIBUTE_KEY];
if (key != null) {
const defaultValue = config.attributes[ATTRIBUTE_DEFAULT_VALUE];
menuDefaultConfig.set(key, defaultValue);
}
let moreMenuDefaultConfig = config.attributes[ATTRIBUTE_INIT_MORE_VALUE];
if (typeof moreMenuDefaultConfig === "object" && moreMenuDefaultConfig) {
Object.keys(moreMenuDefaultConfig).forEach((key2) => {
menuDefaultConfig.set(key2, moreMenuDefaultConfig[key2]);
});
}
if (!menuDefaultConfig.size) {
log.warn(["请先配置键", config]);
return;
}
let __attr_init__ = config.attributes[ATTRIBUTE_INIT];
if (typeof __attr_init__ === "function") {
let __attr_result__ = __attr_init__();
if (typeof __attr_result__ === "boolean" && !__attr_result__) {
return;
}
}
if (config.type === "switch") {
let 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++) {
let configItem = configList[index];
initDefaultValue(configItem);
let child_forms = configItem.forms;
if (child_forms && Array.isArray(child_forms)) {
loopInitDefaultValue(child_forms);
}
}
};
const contentConfigList = [...PanelContent.getAllContentConfig()];
for (let index = 0; index < contentConfigList.length; index++) {
let leftContentConfigItem = contentConfigList[index];
if (!leftContentConfigItem.forms) {
continue;
}
const rightContentConfigList = leftContentConfigItem.forms;
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);
}
this.$data.contentConfigInitDefaultValue.set(key, defaultValue);
},
setValue(key, value) {
PopsPanelStorageApi.set(key, value);
},
getValue(key, defaultValue) {
let 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) {
let listenerId = PopsPanelStorageApi.addValueChangeListener(key, (__key, __newValue, __oldValue) => {
callback(key, __oldValue, __newValue);
});
return listenerId;
},
removeValueChangeListener(listenerId) {
PopsPanelStorageApi.removeValueChangeListener(listenerId);
},
triggerMenuValueChange(key, newValue, oldValue) {
PopsPanelStorageApi.triggerValueChangeListener(key, oldValue, newValue);
},
exec(queryKey, callback, checkExec, once = true) {
const that = this;
let queryKeyFn;
if (typeof queryKey === "string" || Array.isArray(queryKey)) {
queryKeyFn = () => queryKey;
} else {
queryKeyFn = queryKey;
}
let isArrayKey = false;
let queryKeyResult = queryKeyFn();
let keyList = [];
if (Array.isArray(queryKeyResult)) {
isArrayKey = true;
keyList = queryKeyResult;
} else {
keyList.push(queryKeyResult);
}
let findNotInDataKey = keyList.find((it) => !this.$data.contentConfigInitDefaultValue.has(it));
if (findNotInDataKey) {
log.warn(`${findNotInDataKey} 键不存在`);
return;
}
let storageKey = JSON.stringify(keyList);
if (once) {
if (this.$data.onceExecMenuData.has(storageKey)) {
return;
}
this.$data.onceExecMenuData.set(storageKey, 1);
}
let storeValueList = [];
let listenerIdList = [];
let dynamicAddStyleNodeCallback = (value, $style) => {
let dynamicResultList = [];
if (!Array.isArray($style)) {
$style = [$style];
}
$style.forEach(($styleItem) => {
if ($styleItem == null) {
return;
}
if ($styleItem instanceof HTMLStyleElement) {
dynamicResultList.push($styleItem);
return;
}
});
{
storeValueList = storeValueList.concat(dynamicResultList);
}
};
let getMenuValue = (key) => {
let value = this.getValue(key);
return value;
};
let clearBeforeStoreValue = () => {
for (let index = 0; index < storeValueList.length; index++) {
let $css = storeValueList[index];
$css.remove();
storeValueList.splice(index, 1);
index--;
}
};
let checkMenuExec = () => {
let flag = false;
if (typeof checkExec === "function") {
flag = checkExec(keyList);
} else {
flag = keyList.every((key) => getMenuValue(key));
}
return flag;
};
let valueChangeCallback = (valueOption) => {
let execFlag = checkMenuExec();
let resultList = [];
if (execFlag) {
let valueList = keyList.map((key) => this.getValue(key));
let callbackResult = callback({
value: isArrayKey ? valueList : valueList[0],
addStyleElement: (...args) => {
return dynamicAddStyleNodeCallback(true, ...args);
}
});
if (!Array.isArray(callbackResult)) {
callbackResult = [callbackResult];
}
callbackResult.forEach((it) => {
if (it == null) {
return;
}
if (it instanceof HTMLStyleElement) {
resultList.push(it);
return;
}
});
}
clearBeforeStoreValue();
storeValueList = [...resultList];
};
once && keyList.forEach((key) => {
let listenerId = this.addValueChangeListener(key, (key2, newValue, oldValue) => {
valueChangeCallback();
});
listenerIdList.push(listenerId);
});
valueChangeCallback();
let result = {
clear() {
this.clearStoreStyleElements();
this.removeValueChangeListener();
once && that.$data.onceExecMenuData.delete(storageKey);
},
clearStoreStyleElements: () => {
return clearBeforeStoreValue();
},
removeValueChangeListener: () => {
listenerIdList.forEach((listenerId) => {
this.removeValueChangeListener(listenerId);
});
}
};
return result;
},
execMenu(key, callback, isReverse = false, once = false) {
return this.exec(
key,
(option) => {
return callback(option);
},
(keyList) => {
let execFlag = keyList.every((__key__) => {
let flag = !!this.getValue(__key__);
let disabled = Panel.$data.contentConfigInitDisabledKeys.includes(__key__);
if (disabled) {
flag = false;
log.warn(`.execMenu${once ? "Once" : ""} ${__key__} 被禁用`);
}
isReverse && (flag = !flag);
return flag;
});
return execFlag;
},
once
);
},
execMenuOnce(key, callback, isReverse = false) {
return this.execMenu(key, callback, isReverse, true);
},
deleteExecMenuOnce(key) {
this.$data.onceExecMenuData.delete(key);
let flag = PopsPanelStorageApi.removeValueChangeListener(key);
return flag;
},
onceExec(key, callback) {
key = this.transformKey(key);
if (typeof key !== "string") {
throw new TypeError("key 必须是字符串");
}
if (this.$data.onceExecData.has(key)) {
return;
}
callback();
this.$data.onceExecData.set(key, 1);
},
deleteOnceExec(key) {
key = this.transformKey(key);
this.$data.onceExecData.delete(key);
},
showPanel(content, title = `${SCRIPT_NAME}-设置`, preventDefaultContentConfig = false, preventRegisterSearchPlugin = false) {
this.$data.$panel = null;
this.$data.panelContent = [];
let checkHasBottomVersionContentConfig = content.findIndex((it) => {
let isBottom = typeof it.isBottom === "function" ? it.isBottom() : Boolean(it.isBottom);
return isBottom && it.id === "script-version";
}) !== -1;
if (!preventDefaultContentConfig && !checkHasBottomVersionContentConfig) {
content.push(...PanelContent.getDefaultBottomContentConfig());
}
let $panel = __pops.panel({
...{
title: {
text: title,
position: "center",
html: false,
style: ""
},
content,
btn: {
close: {
enable: true,
callback: (details, event) => {
details.close();
this.$data.$panel = null;
}
}
},
mask: {
enable: true,
clickEvent: {
toClose: true,
toHide: false
},
clickCallBack: (originalRun, config) => {
originalRun();
this.$data.$panel = null;
}
},
width: PanelUISize.setting.width,
height: PanelUISize.setting.height,
drag: true,
only: true
},
...this.$data.panelConfig
});
this.$data.$panel = $panel;
this.$data.panelContent = content;
if (!preventRegisterSearchPlugin) {
this.registerConfigSearch({ $panel, content });
}
},
registerConfigSearch(config) {
const { $panel, content } = config;
let asyncQueryProperty = async (target, handler) => {
if (target == null) {
return;
}
let handleResult = await handler(target);
if (handleResult && typeof handleResult.isFind === "boolean" && handleResult.isFind) {
return handleResult.data;
}
return await asyncQueryProperty(handleResult.data, handler);
};
let 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" });
};
let addFlashingClass = ($el) => {
const flashingClassName = "pops-flashing";
domUtils.animationend($el, () => {
$el.classList.remove(flashingClassName);
});
$el.classList.add(flashingClassName);
};
let dbclick_event = (evt, selectorTarget) => {
utils.preventEvent(evt);
let $alert = __pops.alert({
title: {
text: "搜索配置",
position: "center"
},
content: {
text: (
`