CSDN净化

filter/format csdn css

As of 10/01/2023. See the latest version.

// ==UserScript==
// @name         CSDN净化
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  filter/format csdn css
// @author       细粒丁
// @match        *://*.csdn.net/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 背景调成深色,看起来更舒适
    // $("body").css("background-color", "dimgray");
/*
    // 直接删除顶部谷歌广告
    const topBar = document.getElementsByClassName("toolbar-advert")[0]
    console.log(topBar)
    if (topBar != null) {
        topBar.remove();
    }
*/
    console.log("???")
    var adBar = setInterval(removeAdBar, 1000);
    var time = 0
    function removeAdBar() {

        var adBar = document.getElementsByClassName("toolbar-advert")[0];
        if (adBar != null) {
            adBar.remove();
            clearInterval(adBar);
        }
        if (time == 10) {
            clearInterval(adBar);
        }
        time++;

    }


    /***** 侧边栏开始 *****/
    /*
        asideHotArticle: 热门文章
        asideSearchArticle: 搜索博主文章
        asideCategory: 分类专栏
        asideNewComments: 最新评论
        asideNewNps: 您愿意向朋友推荐“博客详情页”吗?
        asideArchive: 最新文章
    */

    var sideBarListID = ["asideHotArticle", "asideSearchArticle", "asideCategory", "asideNewComments", "asideNewNps", "asideArchive"]
    for(let i in sideBarListID){
        const dom = document.getElementById(sideBarListID[i])
        console.log(dom)
        if(dom != null){
            dom.remove();
        }
    }

    var programmer1Box = document.getElementsByClassName("programmer1Box")[0]
    if (programmer1Box != null) {
        programmer1Box.remove();
    }

    // 右边 分类专栏
    var kind_person = document.getElementsByClassName("kind_person")[0]
    if (kind_person != null) {
        kind_person.remove();
    }

    var recommendAdBox = document.getElementById("recommendAdBox")
    if (recommendAdBox != null) {
        recommendAdBox.remove();
    }

    var asideArchive = document.getElementById("asideArchive")
    if (asideArchive != null) {
        asideArchive.remove();
    }


    var asideProfile = document.getElementById("asideProfile")
    if (asideProfile != null) {
        asideProfile.style.position = "absolute";
        asideProfile.style.top = "56px"
        asideProfile.style.width = "300px"
    }

    window.onload = function () {

    }

})();