CSDN 净化

去除CSDN多余的广告侧边栏信息,阅读全文自动展开

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         CSDN 净化
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  去除CSDN多余的广告侧边栏信息,阅读全文自动展开
// @author       贺墨于
// @match        *://*.csdn.net/*
// @grant        none
// @license MIT 
// ==/UserScript==


var CSDNPluify = {
    gList: [],
    $(obj){
        var elem = document.querySelectorAll(obj)
        elem.css = function(propertyName, value){
            for(var i = 0, len = elem.length; i < len; i++){
                elem[i].style[propertyName] = value
            }
        }
        elem.cssText = function(value){
            for(var i = 0, len = elem.length; i < len; i++){
                elem[i].style.cssText = value
            }
        }
        elem.remove = function(){
            for(var i = 0, len = elem.length; i < len; i++){
                elem[i].remove()
            }
        }
        return elem
    },
    fitContent(){
        this.$('.hide-article-box').remove();
        this.$('#mainBox').css('width','100%');
        this.$('#mainBox main').cssText('width:100% !important');
        this.$('#article_content').css('height','auto');
        setTimeout(function(){
            this.$('.tool-box.vertical').css('right', '33px');
            this.$('div.csdn-side-toolbar').css('right', '33px');
        }, 1000);
    },
    execHidden(){
        for(var i = 0; i < this.gList.length; i++){
            this.hidden(this.gList[i]);
        }
    },
    push(content){
        this.gList.push(content);
    },
    log(msg){
        console.log(msg);
    },
    hidden(obj){
        if(typeof(obj)=== 'string'){
            obj = this.$(obj);
        }
        //obj.remove()
        obj.css('display', 'none')
    },
    init(){
        this.push('.aside-box');
        this.push('.recommend-box');
        this.push('.template-box');
        this.push('.recommend-right');
        this.execHidden();
        this.fitContent();
    }
}

CSDNPluify.init()