remove Baidu ads

remove Baidu ads that Adblocker Plus cannot remove

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         remove Baidu ads
// @namespace    http://sosonemo.me/
// @version      0.1
// @description  remove Baidu ads that Adblocker Plus cannot remove
// @author       NemoTyrant
// @include      *www.baidu.com*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function remove(){
        E.pl = null; // remove ad generation code

        var results = document.querySelector("div#content_left");
        var children = results.children;
        for(var i = 0; i < children.length;i++){
            if (children[i].className.indexOf('c-container') == -1){
                children[i].parentNode.removeChild(children[i]);
            }
        }
        // console.log("removed!");

    }

    remove();

    var target = document.querySelector('#wrapper_wrapper');

    // create an observer instance
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type == "childList" && mutation.addedNodes.length > 0){
                // console.dir(mutation);
                remove();
            }
        });
    });

    // configuration of the observer:
    var config = { attributes: true, childList: true, characterData: true };

    // pass in the target node, as well as the observer options
    observer.observe(target, config);
})();