// ==UserScript== // @author girl // @icon https://favicon.yandex.net/favicon/v2/bing.com // @name Bing首页优化 // @namespace Bing首页优化 // @description Bing首页优化,去除bing首页的国内版和国际版切换标签,去除底部的版权信息和广告链接,保留首页壁纸切换按钮。 // @include *://cn.bing.com/ // @version 1.0.6 // @license GPL-3.0-only // @downloadURL none // ==/UserScript== // (function() { var timeFunction = window.setInterval(function(){loadEnd()},10); function loadEnd(){ var footer = document.querySelector('#footer'); var searchNav = document.querySelector('#est_switch'); var searchBox = document.querySelector('.sb_form_q'); var sbox = document.querySelector('.sbox'); var headline = document.querySelector('#headline'); var hp_trivia_inner = document.querySelector('.hp_trivia_inner'); if(footer){ hidenDom(footer); } if(searchNav){ hidenDom(searchNav); } if(sbox){ sbox.style.margin='0'; sbox.style.top = "30%"; // 设置位置 sbox.style.left = "30%"; } if(headline){ hidenDom(headline); } if(hp_trivia_inner){ hidenDom(hp_trivia_inner); } } function removeDom(dom){ if(dom){ dom.remove(); } } function hidenDom(dom){ if(dom){ dom.style.display = 'none'; } } function SearchBoxEditor(){ // 修改搜索框 var searchbox= document.querySelector('#sb_form_q'); var searchLabel = document.querySelector('#sb_form'); searchLabel.style.backgroundColor = "#FFFFFF00"; function SearchBoxOnFocus(){ searchLabel.style.backgroundColor = "#FFFFFF"; } function SearchBoxOnBlur(){ searchLabel.style.backgroundColor = "#FFFFFF00"; } function SearchBoxOnMouseOver(){ if(document.activeElement.id == "sb_form_q"){ // still searchLabel.style.backgroundColor = "#FFFFFF"; }else{ searchLabel.style.backgroundColor = "#FFFFFF00"; } } function SearchBoxOnMouseLeave(){ if(document.activeElement.id == "sb_form_q"){ // still }else{ searchLabel.style.backgroundColor = "#FFFFFF00"; } } searchbox.onblur = SearchBoxOnBlur; // 失去焦点 searchbox.onfocus = SearchBoxOnFocus; // 获得焦点 searchbox.onclick = SearchBoxOnFocus;// 点击事件 searchLabel.onclick = SearchBoxOnFocus; // 点击事件 searchLabel.onmouseover = SearchBoxOnMouseOver; // 鼠标滑过 searchLabel.onmouseleave = SearchBoxOnMouseLeave; // 鼠标离开 = 失去焦点 } window.setTimeout(SearchBoxEditor,200); // 初始化函数 })();