CSDN 净化

去除CSDN多余的广告侧边栏信息

2020-02-24 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         CSDN 净化
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  去除CSDN多余的广告侧边栏信息
// @author       贺墨于
// @match        *://*.csdn.net/*
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @grant        none
// ==/UserScript==

var gList = [];

$(function(){
    push('.aside-box');
    push('.recommend-box');
    push('.template-box');
    execHidden();
    fitContent();
})

function fitContent(){
    $('#mainBox main').css('cssText', 'width:100% !important');
    $('.tool-box.vertical').css('right', '33px');
    $('div.csdn-side-toolbar').css('right', '33px');
    $("a.btn-readmore").trigger("click");
}

function execHidden(){
    for(var i = 0; i < gList.length; i++){
        hidden(gList[i]);
    }
}

function push(content){
    gList.push(content);
}

function log(msg){
    console.log(msg);
}

function hidden(obj){
    if(typeof(obj)=== 'string'){
        obj = $(obj);
    }
    obj.css('display', 'none')
}