csdn只看文章和評論

awful ads

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         csdn只看文章和評論
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  awful ads
// @author       ppdesu
// @match        https://blog.csdn.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...


    //clear the aside
    setTimeout(()=>{

        var lists = [
            "header",
            "aside",
            ".csdn-toolbar",
            ".recommend-box",
            ".pulllog-box",
            ".tool-box",
            ".unlogin-box",
            ".edu-promotion"
        ];

        for(var i=0;i<lists.length;i++)
        {
            var ele = document.querySelector(lists[i]);
            console.log(lists[i]);
            if(ele != null)
            {
                ele.parentNode.removeChild(ele);
            }
            else
            {
                console.log(lists[i] + "aside query failed!");
                return;
            }
        }
        console.log("botton ads processing");
        function remove_bottom_ads()
        {
            var listsall = [
                "iframe"
            ];
            console.log("processing iframe");
            for(i=0;i<listsall.length;i++)
            {
                ele = document.querySelectorAll(listsall[i]);
                if(ele == null)continue;
                //while(ele.length==1)
                //{
                for(var j=0;j<ele.length;j++)
                {
                    console.log("remove iframe"+j);
                    if(ele[j] != null)
                    {
                        ele[j].parentNode.removeChild(ele[j]);
                    }
                }
                //ele = document.querySelectorAll(listsall[i]);
                //}
            }
        }
        var index = 0;
        var timeid = setInterval(()=>{
            remove_bottom_ads();
            index = index + 1;
            if(index >=20)
                clearInterval(timeid);
        },1000);
        //alert("executed!");

        var obj = document.querySelector("a#btn-readmore.btn.btn-red-hollow");
        if(obj!=null)
            obj.click();
    },10);
})();