Csdn Ads Cleaner

Clear those fxxking ads on csdn!

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Csdn Ads Cleaner
// @namespace    http://tampermonkey.net/
// @version      1.1.5
// @description  Clear those fxxking ads on csdn!
// @author       sun123zxy
// @match        blog.csdn.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var Ads;
    function Clear(){//删除Ads中的组件
        console.log("Clearing ads...");
        for(var i=0;i<Ads.length;i++){
            if(Ads[i]){
                Ads[i].parentNode.removeChild(Ads[i]);
                console.log("Sucessfully Clear Ads "+i+"!");
            }else{
                console.log("There's no Ads "+i+"!");
            }
        }
    }
    function LowFind(){//寻找广告组件(弱)
        console.log("(Low)Finding Ads...");
        Ads = new Array(    document.getElementsByClassName("csdn-tracking-statistics mb8 box-shadow")[0],//左侧边栏广告1
                            document.getElementsByClassName("fourth_column")[0],//左下弹窗广告
                            document.getElementById("kp_box_57"),//左侧边栏广告2
                            document.getElementById("479"),//右侧边栏广告1
                            document.getElementById("480"),//右侧边栏广告2
                            document.getElementsByClassName("pulllog-box")[0],//界面下侧广告、提示登录栏
                            document.getElementById("adContent"),//右侧"VIP免广告"
                            document.getElementById("dmp_ad_58"),//正文下广告
                            document.getElementsByClassName("indexSuperise")[0],//右侧弹窗广告
                            document.getElementsByClassName("blog_star_enter")[0],//2018博客之星
                            document.getElementById("QIHOO__INTERACTIVE_PLUGIN1548683796329-gameBg")//大转盘
                           );
        var AdBoxes=document.getElementsByClassName("recommend-item-box recommend-ad-box");//正文下夹杂在推荐博客中的广告
        for(var i=0;i<AdBoxes.length;i++){Ads.push(AdBoxes[i]);}
        console.log("Found ads:");
        console.log(Ads);
    }
    function HotKey(){
        var a=window.event.keyCode;
        if(a==113){ //F2
            LowFind();
            Clear();
        }
    }
    document.onkeydown = HotKey;
})();