Csdn Ads Cleaner

Clear those fxxking ads on csdn!

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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;
})();