Clean csdn blog 清爽阅读博客

烦人的半屏顶部广告和左侧栏位都去掉了

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Clean csdn blog 清爽阅读博客
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  烦人的半屏顶部广告和左侧栏位都去掉了
// @author       Zszen
// @match        https://blog.csdn.net/*
// @match        https://www.cnblogs.com/*/p/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    rm_el({
        'csdn-toolbar':'id',
        'blog_container_aside':'class',
        'left-toolbox':'class',
        'canvas':'tag',
    })
    document.getElementsByClassName('main_father')[0].className = 'abc'
    var bodyWid = document.body.clientWidth;
    if (bodyWid<=1200){
        document.getElementsByClassName('container')[0].style.width = '800px';
    }else{
        document.getElementsByClassName('container')[0].style.width = '1200px';
    }
    //document.getElementById('csdn-toolbar').style.display='none'
    //document.getElementsByClassName('blog_container_aside')[0].style.display='none'
    function rm_el(dic){
        for(var key in dic){
            var tar = null
            try{
                switch(dic[key]){
                    case 'id':
                        tar = document.getElementById(key)
                        break
                    case 'class':
                        tar = document.getElementsByClassName(key)[0]
                        break
                }
            }catch(e){
                console.log(e)
            }
            if(tar!=null){
                tar.style.display='none'
                tar.parentElement.removeChild(tar)
            }
        }


    }
    // Your code here...
})();