import { addStyle, DOMUtils, log, utils } from "@/env"; import { BaiduRouter } from "@/router/BaiduRouter"; import { Panel } from "@components/setting/panel"; import { CommonUtil } from "@components/utils/CommonUtil"; import { BaiduHeadlth } from "./bh/SearchHealth"; import { BaiduSearchBlockRule } from "./SearchBlockRule"; import { BaiduHandleResultItem } from "./SearchHandleResultItem"; import { BaiduSearchHook } from "./SearchHook"; import { SearchInputEvent } from "./SearchInput"; import { SearchNextPage, SearchNextPage_SearchCraft } from "./SearchNextPage"; import { BaiduSearchToolBar } from "./SearchToolBar"; import SearchShieldCSS from "./shield.css?raw"; import { BaiduSearchVideo } from "./video/SearchVideo"; import { BaiduSearchVSearch } from "./vsearch/VSearch"; /** * 处理百度搜索自定义的样式添加 */ const UserCustomStyle = { /** * 获取用户自定义样式 */ getUserStyle() { return Panel.getValue("baidu-search-user-style", ""); }, }; const BaiduSearch = { async init() { addStyle(UserCustomStyle.getUserStyle()); log.info("插入用户CSS规则"); BaiduSearchBlockRule.init(); Panel.execMenuOnce("baidu-search-global-searchToolBar", () => { BaiduSearchToolBar.init(); }); if (BaiduRouter.isSearchBh()) { // 百度健康 BaiduHeadlth.init(); } else if (BaiduRouter.isSearchVideo()) { // 视频页 BaiduSearchVideo.init(); } else { // 默认的百度搜索 BaiduSearchHook.init(); addStyle(SearchShieldCSS); BaiduHandleResultItem.addCSDNFlagCSS(); log.info("插入CSS规则"); Panel.execMenu("baidu_search_hijack__onClick_to_blank", () => { this.openResultBlank(); }); DOMUtils.onReady(() => { // 解析真实地址 from