CSDN免登录(不可用)+极简化

CSDN极简化

As of 2019-05-19. See the latest version.

// ==UserScript==
// @name         CSDN免登录(不可用)+极简化
// @namespace    https://github.com/Gccc9
// @version      1.5
// @description  CSDN极简化
// @author       Gccc9
// @match        *://blog.csdn.net/*
// @run-at       document-start
// ==/UserScript==

var removeElementsList = ['#nav-left-menu',    //头部栏的左侧导航条目
                              'li.write-bolg-btn', //头部栏的"写博客"
                              'li.baidu-app-btn',  //头部栏的"小程序"
                              '#mainBox aside',    //文章左侧信息框
                              '#dmp_ad_58',        //评论上方的广告
                              '.recommend-right',  //文章右侧信息框
                              '.tool-box',         //文章右侧工具栏 --‘点赞 评论数 目录 收藏 上下页’
                              '#adContent',        //右侧"VIP免广告"
                              '#reportContent',    //右侧"举报"按钮
                              '.recommend-ad-box', //底部相关文章里面的广告
                              '.type_hot_word',    //底部相关文字里面的热词提示
                              '.recommend-box',     //底部相关文章
                              '.pulllog-box',     //底部蓝色flex属性的广告栏+登录(不可用)注册(不可用)框
                              '#article_content > a > img'];//文章标题上方的广告
//添加css样式
function addStyle(css) {
    var e = document.createProcessingInstruction('xml-stylesheet','type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"');
    return document.insertBefore(e, document.documentElement);
}
var tackleInterval = setInterval(function(){
        if(document.querySelector("head") != null){
            clearInterval(tackleInterval);
            //查看文章全文
            addStyle(".article_content{height:auto !important;max-height:unset !important;}");
            addStyle(".hide-article-box{display:none !important;}");
            //导航栏位置修改
            addStyle("#csdn-toolbar > .container{width: 30% !important}");
            //文章宽度修改
            addStyle("#mainBox > main{width: 100% !important;}");
            //addStyle("#mainBox{width: inherit !important;}");
            //返回顶部位置修改
            addStyle("div.meau-gotop-box{left: unset !important;}");
            //文章底部评论
            addStyle("div.comment-list-box{max-height: unset !important}");
            addStyle("#btnMoreComment{display: none !important}");
            //移除不喜欢的元素
            removeElementsList.forEach(ele=>{
                addStyle(ele+"{display:none !important;}");
            });
        }
}, 100);

//评论页数
var remarkPage = setInterval(function(){
    if( document.querySelector("#commentPage") ){
        clearInterval(remarkPage);
        document.querySelector("#commentPage").classList.remove("d-none");
    }
},100);

//复制代码段
var copyCode = setInterval(function(){
    if( mdcp || hljs || csdn){
        clearInterval(copyCode);
        mdcp.signin = mdcp.copyCode;
        hljs.signin = hljs.copyCode;
        unsafeWindow.csdn.copyright.init("","","");
        $("head").append("<style>.hljs-button::after{content:'复制'}</style>");
        $(".hljs-button").click(()=>{
        $("head > style:contains('.hljs-button::after{content:'复制'}')").html("<style>.hljs-button::after{content:'复制成功'}</style>");
        setTimeout(()=>{
            $("head > style:contains('.hljs-button::after{content:'复制成功'}')").html("<style>.hljs-button::after{content:'复制'}</style>");
        },1000);
    });
    }
},100);


长期地址
遇到问题?请前往 GitHub 提 Issues。