去除贴吧列表里面的广告

去除贴吧掺夹在【帖子列表】【回复列表】里的广告

当前为 2015-05-21 提交的版本,查看 最新版本

// ==UserScript==
// @name	去除贴吧列表里面的广告
// @author	burningall
// @description	去除贴吧掺夹在【帖子列表】【回复列表】里的广告
// @version     2015.5.21-1.3
// @include			http://tieba.baidu.com/*
// @supportURL		http://www.burningall.com
// @contributionURL	[email protected]|alipay.com
// @namespace https://greasyfork.org/zh-CN/users/3400-axetroy
// ==/UserScript==
(function() {
    function $(id) {
        return document.getElementById(id);
    };
    console.log("去广告日志:");
    if ($('thread_list')) {
        adlist = $('thread_list').children;
        console.log("进入XXX吧首页");
    } else if ($('j_p_postlist')) {
        adlist = $('j_p_postlist').children
        console.log("进入XXX帖子内");
    } else {
        adlist = null;
        console.log("noAds");
    };
    if (adlist != null) {
        for (var i = 0; i < adlist.length; i++) {
            if (adlist[i].getAttribute("data-daid")) {
            	console.log(adlist[i]);
                adlist[i].style.cssText = "display: none !important;";
                adlist[i].parentNode.removeChild(adlist[i]);
                console.log("广告已去除");
            };
        };
    };
})()