Greasy Fork

屏蔽百度广告,csdn博客广告

try to take over the world!

当前为 2021-01-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         屏蔽百度广告,csdn博客广告
// @namespace    http://tampermonkey.net/
// @version      v0.302
// @description  try to take over the world!
// @author       Skity666
// @match        https://www.baidu.com/*
// @match        https://*csdn.net*
// @include        https://*.baidu.com/*
// @include        https://*csdn.net*
// @grant        none
// @require         https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js
// ==/UserScript==
//更新了百度首页广告去除,csdn博客广告去除,csdn论坛
//v0.302 更新了博客首页的推荐位第一广告,更新了博客文章详情下方评论的广告
jQuery.noConflict();
(function($) {
    '屏蔽百度广告,csdn全网广告';

    filter()
    $(document).ready(function() {
          filter()
        setInterval(function(){
               filter()
            }, 1000);

    });

    function filter(){
        //csdn首页
        if(location.href.indexOf('blog.csdn.net')>0){
            //推荐位第一广告
            $("[data-type='ad']")
            //左下角的广告
            $("#footerRightAds").remove();
            //博客评论上方的广告
            $("#dmp_ad_58").remove()
            //博客评论下方的广告
            $("#recommend-item-box-tow").remove();
        }
        //csdn论坛
        if(location.href.indexOf('bbs.csdn.net')>0){
            //本周牛人上方的广告
            $(".ad_top.bbs_left_box").remove()
            //右下方的广告
            $(".ad_1.bbs_left_box").remove();

            //中部的广告
            $(".bbs_left_box .ad_1").remove();
        }
        //百度
        if(location.href.indexOf('www.baidu.com')>0){
            //右边栏的广告
            $("#zsyx_im0").remove()
            $("#m3423525928_canvas").remove()
            $("div").each(function(){
                    if($(this).attr("id")!='undefined'& $(this).attr("id")>3000){
                        $(this).remove()
                    }
                })
            //百度右边栏
            //$("#content_right").remove()


            //第一层广告去除掉后出现的广告
            setTimeout(function(){
                $("div.result.c-container").each(function(){
                    console.log($("span:contains('广告')",this).length)
                    if($("span:contains('广告')",this).length>0){
                        $(this).remove()
                    }

                })
                //$("div.result.c-container>.f13").parent().remove()
            }, 2000);

            //百度首页
            $("span:contains('广告')").parent().parent().remove()


        }
    }
    // Your code here...
})(jQuery);