CSDN无用信息删除脚本

删除csdn无用信息

目前为 2024-01-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         CSDN无用信息删除脚本
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  删除csdn无用信息
// @author       Your name
// @match        https://blog.csdn.net/*
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

(function() {
    'use strict';

    var message = '选择是否开启页面优化脚本';

    var shouldPrompt = GM_getValue('shouldPrompt', true);
    var shouldExecute = GM_getValue('shouldExecute', false);

    if (shouldPrompt) {
        if (confirm(message)) {
            GM_setValue('shouldPrompt', false);
            GM_setValue('shouldExecute', true);
            location.reload();
        } else {
            return;
        }
    }

    if (shouldExecute) {

        var elements = document.querySelectorAll('div[class*="recommend-box"],div[id*="treeSkill"],div[id*="recommendNps"]');
        for (var i = 0; i < elements.length; i++) {
            var element = elements[i];
            element.parentNode.removeChild(element);
        }


        var divs = document.querySelectorAll("div[class*='left-toolbox'],div[class*='user-profile-body-left'], aside[class*='blog_container_aside'],div[id*='copyright-box'],div[class*='user-profile-head'],div[class*='csdn-side-toolbar'],div[id*='blog-slide-new']");

        divs.forEach(function(div) {
            element.style.display = 'none';
            div.remove();
        });

        var mainBox = document.getElementById('mainBox');
        if (mainBox) {
            mainBox.style.width = '100%';
            mainBox.style.display = 'flex';
            mainBox.style.justifyContent = 'center';
            mainBox.style.flexWrap = 'wrap';
        }

    }








})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址