Greasy Fork is available in English.

RemoveAds

需要配合AdBlockPro使用!该脚本可以移除那些使用!important来规避ABP反广告功能的广告,仅此而已。

目前为 2017-07-31 提交的版本。查看 最新版本

// ==UserScript==
// @name            RemoveAds
// @name:en         RemoveAds
// @version         1.0.6
// @description     需要配合AdBlockPro使用!该脚本可以移除那些使用!important来规避ABP反广告功能的广告,仅此而已。
// @description:en  This script can remove the ads which use some CSS like "style='display: block!important;'" to avoid AdBlockPro blocking them. Just it.
// @author          AnnAngela
// @match           *://*/*
// @run-at          document-idle
// @grant           unsafeWindow
// @namespace https://greasyfork.org/users/129402
// ==/UserScript==

(function() {
    "use strict";
    /* 防止重复加载 */
    if (unsafeWindow.RemoveAds) return;
    unsafeWindow.RemoveAds = true;

    console.debug('RemoveAds running.');
    unsafeWindow.removedAds = [];

    function removeAd() {
        var nodes = Array.from(unsafeWindow.document.querySelectorAll('[style*="important"]'));
        if (!nodes.length) return;
        nodes.forEach(function(that) {
            var style = that.attributes.style.textContent + '';
            that.attributes.style.textContent = '';
            if (getComputedStyle(that).display === 'none' || /^(广告)+$/.test(that.innerText.replace(/\s/g, ''))) {
                that.attributes.style.textContent = style + '';
                console.debug('RemoveAds: ', unsafeWindow.removedAds.push(that), that);
                that.remove();
            } else that.attributes.style.textContent = style + '';
        });
    }
    if (/www.baidu.com\/s/i.test(unsafeWindow.location.href)) setInverval(removeAd, 1307);
    else removeAd();
})();