百度热点搜索屏蔽

百度热点搜索栏目屏蔽

当前为 2018-06-06 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name               Block Baidu Hot List
// @name:zh-CN         百度热点搜索屏蔽
// @namespace          h
// @version            1.1
// @description        Just Block Baidu Hot List
// @description:zh-CN  百度热点搜索栏目屏蔽
// @author             hoothin
// @include            http*://www.baidu.com/*
// @include            http*://m.baidu.com/*
// @grant              none
// @run-at             document-start
// @license            MIT License
// @compatible         chrome 测试通过
// @compatible         firefox 未测试
// @compatible         opera 未测试
// @compatible         safari 未测试
// @contributionURL    null
// @contributionAmount 1
// ==/UserScript==

(function() {
    'use strict';



    function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {  
            window.onload = function() {
                oldonload();
                func();
            };
        }
    }



    function t(){
        $(".opr-toplist-table").remove();
        $(".opr-recommends-merge-panel").remove();
        $(".opr-recommends-merge-mbGap").remove();
        console.log(" hot list table removed !");
    }

    if('undefined' === typeof window.jQuery){
         addLoadEvent(t);
    }else{
        t();
        console.log("biu~");
    }

var setInterval_id;

setInterval_id = setInterval(function(){
    if(document.querySelector("#content_right") ){
       $$("#content_right",'remove','all');
       //clearInterval(setInterval_id);
    }
},100);

function $$(selector,operation,nodes_model){
	var model = nodes_model || 'one';

	switch(operation){

		case 'hide':
			if(  model =='one' ){
				var  page_ele = document.querySelector(selector) ;
				if(!page_ele){
					return;
				}
				page_ele.style.display = "none" ;
			}else{
				var  arr =  document.querySelectorAll(selector);
				if(!arr){
					return;
				}
				Array.prototype.forEach.call(arr,function(e){e.style.display = "none";});

			}
		break;


		case 'remove':
			if(  model =='one' ){
				var  page_elem = document.querySelector(selector) ;
				if(!page_elem){
					return;
				}
				page_elem.parentNode.removeChild(page_elem);
			}else{
				var  arr_remove =  document.querySelectorAll(selector);
				if(!arr_remove){
					return;
				}
				Array.prototype.forEach.call(arr_remove,function(e){e.parentNode.removeChild(e);});
			}
		break;

		default:
			if(model ==='one'){
				return  document.querySelector(selector) ;
			}else{
				return  document.querySelectorAll(selector);
			}
	}
}

})();