csdn纯净版

csdn纯净版-只保留文字与评论

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         csdn纯净版
// @description  csdn纯净版-只保留文字与评论
// @version      0.3
// @author       tomiaa
// @match      *://blog.csdn.net/*
// @namespace    http://tampermonkey.net/


// ==/UserScript==
; (() => {
  const $ = id => document.querySelector(id);
  console.clear();
  const config = {
    'default': {
      remove: [
        /* 左侧 */
        '#asideSearchArticle',
        '#asideHotArticle',
        '#asideCategory',
        '#asideNewNps',
        '#asideArchive',
        '.aside-box-footer',
        '#asideNewComments',

        '.blog-tags-box',
        '.article-type-img',
        '.c-gray',
        '#blogColumnPayAdvert',
        '#health-companies',
        '.tool-QRcode',
        '.toolbar-advert',



        /* 右侧 */
        '#asideArchive',
        '.csdn-side-toolbar',


        '#copyright-box', // 底部
        '.recommend-box', // 推荐文章
        '.recommend-tit-mod',
        '.template-box',

        '.comment-sofa-flag',
        

        '#footerRightAds',


      ],
      css: `
      .more-toolbox-active .left-toolbox{
        transform: translateX(-34.4%) !important;
        left: 50% !important;
      }
      body{
        background: #f6f0da !important;
      }
      `,
    }
  }
  class Clear {

    constructor(config) {
      this.config = config;
      this.domain = '';
      this.query = null;
      this.init();
    }

    init() {
      // const currentHref = location.href.split('?');
      // this.domain = currentHref[0];
      this.domain = 'default'
      // this.query = currentHref[1];
      console.log(this.domain);

      this.removeToHidden(this.config?.[this.domain]?.remove);
      this.addCss(this.config?.[this.domain]?.css);
      this.remove(this.config?.[this.domain]?.remove);
      this.config?.[this.domain]?.fn?.();

    }

    remove(arr = []) {
      arr.map(item => $(item)).forEach(item => {
        item?.remove();
      })
    }

    removeToHidden(arr = []) {
      if (!arr.length) return;
      this.addCss(arr.join(',') + `{    
        display: none !important;
      }`)
    }

    addCss(css = '') {
      if (!css) return;
      let style = document.createElement('style')
      style.innerHTML = css;
      document.documentElement.appendChild(style);
    }

  }
  new Clear(config);
})();