// ==UserScript== // @name 搜索引擎 优化/美化/净化/增强 搜索引擎快速切换 百度必应谷歌/Baidu/Bing/Google // @name:zh 搜索引擎 优化/美化/净化/增强 搜索引擎快速切换 百度必应谷歌/Baidu/Bing/Google 搜索引擎快速切换 // @namespace http://github.com/yuhanawa/UserScript // @description 搜索引擎 优化/美化/净化/增强 搜索引擎快速切换 百度必应谷歌/Baidu/Bing/Google 搜索引擎快速切换 开发中... // @description:zh 搜索引擎 优化/美化/净化/增强 搜索引擎快速切换 百度必应谷歌/Baidu/Bing/Google 搜索引擎快速切换 开发中... // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_registerMenuCommand // @grant GM_openInTab // @grant unsafeWindow // @match *://*/* // @match *://yuhan-script-config.netlify.app/* // @match *://user-script-config-form.vercel.app/* // @match *://yuhanawa.github.io/tools/userscriptconfig/* // @version 0.5.8 // @node 更新日志请见 https://github.com/yuhanawa/UserScript/blob/master/CHANGELOG.md // @author Yuhanawa // @supportURL https://greasyfork.org/zh-CN/scripts/449705/feedback // @license GPL-3.0 // @icon none // @run-at document-start // ==/UserScript== /* search v.0.5.8 by Yuhanawa Source: https://github.com/Yuhanawa/UserScript */ isLoaded=!1,onload(()=>isLoaded=!0);const __props__=new Map; function get(k,d){return GM_getValue(k,void 0===d?__props__.get(k):d)} function set(k,v){return GM_setValue(k,v)} function cfg(k,v){return void 0===v?get(k):set(k,v)} function getOptionKeyAndName(optionStr){var key=optionStr.match(/\$([^ ]+)/)?.[0];return key?{key:key.replace("$",""),name:optionStr.replace(key,"")}:{key:optionStr,name:optionStr}} function style(css){var node;"undefined"!=typeof GM_addStyle?GM_addStyle(css):((node=document.createElement("style")).appendChild(document.createTextNode(css)),document.body.appendChild(node))} function addMenu(name,key,options,current,index,onclick){const getOptionKey=o=>getOptionKeyAndName(o).key;void 0!==current&&null!=index&&-1!==index||(current=set(key,getOptionKey(options[0])),index=0);var o=`${name}:${o=options[index],getOptionKeyAndName(o).name}[${index+1}/${options.length}]<点击切换`;return GM_registerMenuCommand(o,()=>{if(set(key,getOptionKey(options[index+1>=options.length?0:index+1])),onclick)try{onclick()}catch(e){console.log(`发生错误(${name}-${current}-onclick): `+e)}location.reload()}),index} function onload(f){isLoaded?f():document.addEventListener("DOMContentLoaded",()=>f())} function timeoutAfterLoad(f,t){onload(()=>setTimeout(()=>f(),t))} function intervalAfterLoad(f,t,runOnFirst){onload(()=>{runOnFirst&&f(),setInterval(f,t)})} function run(fts){void 0===fts&&(fts=features);for(const key of Object.keys(fts))try{const feature=fts[key];("boolean"==typeof feature.match&&1==feature.match||0!==feature.match.filter(m=>"string"==typeof m?null!==window.location.href.match(m):m.test(window.location.href)).length)&&addFeature(key,feature)}catch(error){console.error("发生了一个意料之外的错误, 这可能是因为非法的feature所造成的, 不过请放心, 脚本将继续运行而不会崩溃. ",feature,error)}} function addFeature(key,feature){var{name,values}=feature;if(!feature.switchable||get(key+"_switch",feature.default_switch_state??!0))if("$"===name||feature.directlyRun)try{"function"==typeof values?"string"==typeof(result=values(feature))&&style(result):"string"==typeof values&&style(values)}catch(e){console.error(e)}else{var result=Object.keys(values),key0=getOptionKeyAndName(result[0]).key;let current=get(key,key0),index=result.findIndex(x=>getOptionKeyAndName(x).key===current);-1!==index&&void 0!==index||(set(key,key0),index=0,current=key0),feature.hideInMenu||addMenu(name,key,result,current,index);try{var value=values[result[index]];if(null!=value)if("function"==typeof value){const result=value(feature);"string"==typeof result&&style(result)}else"string"==typeof value&&style(value)}catch(e){console.error(e)}}} function findFastestSite(sites){return new Promise((resolve,reject)=>{let fastestSite=null,fastestTime=1/0,completedRequests=0;sites.forEach(function(site){const xhr=new XMLHttpRequest,startTime=(new Date).getTime();xhr.onreadystatechange=()=>{var timeElapsed;fastestTime<100&&(xhr.abort(),resolve(fastestSite)),xhr.readyState===XMLHttpRequest.DONE&&(timeElapsed=(new Date).getTime()-startTime,console.log(`Ping ${site} took ${timeElapsed}ms`),console.log("Status: "+xhr.status),xhr.status<400&&timeElapsed{fastestTime<100&&(xhr.abort(),resolve(fastestSite))},xhr.onload=()=>{console.log("Pinging "+site)},xhr.open("GET",site,!0),xhr.timeout=2e3,xhr.send()})})} function getConfigPage(){return findFastestSite(["https://user-script-config-form.vercel.app","https://yuhan-script-config.netlify.app","https://yuhanawa.github.io/tools/userscriptconfig/"]).then(fastestSite=>fastestSite).catch(error=>(console.error("Error:",error),null))} function showConfigPage(){document.querySelector("#config-page-awa")?document.querySelector("#config-page-awa").style.display="block":getConfigPage().then(fastestSite=>{void 0!==GM_openInTab?GM_openInTab(fastestSite,{active:!0}):location.href=fastestSite})} function LoadConfigPage(name){if(!document.querySelector("#config-page-awa"))return style(` .config-page-awa { position: fixed; background-color: rgba(245, 200, 200, 0.2); z-index: 9999; top: 0; left: 0; width: 100vw; height: 100vh; display: block; justify-content: center; align-items: center; flex-direction: column; backdrop-filter: blur(20px); } .config-page-container { width: 60%; height: 60%; position: absolute; top: 15%; left: 15%; cursor: auto; border: 1px thin #cccccc10; border-radius: 20px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.65); background-color: rgba(255, 255, 255, 0.6); overflow: hidden; padding: 15px; box-sizing: border-box; overflow-y: hidden; min-width: 360px; min-height: 420px; resize: both; } .config-page-drag-area { position: absolute; width: 100%; height: 100%; top: 0; left: 0; cursor: move; background-color: transparent; } .config-page-iframe { border: 0; border-radius: 18px; overflow: hidden; box-sizing: border-box; overflow-y: auto; opacity: 0.95; width: 100%; height: 100%; box-shadow: 1px 1px 4px rgba(185, 185, 185, 0.2); background-color: rgba(255, 255, 255, 0.25); margin: -1px; } .config-page-close-btn { position: absolute; top: 4px; right: 5px; font-size: 20px; background-color: transparent; border: 0; color: #C00; cursor: pointer; outline: none; padding: 0; margin: 0; } .config-page-close-btn:hover { color: #A00; } .config-page-close-btn:active { color: #f00; transform: scale(0.8); transition: 0.15s; } `),getConfigPage().then(fastestSite=>{document.body.insertAdjacentHTML("afterend",` `);const configPage=document.querySelector("#config-page-awa"),container=configPage.querySelector(".config-page-container"),iframe=configPage.querySelector(".config-page-iframe");var fastestSite=configPage.querySelector(".config-page-drag-area"),pos1=0,pos2=0,pos3=0,pos4=0; function elementDrag(e){(e=e||window.event).preventDefault(),pos1=pos3-e.clientX,pos2=pos4-e.clientY,pos3=e.clientX,pos4=e.clientY,container.style.top=container.offsetTop-pos2+"px",container.style.left=container.offsetLeft-pos1+"px"} function closeDragElement(){iframe.style.pointerEvents="auto",configPage.onmouseup=null,configPage.onmousemove=null}return fastestSite.onmousedown=function(e){(e=e||window.event).preventDefault(),pos3=e.clientX,pos4=e.clientY,iframe.style.pointerEvents="none",configPage.onmouseup=closeDragElement,configPage.onmousemove=elementDrag;e=window.getComputedStyle(event.target).cursor;console.log("当前鼠标样式:"+e)},configPage.querySelector(".config-page-close-btn").onclick=function(){configPage.style.display="none"},Promise.resolve()});showConfigPage()} function loadConfig(name,properties){GM_registerMenuCommand("在新窗口打开设置中心",()=>{showConfigPage()}),GM_registerMenuCommand("在页面内镶嵌设置中心(BETA)",()=>{LoadConfigPage(name).then(()=>showConfigPage())}),anchors=[];for(const key of Object.keys(properties))__props__.set(name+"_"+key,properties[key].default),key.startsWith("#")&&anchors.push({key:key,href:properties[key].href||key,title:properties[key].title||properties[key].description||key});(location.href.match("yuhan-script-config.netlify.app")||location.href.match("user-script-config-form.vercel.app")||location.href.match("yuhanawa.github.io/tools/userscriptconfig")||location.href.match("localhost"))&&(void 0===unsafeWindow.awa&&(unsafeWindow.awa={}),void 0===unsafeWindow.awa.userscript&&(unsafeWindow.awa.userscript={}),unsafeWindow.awa.userscript[name]={props:properties,anchors:anchors,get:get,set:set})} const engine_switch_tool_version = 5; let css = ""; let isRunning = false; let isLoaded = false; let searchURLMatchList = ` # 一行一个 井号开头的行将被忽略 bing.com/search woc.cool/search www.baidu.com/s fsoufsou.com/search www.google.com/search?q duckduckgo.com/?q so.com/s sogou.com/web?query search.yahoo.com/search yandex.com/search searx.tiekoetter.com petalsearch.com xn--flw351e.ml/search search.aust.cf/search search.njau.cf/search wuzhuiso.com/s ecosia.org/search startpage.com/sp/search you.com/ www.qwant.com www.startpage.com ` let defaultSearchList = ` # 格式: “名称,链接”, 一行一个 井号开头的行将被忽略 谷歌搜索,https://www.google.com/search?q=$ 百度搜索,https://www.baidu.com/s?wd=$ Bing搜索,https://cn.bing.com/search?q=$ 鸭鸭搜索,https://duckduckgo.com/?q=$ 搜狗搜索,https://www.sogou.com/web?query=$ 360搜索,https://www.so.com/s?q=$ # 雅虎,https://search.yahoo.com/search?p=$ Yandex,https://yandex.com/search/?text=$ 维基百科,https://zh.wikipedia.org/wiki/$ #无追搜索,https://www.wuzhuiso.com/s?q=$ #ecosia,https://www.ecosia.org/search?method=index&q=$ #startpage,https://www.startpage.com/sp/search #qwant,https://www.qwant.com/?q=$ `; let translateURLMatchList = ` https://fanyi.baidu.com/ https://translate.google.com/ https://dict.youdao.com/ https://cn.bing.com/dict/search https://www.vocabulary.com/dictionary/ https://dictionary.cambridge.org/zhs https://www.learnersdictionary.com/definition/ ` const DefaultFontFamily = `MiSans,-apple-system,Microsoft YaHei,Tahoma,Arial,"Helvetica Neue",Helvetica,"Nimbus Sans L",Arial,"Liberation Sans","PingFang SC","Hiragino Sans GB","Source Han Sans CN","Source Han Sans SC","Microsoft YaHei","Wenquanyi Micro Hei","WenQuanYi Zen Hei","ST Heiti",SimHei,"WenQuanYi Zen Hei Sharp",sans-serif `; const get_search_font_family = () => get("search-font-family", DefaultFontFamily).trim() === "" ? DefaultFontFamily : get("search-font-family", defaultSearchList).trim(); // noinspection JSUnresolvedFunction const get = (key, d) => GM_getValue(key, d) // noinspection JSUnresolvedFunction const set = (key, v) => GM_setValue(key, v) // ---------------------------------------------------------------------------- // const menu = (name, key, defaultValue) => { const value = get(key, defaultValue) name += value ? ':开启' : ':关闭'; // noinspection JSUnresolvedFunction GM_registerMenuCommand(name, () => { set(key, !value); location.reload() }); return value; } const options = (name, key, ValueList) => { const index = get(key, 0) name += `:${ValueList[index]}[${index + 1}/${ValueList.length}]<点击切换模式`; // noinspection JSUnresolvedFunction GM_registerMenuCommand(name, () => { if (index + 1 >= ValueList.length) set(key, 0); else set(key, index + 1); location.reload() }); return index; } const match = (x) => { if (typeof x == "undefined") return false; if (typeof x == "string") { if (document.URL.indexOf(x) !== -1) { if (!isRunning) { isRunning = true; console.info("> 优化美化净化增强脚本 运行中... 求star https://github.com/yuhanawa/UserScript") } return true; } } else if (typeof x == "object") { if (x.test(document.URL)) { if (!isRunning) { isRunning = true; console.info("> 优化美化净化增强脚本 运行中... 求star https://github.com/yuhanawa/UserScript") } return true; } } else console.error(`? 意料之外的错误: x:${x} URL:${URL}`) return false; } const str2list = (s) => s.split('\n').map((x) => { if (!x.trim().startsWith('#') && x.trim().length > 3) { return x.trim(); } }) const matchList = (l) => { for (let i = 0; i < l.length; i++) { if (match(l[i])) return true; } return false; } const style = (css) => { css = css.replaceAll(/\s{2,}/g, " ") if (typeof GM_addStyle != "undefined") { GM_addStyle(css); } else if (typeof PRO_addStyle != "undefined") { PRO_addStyle(css); } else if (typeof addStyle != "undefined") { addStyle(css); } else { const node = document.createElement("style"); node.appendChild(document.createTextNode(css)); document.body.appendChild(node); } } const onload = (f) => { if (isLoaded) f(); else document.addEventListener("DOMContentLoaded", () => f()) }; const setTimeoutBeforeLoad = (f, t) => onload(() => setTimeout(() => f(), t)); const setIntervalBeforeLoad = (f, timeout) => onload(() => { f(); setInterval(f, timeout); }) onload(() => isLoaded = true); /* search */ if (matchList(str2list(searchURLMatchList))) { menu("搜索引擎优化美化净化", 'search', true); menu("搜索引擎快速切换工具", 'search_engine_switch_tool', true); onload(() => { /*添加背景*/ document.body.insertAdjacentHTML("afterbegin", "
") /* 匹配搜索框 */ if (match("sogou.com/web?query")) document.getElementById("bottom_form_querytext").className += " search-input-awa "; else if (match("bing.com")) { document.getElementById("sb_form_q").className += " search-input-awa "; } else if (match("duckduckgo.com/")) { document.getElementById("search_form_input").className += " search-input-awa "; } else { document.querySelectorAll("input").forEach(i => { if (i.type === 'text' || i.type === 'search') i.className += " search-input-awa "; }); if (document.querySelectorAll(".search-input-awa").length === 0) { setTimeout(() => { document.querySelectorAll("input").forEach(i => { if (i.type === 'text' || i.type === 'search') i.className += " search-input-awa "; }); }, 2000) } } }) if (menu("搜索界面默认使用MiSans字体", 'search_misans', true)) { /* 添加字体 */ style(` @import url('https://unpkg.com/misans@3.1.1/lib/misans-400-regular.min.css'); @import url('https://unpkg.com/misans@3.1.1/lib/misans-500-medium.min.css'); `); } style(`* {font-family: ${get_search_font_family()} !important;}`) /* search */ if (get("search", true)) { css += ` a > em, a > strong{ color: #f73131 !important; text-decoration: none !important; } a:not(.trgr_icon) { position: relative; text-decoration: none !important; color: #2d65b3 !important; /* 3476d2 */ } a:hover:after { left: 0 !important; width: 100% !important; transition: width 350ms !important; } a:hover { text-decoration: none !important; } a:after { content: ""!important; position: absolute!important; border-bottom: 2px solid #f16d7a !important; bottom: -2px!important; left: 100%!important; width: 0!important; transition: width 350ms, left 350ms!important; } body, .body-awa { background: transparent !important animation-name: ani_topTobuttom; animation-duration: 1s; animation-timing-function: ease; position: absolute; width: 100%; {body-awa} } body:before{ content: ""; background-color: #f5f5f5 !important; background-image: url(${get("search-background-img", "")}); background-size: 100% auto; background-attachment: fixed; background-position-y: center; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-size: 100% auto; background-attachment: fixed; background-position-y: center; z-index: -24; filter: blur(12px); } .head, #head, header, .header, #header, .header-awa { background-color: transparent !important; padding-top: 18px !important; position: static !important; {header-awa} } input, .inputbox-awa { background-color: rgba(255, 255, 255,0.3); {inputbox-awa} } .results > div, .results > li, .result, .container, .item-awa{ word-wrap: break-word; word-break: break-word; color: #333; line-height: 1.65; background-color: rgba(255, 255, 255,1); backdrop-filter: blur(8px); box-sizing: border-box; border-radius: 6px; padding: 12px 20px; transition: all 450ms cubic-bezier(.23,1,.32,1) 0s; box-shadow: 0 2px 6px 0 rgb(0 0 0 / 14%); border-collapse: collapse; margin-bottom: 18px; margin-top: 0px; border: 1px solid rgba(0,0,0,0.1); overflow: hidden; {item-awa} } .item-awa div{ background: transparent; padding: revert !important; box-shadow: unset; margin-bottom: revert; border:unset } /* 鼠标悬浮添加内阴影 */ .item-awa:hover { border: 1px solid rgba(0, 0, 0, 0.3); box-shadow: 0,0, 1px rgba(0,0,0,0.3); } span, p, .item-awa p, .item-awa span, .item-text-awa{ line-height: 20px; color: #444; font-size: 13px; } h2,h3,.item-awa h2, .item-awa a, .item-title-awa{ /*color: #555;*/ color: #3476dd; font-size: 18px; line-height: 24px; font-weight: 400; } .auto{ margin:auto !important; padding:auto !important; } `.replaceAll(/\s*,/g, ",").replaceAll(/\s*{/g, "{"); if (get("search-background-img", "").trim() !== "") css += ` .results > div, .results > li, .result, .item-awa{ background-color: rgba(255, 255, 255,.65); }`.replaceAll(/\s*,/g, ",").replaceAll(/\s*{/g, "{"); /* engine_switch_tool */ css += ` #engine_switch_tool{ all: initial; z-index: 1024 !important; position: fixed !important; top: 96px ; left: 5px !important; display: flex; flex-direction: column; } #engine_switch_tool a:visited { color: #333 !important; } #engine_switch_tool > div{ opacity:.05; cursor: pointer; } #engine_switch_tool:hover > div{ opacity:1; } .switch_tool_compact { all: initial; margin: 10px,2px; text-align: center; cursor: pointer; font-size: 20px; border-radius: 5px; border: 1px solid #ccc; font-weight: lighter; color: #333; background-color: rgba(2555,255,255,124); touch-action: manipulation; box-shadow: 0px 0px 1px #ccc; transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; font-weight: normal; } .switch_tool_link { all: initial; margin: 10px,3px; text-align: center; cursor: pointer; font-size: 20px; font-weight: lighter; color: #333; touch-action: manipulation; transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; font-weight: normal; } .switch_tool_button { all: initial; margin: 10px; text-align: center; cursor: pointer; border-radius: 5px; border: 1px solid #ccc; padding: 5px; font-size: 20px; font-weight: lighter; color: #333; background-color: #fff; width: 120px; height: 28px; touch-action: manipulation; box-shadow: 0px 0px 1px #ccc; transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; font-weight: normal; } .switch_tool_show { opacity:1 !important; } .switch_tool_invisible { opacity:0.2 !important; } .switch_tool_auto { opacity:0.2 !important; } .switch_tool_auto:hover { opacity:1 !important; } `.replaceAll(/\s*,/g, ",").replaceAll(/\s*{/g, "{"); const addClass = (y, add) => css = css.replaceAll(`${y},`, `${add},${y},`).replaceAll(`${y}{`, `${add},${y}{`); if (match("bing.com/search")) { css += ` .sh_favicon{ margin-left: 16px; } #b_content{ padding-top: 25px; } .b_hPanel /* bing词典手机app广告 */ { display: none; } #id_sc,#id_h #id_l { /* 设置按钮 */ margin-top: -46px; } body #b_header #est_switch { /* 国际版切换按钮 */ position: relative; right: 240px; top: 5px; display:block!important; } #est_switch { display:none; /*防止页面闪烁 先隐藏等会显示*/ } /* 首个搜索结果的遮罩和查看更多按钮 */ .b_rc_gb_bottom_cover, .b_rc_gb_cover, .rc_gb_seemore { display:none !important; } /* 调整首个搜索结果的高度 */ .b_Richcard, .b_RichCardAnswerV2, .b_rc_gb_sub{ max-height: none !important; height: auto !important; } #mfa_root{ /* 重置右下搜索按钮样式 */ background: transparent!important; box-shadow: unset!important; margin-bottom: revert!important; border:unset!important; backdrop-filter:unset!important; } /* 国际版切换按钮 */ #est_cn, #est_en{ height: 12px; border: 1px solid #ddd; padding: 10px; margin: 8px; border-radius: 4px; } #est_cn::after, #est_en::after{ border-radius: 2px; } /* 特殊横条 */ #b_pole{ opacity:0.85; } /* rewards */ #id_rh{ margin-top: -46px; } .b_scopebar{ top: auto!important; bottom: auto!important; } #b_header { height: unset!important; } #recentSearchLGContainer{ top: 5px !important; right: 2px !important; left:unset !important; } #recentSearchLGContainer > h2::after{ content:": 此处样式(配色,动画等)待适配:快懒死了,一点都不想干活" } `; addClass(".item-awa", "#b_results > li") onload(() => { /* 移动 切换按钮 位置 */ const est_switch_html = `>${document.getElementById("est_switch").outerHTML} .c-span4 { width: 155px !important; } .image-one-line_2GgpZ{ height: 100px; overflow: hidden; align-items: center; display: flex; } `; onload(() => { document.body.insertAdjacentHTML("afterend", ``); }) } // --------------------------------------- // else if (match("fsoufsou.com/search") || match("woc.cool/search")) { addClass(".header-awa", "._search-sticky-bar") addClass(".inputbox-awa", ".input-group-container") addClass(".item-awa", ".organic-results div") addClass(".item-awa div", ".organic-results div div") addClass(".item-title-awa", ".organic-results div a") addClass(".item-text-awa", ".organic-results div span") addClass(".auto", ".mobile-wiki-container") css += ` #app div .false { padding-top: 0px !important; } .organic-results { padding-top: 16px; } #search-input{ background-color: transparent !important; } .organic-results{ max-width: 618px !important; margin-left: 48px !important; } #code-block-container{ max-width: 480px; } ` } // -小众中国网站---------------------------- // else if (match("sogou.com") || match("so.com")) { addClass(".item-awa", ".result > li") css += ` /* 矫正搜索栏下方tag */ .searchnav { position: absolute; top: 55px; } .result{ all: unset; } /* 去除头部白色 */ #header .inner { background:transparent; } #tabs-wrap { padding: 0 0 0 135px !important; } .biz_sponsor,#so-10th-anni-user-guider-dlg, /* AD */ .right, /* 搜狗右侧 */ #side, .menu,#promotion_adv_container,.top-hintBox,#rs-top, /* 移除多余 */ .double-eleven{ display:none !important; } /* 太胖了 */ .res-comm-con{ width: 360px !important; } /* 调整位置 */ .wrapper, #wrapper, #container{ padding-left: 160px !important; } ` } // -小众外国网站---------------------------- // else if (match("ecosia.org/search")) { css += ` #search-filters{ margin-left: 24px; } main{ padding-left: 36px; margin-top: -12px; } ` } // --------------------------------------- // else { addClass(".header-awa", ".CvDJxb") addClass(".item-awa", ".MjjYud") addClass(".item-awa div", ".MjjYud div") addClass(".item-title-awa", "h3.LC20lb") addClass(".item-text-awa", ".MjjYud span") css += ` .yg51vc, /*头部白色区域*/ .appbar /*获得约 * 条结果,以下是第 * 页*/ { background-color: transparent !important; } .sfbg, /*令人疑惑的留白*/ .dodTBe/*同上*/ { display:none !important; height:0px !important; weight:0px !important; } /* 调整位置 */ .s6JM6d{ margin-left:160px } .hlcw0c, .ULSxyf, .hlcw0c { margin-bottom: auto !important; } .MXl0lf.tKtwEb { background: #4285f4 !important; } .u7yw9 { background: #ffffff !important; } ` } } /* search tools */ if (get("search_engine_switch_tool", true)) { if (get("engine_switch_tool_version", -1) + 3 < engine_switch_tool_version) { set("engine_switch_tool_version", engine_switch_tool_version); if (get("engine_switch_tool_version", -1) !== -1) { setTimeoutBeforeLoad(() => { document.body.insertAdjacentHTML("afterend", `

此信息将会在3秒后自动消失

!!! 您的搜索引擎快速切换工具列表配置文件因为过于老旧而被重置 !!!

`) setTimeout(() => { document.getElementById("removeafter3s").remove(); }, 3500) }, 600) } } if (get("engine_switch_tool_list", "").trim() === "") set("engine_switch_tool_list", defaultSearchList); let list = get("engine_switch_tool_list").trim(); onload(() => { try { document.getElementById("engine_switch_tool").remove() } catch { } let html = ""; list.split("\n").forEach((s) => { s = s.replaceAll(/\s/g, ""); if (s === "" || s.startsWith('#') || s.startsWith('-')) return; html += `
${s.split(',')[0]} ` }); document.body.insertAdjacentHTML("afterend", ``); }) setTimeoutBeforeLoad(() => { const tool = document.getElementById("engine_switch_tool"); document.getElementById("switch_tool_style").addEventListener("click", () => { set("switch_tool_style", document.getElementsByClassName('switch_tool')[0].className); }); try { if (document.getElementsByClassName("switch_tool")[0].onclick === null) { tool.addEventListener("click", () => { Array.from(document.getElementsByClassName("switch_tool")).forEach((i) => { i.href = i.getAttribute('key').replace('$', document.getElementsByClassName('search-input-awa')[0].getAttribute('value').replaceAll('%', '%25').replaceAll('#', '%23').replaceAll('&', '%26').replaceAll('+', '%2B').replaceAll(' ', '%20').replaceAll('?', '%3F').replaceAll('=', '%3D')) }) }); } } catch { } window.onscroll = () => { tool.style.top = (window.scrollY > 96 ? 0 : 96 - window.scrollY).toString() + "px"; } }, 800) } const index = options("搜索引擎快速聚焦模式(Ctrl+[K|Q|S])", 'search_engine_quick_focus', ["清空", "关闭", "选中", "聚焦",]) if (index !== 1) { document.onkeydown = (e) => { if (e.ctrlKey && (e.key === "q" || e.key === "s" || e.key === "k")) { if (index === 0) document.getElementsByClassName("search-input-awa")[0].value = ""; else if (index === 2) document.querySelector("input").select(); document.getElementsByClassName("search-input-awa")[0].focus(); e.preventDefault(); } } } onload(() => { /* search setting */ document.body.insertAdjacentHTML("afterend", `
`); const addListener = (key) => { const e = document.getElementById(key); if (e.tagName === "INPUT") { e.addEventListener("change", () => { set(key, document.getElementById(key).value) }) } else if (e.tagName === "PRE") { document.getElementById("search-setting-awa").addEventListener("keyup", () => { set(key, document.getElementById(key).innerText) }, true) } } addListener("search-font-family"); addListener("search-background-img"); addListener("search-block-website"); addListener("engine_switch_tool_list"); }); } style(css); loadConfig('search', {"config_test":{"title":"测试","default":"开发中..."}}) let features_search_0 = { }; run(features_search_0);