clean CSDN blog

还你一个干净的阅读体验

As of 03. 08. 2017. See the latest version.

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 or Violentmonkey 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         clean CSDN blog
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  还你一个干净的阅读体验
// @author       Lynxz
// @match        http://blog.csdn.net/*/article/details/*
// @grant        none
// ==/UserScript==
// CSDN文章清除博客文章侧边栏和广告元素
// CSDN已自带jquery了,不需要添加此依赖
(function() {
    'use strict';
    // 删除blog页面左侧个人资料等侧边栏
    $('#side').remove();
    // 移除blog内容区域右侧上层互动的二维码和快速回复,我要收藏等元素
    $('.csdn-tracking-statistics').remove();
    // 设置blog内容区域width 100%,填满移除侧边栏后的区域
    $('#main').css('padding-left',0);
    $('#main').css('width','100%');
    // 设置文章内容区域的宽度,默认880px,避免阅读时眼球左右转动幅度过大,自行按需调整吧
    let w = $('#article_details').width();
    let defaultWidth = 880;
    let margin = (w - defaultWidth) / 2 ;
    if(margin > 10){
        $('#article_details').width(defaultWidth);
        $('#article_details').css('margin-left', margin +'px');
    }
})();