Greasy Fork

Greasy Fork is available in English.

Bing首页优化

Bing首页优化,去除bing首页的国内版和国际版切换标签,去除底部的版权信息和广告链接,保留首页壁纸切换按钮。

目前为 2022-12-06 提交的版本。查看 最新版本

// ==UserScript==
// @name        Bing首页优化
// @namespace   Bing首页优化
// @description Bing首页优化,去除bing首页的国内版和国际版切换标签,去除底部的版权信息和广告链接,保留首页壁纸切换按钮。
// @author      girl
// @icon        https://favicon.yandex.net/favicon/v2/bing.com
// @include     *://cn.bing.com/
// @version     1.0.9
// @license     GPL-3.0-only
// @home-url    http://greasyfork.icu/zh-CN/scripts/430997
// ==/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');
		var id_rh = document.querySelector('#id_rh');
		var id_qrcode = document.querySelector('#id_qrcode');
		
		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);
        }
        if (id_rh) {
        	hidenDom(id_rh);
        }
        if (id_qrcode) {
    	    hidenDom(id_qrcode);
        }
    }

    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); // 初始化函数

})();