Greasy Fork

去除百度搜索广告

去除百度搜索推广、广告

目前为 2016-10-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         去除百度搜索广告
// @namespace    http://tampermonkey.net/
// @version      0.1.5
// @description  去除百度搜索推广、广告
// @author       大雄、小虾吃大虾
// @match        http*://*.baidu.com/*
// @grant        none
// ==/UserScript==

setTimeout(function(){
    startAD();
    $('.EC_result').remove();
},700);

function startAD(){
    setInterval( function (){
        var container = document.getElementById( 'content_left' );
        Array.from( container.children).forEach( function ( item ){
            if( item && /display:block\s+!important;visibility:visible\s+!important/i.test( item.getAttribute( 'style' ) ) ){
                this.removeChild( item );
            }
            
            if($(item).find('span').text() == "广告")
                    this.removeChild(item);
        }, container );
    }, 300 );
}