csdn 极简版

csdn 页面极端简化版, 只显示正文.

当前为 2020-04-17 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         csdn 极简版
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  csdn 页面极端简化版, 只显示正文.
// @author       kgzhang
// @match        https://blog.csdn.net/*/article/details/*
// @grant        GM_addStyle
// ==/UserScript==

// 有时会渲染失败,影响后面的执行
try{
    GM_addStyle('.recommend-right_aside {display:none}');
    GM_addStyle('.tool-box {display:none}');
    GM_addStyle('.csdn-side-toolbar {display:none}');
    GM_addStyle('.blog_container_aside {display:none}');
    GM_addStyle('.csdn-toolbar {display:none}');
    GM_addStyle('.csdn-toolbar {display:none}');
    GM_addStyle('.container#mainBox main {width: unset 1000px}');
    GM_addStyle('.blog-content-box{width: 1200px; margin-left: -200px;}')
    // 屏蔽评论框
    GM_addStyle('.comment-box{display: none;}')
    // 屏蔽推荐
    GM_addStyle('.recommend-box{display: none;}')
    GM_addStyle('.template-box{display: none;}')
} catch (e){

}



(function() {
    'use strict';

    // Your code here...
    window.onload = ()=> {
        window.localstorage.setItem('anonymousUserLimit','');
        const box = document.getElementById('passportbox');
        if (box) {
            box.style.display = 'none';
        }
        const blog = document.querySelector('.blog-content-box');
        if (blog) {
            blog.parentNode.children[4].style.display = 'none';
        }
    }
    window.addEventListener('scroll', ()=>{
        // 阅读更多
        const got = document.querySelector('a[class="btn-readmore"]')
        if (got) {
            got.click();
        }
    })
    // 定期检查广告弹框
    setInterval(()=>{
        const blog = document.querySelector('.blog-content-box');
        if (blog && blog.parentElement.children[4].tagName === 'DIV') {
            blog.parentElement.children[4].style.display = 'none';
        }
    }, 200);
})();