Clean CSDN Blog

净化CSDN,优化阅读体验

Verze ze dne 07. 11. 2022. Zobrazit nejnovější verzi.

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

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 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         Clean CSDN Blog
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  净化CSDN,优化阅读体验
// @author       fengxxc
// @match        https://blog.csdn.net/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    // 干掉下边登录条
    var pulllogbox = document.getElementsByClassName('pulllog-box');
    if(pulllogbox.length > 0) {
        pulllogbox[0].style.display = 'none';
    }
    // 阅读更多
    function triggerClick(dom){
        //IE
        if(document.all) {
            dom.click();
        }
        // 其它浏览器
        else {
            var e = document.createEvent("MouseEvents");
            e.initEvent("click", true, true);
            dom.dispatchEvent(e);
        }
    }
    var btnReadmore = document.getElementsByClassName('btn-readmore')[0];
    if (btnReadmore) {
        triggerClick(btnReadmore); // csdn blog
    }
    // 干掉左边
    document.getElementById('mainBox').getElementsByTagName('aside')[0].remove();
    //document.getElementById('mainBox').getElementsByTagName('aside')[0].style.transform = 'translate(-370px,0)'; // new
    // 干掉右边
    document.getElementsByClassName('recommend-right')[0].style.display = 'none';
    //document.getElementsByClassName('recommend-right')[0].style.transform = 'translate(370px,0)'; // new
    // 放大中间
    document.getElementById('mainBox').style.zIndex = '999';
    document.getElementById('mainBox').style.position = 'relative'; // new
    document.getElementById('mainBox').getElementsByTagName('main')[0].style.position = 'absolute'; // new
    document.getElementById('mainBox').getElementsByTagName('main')[0].style.width = '100%';
    // 轮询干掉注册登录
    setInterval(function() {
        document.getElementById('passportbox').style.display = 'none';
    }, 800);
    
    document.getElementsByClassName('login-mark')[0].style.display = 'none';

    // 干掉最上面的广告
    document.querySelector("#csdn-toolbar").remove();
    
    // 干掉关注博主即可阅读全文
    var hideArticleBox = document.getElementsByClassName('hide-article-box')
    if(hideArticleBox != null && hideArticleBox.length > 0) {
        hideArticleBox[0].style.display = 'none'
        document.getElementById('article_content').style.height = 'inherit'
    }
})();