Greasy Fork is available in English.

🔥持续更新🔥 CSDN广告完全过滤、人性化脚本优化:🆕 不用再登录了!让你体验令人惊喜的崭新CSDN。

⚡️拥有数项独家功能的最强CSDN脚本,不服比一比⚡️|🕶无需登录CSDN,获得比会员更佳的体验|🖥分辨率自适配,分屏不用滚动|💾超级预优化|🔖独家超级免会员|🏷独家原创文章免登录展开|🔌独家推荐内容自由开关|📠独家免登录复制|🔗独家防外链重定向|📝独家论坛未登录自动展开文章、评论|🌵全面净化|📈沉浸阅读|🧴净化剪贴板|📕作者信息文章顶部展示

Verzia zo dňa 17.05.2020. Pozri najnovšiu verziu.

// ==UserScript==
// @name         🔥持续更新🔥 CSDN广告完全过滤、人性化脚本优化:🆕 不用再登录了!让你体验令人惊喜的崭新CSDN。
// @namespace    https://github.com/adlered
// @version      2.2.8
// @description  ⚡️拥有数项独家功能的最强CSDN脚本,不服比一比⚡️|🕶无需登录CSDN,获得比会员更佳的体验|🖥分辨率自适配,分屏不用滚动|💾超级预优化|🔖独家超级免会员|🏷独家原创文章免登录展开|🔌独家推荐内容自由开关|📠独家免登录复制|🔗独家防外链重定向|📝独家论坛未登录自动展开文章、评论|🌵全面净化|📈沉浸阅读|🧴净化剪贴板|📕作者信息文章顶部展示
// @author       Adler
// @connect      www.csdn.net
// @include      *://*.csdn.net/*
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js
// @supportURL   https://github.com/adlered/CSDNGreener/issues/new
// @contributionURL https://doc.stackoverflow.wiki/web/#/21?page_id=138
// @grant        GM_addStyle
// @note         20-05-17 2.2.8 更新脚本描述,展开评论的所有回复,删除创作中心按钮,加载进度条
// @note         20-05-17 2.2.7 更新脚本描述
// @note         20-05-16 2.2.6 修复第一次点击显示推荐内容无反应的问题
// @note         20-05-16 2.2.5 删除抢沙发角标,修改显示推荐内容按钮样式
// @note         20-05-16 2.2.4 感谢来自GitHub的朋友“HeronZhang”的Issue建议,删除所有博客花里胡哨的背景,主页分类中广告清除,CSS样式控制宽度适配代码优化
// @note         20-05-16 2.2.3 感谢来自GitHub的朋友“RetiredWorld”的代码贡献,使用CSS来控制样式,而不是JS,增大灵活性。
// @note         20-05-13 2.2.2 屏蔽您的缩放不是100%的提示
// @note         20-04-29 2.2.1 感谢大家的支持,增加目录显示,自动判断是否存在目录调整页面宽度,屏蔽新增广告,欢迎大家体验并提出意见!
// @note         20-04-15 2.2.0 一些广告被其他插件屏蔽导致的异常无视之
// @note         20-03-30 2.1.9 干掉“记录你的创作历程”,干掉未登录情况下的角标提醒
// @note         20-03-13 2.1.8 窄屏适配加强
// @note         20-03-13 2.1.7 更新简介
// @note         20-03-12 2.1.6 宽度自适应(感谢来自GitHub的朋友LeonG7的建议)!修复剪贴板净化无效的问题。
// @note         20-03-04 2.1.5 适配AdGuard
// @note         20-02-27 2.1.4 优化免登录复制
// @note         20-02-25 2.1.3 免登录复制更新,现已可用
// @note         20-02-24 2.1.2 By Github@JalinWang 更改去除剪贴板劫持的方式,使得原文格式在复制时能够保留
// @note         20-02-22 2.1.1 紧急修复由于 CSDN 修改前端结构导致的文章错位
// @note         20-02-11 2.1.0 若干动画优化,视觉体验更流畅
// @note         20-02-06 2.0.9 武汉加油!修改推荐内容切换开关位置,减少违和感
// @note         20-01-17 2.0.8 去除右侧广告
// @note         20-01-17 2.0.7 感谢来自GitHub的朋友“gleans”的建议,去掉页头广告
// @note         19-12-12 2.0.6 感谢来自GitHub的朋友“yexuesong”的建议,将作者信息在文章顶部展示
// @note         19-10-30 2.0.5 美化隐藏按钮,增加点击动画
// @note         19-10-30 2.0.4 删除CSDN官方在主页推送的文章(大多是广告)
// @note         19-10-30 2.0.3 添加更多屏蔽脚本
// @note         19-10-30 2.0.0 祝自己生日快乐~完全重写CSDNGreener,统一使用JQuery,效率更高
// @note         19-10-27 1.5.2 删除分享海报提示&&感谢GitHub的朋友“CHN-STUDENT”的反馈,去除底部课程推荐
// @note         19-10-27 1.5.1 感谢来自GitHub的朋友“CHN-STUDENT”的细致复现反馈,去除了底部的课程推荐广告
// @note         19-10-04 1.5.0 移除了底部主题信息和打赏
// @note         19-09-10 1.4.9 感谢来自GitHub的朋友“programmerZe”的细致复现反馈,修复了评论区点击查看回复后,已经展开的评论会收起的问题
// @note         19-09-04 1.4.8 感谢来自GitHub的朋友“dwdcth”的细致复现反馈,现在查看原创文章不会无限弹登录窗口了,且加强了自动展开功能
// @note         19-08-20 1.4.7 感谢油叉用户“SupremeSir”的反馈,修复了右侧悬浮栏遮挡文章的问题
// @note         19-08-14 1.4.6 无语。刚更新的免登录复制,又改了。修复!
// @note         19-08-13 1.4.5 更新了独家功能:免登录复制
// @note         19-08-13 1.4.4 感谢来自GitHub的朋友“iamsunxing”的反馈,修复了顶部不贴边的问题
// @note         19-08-01 1.4.3 感谢油叉用户“ddddy”的反馈,去除了更多推广广告
// @note         19-07-30 1.4.2 感谢油叉用户“周义杰”的反馈,增加了防CSDN外链重定向的功能(CSDN臭流氓)
// @note         19-07-20 1.4.1 修复了推荐内容开关跨文章无效问题(忘了配置Cookie作用域)
// @note         19-07-19 1.4.0 1. 构架大更新 2. 感谢来自GitHub的朋友"lukemin"的反馈,加入了下方推荐内容是否隐藏开关(实用)
// @note         19-07-13 1.3.0 感谢来自GitHub的朋友“Holaplace”的反馈,修复了文章无法自动展开的问题(CSDN总改这个,令人头疼)
// @note         19-06-08 1.2.6 感谢油叉用户“DeskyAki”的反馈,修复了文章无法自动展开的问题
// @note         19-06-07 1.2.4 修复了登录后评论无法正常打开的问题
// @note         19-06-07 1.2.3 感谢油叉用户"永远的殿下"的反馈,在一上午的努力攻克下,终于实现了未登录展开评论的语句
// @note         19-06-05 1.2.0 修复了评论无法自动展开的BUG
// @note         19-06-04 1.1.9 修复了无法自动展开的BUG(自闭了)
// @note         19-06-04 1.1.6 CSDN太坏了,把“消息”按钮的Class设置成了“GitChat”,所以修复了“消息”按钮消失的问题
// @note         19-06-04 1.1.5 1. 优化了论坛体验 2.美化、优化代码结构
// @note         19-06-04 1.1.4 感谢来自GitHub的朋友“iamsunxing”的反馈,增加了论坛广告匹配规则
// @note         19-06-03 1.1.3 感谢来自GitHub的朋友“wangwei135”的反馈,去除了评论区上方的广告
// @note         19-05-27 1.1.2 感谢油叉用户“夏伟杰”的反馈,修复了富文本编辑器无法使用的问题
// @note         19-05-25 1.1.0 1. 修复了主页广告的问题 2. 论坛自动展开 3. 论坛广告消除
// @note         19-05-25 1.0.9 感谢油叉用户“渣渣不准说话”的反馈,修复了收藏按钮消失的问题
// @note         19-03-01 1.0.3 添加页面选择性过滤规则
// @note         19-03-01 1.0.2 增加了净化剪贴板功能
// @note         19-03-01 1.0.1 修复了排版问题, 优化了代码结构
// @note         19-02-26 1.0.0 初版发布
// ==/UserScript==
var version = "2.2.8";
var currentURL = window.location.href;
var list;

$('head').append("<style>/* Make clicks pass-through */ #nprogress { pointer-events: none; } #nprogress .bar { background: #29d; position: fixed; z-index: 1031; top: 0; left: 0; width: 100%; height: 2px; } /* Fancy blur effect */ #nprogress .peg { display: block; position: absolute; right: 0px; width: 100px; height: 100%; box-shadow: 0 0 10px #29d, 0 0 5px #29d; opacity: 1.0; -webkit-transform: rotate(3deg) translate(0px, -4px); -ms-transform: rotate(3deg) translate(0px, -4px); transform: rotate(3deg) translate(0px, -4px); } /* Remove these to get rid of the spinner */ #nprogress .spinner { display: block; position: fixed; z-index: 1031; top: 15px; right: 15px; } #nprogress .spinner-icon { width: 18px; height: 18px; box-sizing: border-box; border: solid 2px transparent; border-top-color: #29d; border-left-color: #29d; border-radius: 50%; -webkit-animation: nprogress-spinner 400ms linear infinite; animation: nprogress-spinner 400ms linear infinite; } .nprogress-custom-parent { overflow: hidden; position: relative; } .nprogress-custom-parent #nprogress .spinner, .nprogress-custom-parent #nprogress .bar { position: absolute; } @-webkit-keyframes nprogress-spinner { 0%   { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } @keyframes nprogress-spinner { 0%   { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }</style>");

/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
 * @license MIT */

;(function(root, factory) {

  if (typeof define === 'function' && define.amd) {
    define(factory);
  } else if (typeof exports === 'object') {
    module.exports = factory();
  } else {
    root.NProgress = factory();
  }

})(this, function() {
  var NProgress = {};

  NProgress.version = '0.2.0';

  var Settings = NProgress.settings = {
    minimum: 0.08,
    easing: 'ease',
    positionUsing: '',
    speed: 200,
    trickle: true,
    trickleRate: 0.02,
    trickleSpeed: 800,
    showSpinner: true,
    barSelector: '[role="bar"]',
    spinnerSelector: '[role="spinner"]',
    parent: 'body',
    template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
  };

  /**
   * Updates configuration.
   *
   *     NProgress.configure({
   *       minimum: 0.1
   *     });
   */
  NProgress.configure = function(options) {
    var key, value;
    for (key in options) {
      value = options[key];
      if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
    }

    return this;
  };

  /**
   * Last number.
   */

  NProgress.status = null;

  /**
   * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
   *
   *     NProgress.set(0.4);
   *     NProgress.set(1.0);
   */

  NProgress.set = function(n) {
    var started = NProgress.isStarted();

    n = clamp(n, Settings.minimum, 1);
    NProgress.status = (n === 1 ? null : n);

    var progress = NProgress.render(!started),
        bar      = progress.querySelector(Settings.barSelector),
        speed    = Settings.speed,
        ease     = Settings.easing;

    progress.offsetWidth; /* Repaint */

    queue(function(next) {
      // Set positionUsing if it hasn't already been set
      if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();

      // Add transition
      css(bar, barPositionCSS(n, speed, ease));

      if (n === 1) {
        // Fade out
        css(progress, {
          transition: 'none',
          opacity: 1
        });
        progress.offsetWidth; /* Repaint */

        setTimeout(function() {
          css(progress, {
            transition: 'all ' + speed + 'ms linear',
            opacity: 0
          });
          setTimeout(function() {
            NProgress.remove();
            next();
          }, speed);
        }, speed);
      } else {
        setTimeout(next, speed);
      }
    });

    return this;
  };

  NProgress.isStarted = function() {
    return typeof NProgress.status === 'number';
  };

  /**
   * Shows the progress bar.
   * This is the same as setting the status to 0%, except that it doesn't go backwards.
   *
   *     NProgress.start();
   *
   */
  NProgress.start = function() {
    if (!NProgress.status) NProgress.set(0);

    var work = function() {
      setTimeout(function() {
        if (!NProgress.status) return;
        NProgress.trickle();
        work();
      }, Settings.trickleSpeed);
    };

    if (Settings.trickle) work();

    return this;
  };

  /**
   * Hides the progress bar.
   * This is the *sort of* the same as setting the status to 100%, with the
   * difference being `done()` makes some placebo effect of some realistic motion.
   *
   *     NProgress.done();
   *
   * If `true` is passed, it will show the progress bar even if its hidden.
   *
   *     NProgress.done(true);
   */

  NProgress.done = function(force) {
    if (!force && !NProgress.status) return this;

    return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
  };

  /**
   * Increments by a random amount.
   */

  NProgress.inc = function(amount) {
    var n = NProgress.status;

    if (!n) {
      return NProgress.start();
    } else {
      if (typeof amount !== 'number') {
        amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
      }

      n = clamp(n + amount, 0, 0.994);
      return NProgress.set(n);
    }
  };

  NProgress.trickle = function() {
    return NProgress.inc(Math.random() * Settings.trickleRate);
  };

  /**
   * Waits for all supplied jQuery promises and
   * increases the progress as the promises resolve.
   *
   * @param $promise jQUery Promise
   */
  (function() {
    var initial = 0, current = 0;

    NProgress.promise = function($promise) {
      if (!$promise || $promise.state() === "resolved") {
        return this;
      }

      if (current === 0) {
        NProgress.start();
      }

      initial++;
      current++;

      $promise.always(function() {
        current--;
        if (current === 0) {
            initial = 0;
            NProgress.done();
        } else {
            NProgress.set((initial - current) / initial);
        }
      });

      return this;
    };

  })();

  /**
   * (Internal) renders the progress bar markup based on the `template`
   * setting.
   */

  NProgress.render = function(fromStart) {
    if (NProgress.isRendered()) return document.getElementById('nprogress');

    addClass(document.documentElement, 'nprogress-busy');

    var progress = document.createElement('div');
    progress.id = 'nprogress';
    progress.innerHTML = Settings.template;

    var bar      = progress.querySelector(Settings.barSelector),
        perc     = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
        parent   = document.querySelector(Settings.parent),
        spinner;

    css(bar, {
      transition: 'all 0 linear',
      transform: 'translate3d(' + perc + '%,0,0)'
    });

    if (!Settings.showSpinner) {
      spinner = progress.querySelector(Settings.spinnerSelector);
      spinner && removeElement(spinner);
    }

    if (parent != document.body) {
      addClass(parent, 'nprogress-custom-parent');
    }

    parent.appendChild(progress);
    return progress;
  };

  /**
   * Removes the element. Opposite of render().
   */

  NProgress.remove = function() {
    removeClass(document.documentElement, 'nprogress-busy');
    removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
    var progress = document.getElementById('nprogress');
    progress && removeElement(progress);
  };

  /**
   * Checks if the progress bar is rendered.
   */

  NProgress.isRendered = function() {
    return !!document.getElementById('nprogress');
  };

  /**
   * Determine which positioning CSS rule to use.
   */

  NProgress.getPositioningCSS = function() {
    // Sniff on document.body.style
    var bodyStyle = document.body.style;

    // Sniff prefixes
    var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
                       ('MozTransform' in bodyStyle) ? 'Moz' :
                       ('msTransform' in bodyStyle) ? 'ms' :
                       ('OTransform' in bodyStyle) ? 'O' : '';

    if (vendorPrefix + 'Perspective' in bodyStyle) {
      // Modern browsers with 3D support, e.g. Webkit, IE10
      return 'translate3d';
    } else if (vendorPrefix + 'Transform' in bodyStyle) {
      // Browsers without 3D support, e.g. IE9
      return 'translate';
    } else {
      // Browsers without translate() support, e.g. IE7-8
      return 'margin';
    }
  };

  /**
   * Helpers
   */

  function clamp(n, min, max) {
    if (n < min) return min;
    if (n > max) return max;
    return n;
  }

  /**
   * (Internal) converts a percentage (`0..1`) to a bar translateX
   * percentage (`-100%..0%`).
   */

  function toBarPerc(n) {
    return (-1 + n) * 100;
  }


  /**
   * (Internal) returns the correct CSS for changing the bar's
   * position given an n percentage, and speed and ease from Settings
   */

  function barPositionCSS(n, speed, ease) {
    var barCSS;

    if (Settings.positionUsing === 'translate3d') {
      barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
    } else if (Settings.positionUsing === 'translate') {
      barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
    } else {
      barCSS = { 'margin-left': toBarPerc(n)+'%' };
    }

    barCSS.transition = 'all '+speed+'ms '+ease;

    return barCSS;
  }

  /**
   * (Internal) Queues a function to be executed.
   */

  var queue = (function() {
    var pending = [];

    function next() {
      var fn = pending.shift();
      if (fn) {
        fn(next);
      }
    }

    return function(fn) {
      pending.push(fn);
      if (pending.length == 1) next();
    };
  })();

  /**
   * (Internal) Applies css properties to an element, similar to the jQuery
   * css method.
   *
   * While this helper does assist with vendor prefixed property names, it
   * does not perform any manipulation of values prior to setting styles.
   */

  var css = (function() {
    var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
        cssProps    = {};

    function camelCase(string) {
      return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
        return letter.toUpperCase();
      });
    }

    function getVendorProp(name) {
      var style = document.body.style;
      if (name in style) return name;

      var i = cssPrefixes.length,
          capName = name.charAt(0).toUpperCase() + name.slice(1),
          vendorName;
      while (i--) {
        vendorName = cssPrefixes[i] + capName;
        if (vendorName in style) return vendorName;
      }

      return name;
    }

    function getStyleProp(name) {
      name = camelCase(name);
      return cssProps[name] || (cssProps[name] = getVendorProp(name));
    }

    function applyCss(element, prop, value) {
      prop = getStyleProp(prop);
      element.style[prop] = value;
    }

    return function(element, properties) {
      var args = arguments,
          prop,
          value;

      if (args.length == 2) {
        for (prop in properties) {
          value = properties[prop];
          if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
        }
      } else {
        applyCss(element, args[1], args[2]);
      }
    }
  })();

  /**
   * (Internal) Determines if an element or space separated list of class names contains a class name.
   */

  function hasClass(element, name) {
    var list = typeof element == 'string' ? element : classList(element);
    return list.indexOf(' ' + name + ' ') >= 0;
  }

  /**
   * (Internal) Adds a class to an element.
   */

  function addClass(element, name) {
    var oldList = classList(element),
        newList = oldList + name;

    if (hasClass(oldList, name)) return;

    // Trim the opening space.
    element.className = newList.substring(1);
  }

  /**
   * (Internal) Removes a class from an element.
   */

  function removeClass(element, name) {
    var oldList = classList(element),
        newList;

    if (!hasClass(element, name)) return;

    // Replace the class name.
    newList = oldList.replace(' ' + name + ' ', ' ');

    // Trim the opening and closing spaces.
    element.className = newList.substring(1, newList.length - 1);
  }

  /**
   * (Internal) Gets a space separated list of the class names on the element.
   * The list is wrapped with a single space on each end to facilitate finding
   * matches within the list.
   */

  function classList(element) {
    return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
  }

  /**
   * (Internal) Removes an element from the DOM.
   */

  function removeElement(element) {
    element && element.parentNode && element.parentNode.removeChild(element);
  }

  return NProgress;
});

(function () {
    'use strict';

    NProgress.start();
    l("CSDNGreener V" + version);
    var blockURL = currentURL.split("/").length;
    var main = /(www\.csdn\.net\/)$/;
    var mainNav = /nav/;
    var article = /article/;
    var bbs = /bbs\.csdn\.net/;
    var blog = /blog\.csdn\.net/;
    var blog2 = /\/article\/list\//;
    var download = /download\.csdn\.net/;
    var login = /passport\.csdn\.net/;
    var zone = /me\.csdn\.net/;

    // 数组初始化
    list = [];
    // 头部分
    // APP
    put(".app-app");
    // VIP
    put(".vip-caise");
    // 记录你的成长历程(记个毛)
    put("#writeGuide");
    // 新通知小圆点(未登录才消掉)
    if ($(".userinfo a").text() === '登录/注册') {
        put("#msg-circle");
    }
    // Cookie
    common(6, 1);

    if (main.test(currentURL) || mainNav.test(currentURL)) {
        l("正在优化主页体验...");
        // 常规
        // 头部广告
        put(".banner-ad-box");
        // 右侧广告
        put(".slide-outer");
        // 右侧详情
        put(".persion_article");
        clean(10);
        common(5, 10);
        loop(1);
    } else if ((blog.test(currentURL) && blockURL === 4) || blog2.test(currentURL)) {
        l("正在优化个人博客主页体验...");
        // 常规
        // 头部广告
        put(".banner-ad-box");
        // 右侧广告
        put(".slide-outer");
        // 右侧详情
        put(".persion_article");
        // 左侧广告
        put(".mb8");
        put("#kp_box_503");
        clean(10);
        common(5, 10);
        loop(1);
    } else if (article.test(currentURL)) {
        l("正在优化阅读体验...");
        GM_addStyle(`
            main{
                width: auto!important;
                float: none!important;
                max-width: 90vw;
            }
            main article img{
                margin: 0 auto;
                max-width: 100%;
                object-fit: cover;
            }
            @media (max-width: 1700px) and (min-width: 1550px){
            .container{
                width: auto;
            }
            }
        `);
        // 常规
        // 右侧广告,放到第一个清除
        // put(".recommend-right");
        put("#addAdBox");
        put(".aside-box.kind_person.d-flex.flex-column");
        put(".recommend-top-adbox");
        put(".recommend-list-box.d-flex.flex-column.aside-box");
        // 左侧广告
        put("#container");
        // 快来写博客吧
        put(".blog_tip_box");
        // 推荐关注用户
        put(".blog-expert-recommend-box");
        // 右下角VIP
        put(".meau-gotop-box");
        // 广告
        put(".mediav_ad");
        put(".pulllog-box");
        put(".recommend-ad-box");
        put(".box-shadow");
        put(".type_hot_word");
        put(".fourth_column");
        // 高分辨率时右侧文章推荐
        put(".right-item");
        // 广告
        put("#asideFooter");
        put("#ad-div");
        put("#479");
        put("#480");
        // 打赏
        put(".postTime");
        // 课程推荐
        put(".t0");
        // 分享海报
        put(".shareSuggest");
        // 底部主题
        put(".template-box");
        // 评论区广告
        put("div#dmp_ad_58");
        // 打赏
        put(".reward-user-box");
        // 右侧打赏按钮
        put(".to-reward");
        // 推荐内容广告
        put(".recommend-recommend-box");
        // 右侧广告
        put(".indexSuperise");
        // 抢沙发角标
        put(".comment-sofa-flag");
        // 创作中心
        put(".write-bolg-btn");
        clean(10);
        // 引入自定义CSDN样式
        $("<link>")
        .attr({ rel: "stylesheet",
        type: "text/css",
        href: "https://ftp.stackoverflow.wiki/csdn_addition.css"
        })
        .appendTo("head");
        setTimeout(function() {
           // 展开评论的所有回复
           $('.btn-read-reply').click();
        }, 1500);
        // 填充
        common(4, 5);
        // 评论
        common(1, 30);
        // 其它
        common(2, 20);
        // 顶部显示作者信息
        common(8, 1);
        // 循环线程开始
        loop(2);
    } else if (bbs.test(currentURL)) {
        l("正在优化论坛体验...");
        // 常规
        // 评论嵌入小广告
        put(".post_recommend");
        // 底部推荐
        put("#post_feed_wrap");
        // 底部相关文章里面的广告
        put(".bbs_feed_ad_box");
        put(".recommend-ad-box");
        // 底部相关文字里面的热词提示
        put(".type_hot_word");
        // 底部蓝色flex属性的广告栏+登录注册框
        put(".pulllog-box");
        // 猜你喜欢
        put(".personalized-recommend-box");
        // 发帖减半提示
        put(".totast-box");
        // 顶部广告
        put(".recommend-right");
        // 顶部广告
        put(".ad_top");
        clean(10);
        // 展开
        common(3, 50);
        common(5, 10);
    } else if (download.test(currentURL)) {
        l("正在优化下载页体验...");
        // 常规
        put(".fixed_dl");
        put("indexSuperise");
        clean(10);
        common(5, 10);
    } else if (login.test(currentURL)) {
        l("正在优化登录页体验...");
        // 常规
        // 登录界面大图广告
        put(".main-tu");
        clean(10);
        common(5, 10);
    } else if (zone.test(currentURL)) {
        l("正在优化个人空间体验...");
        // 常规
        clean(10);
        common(7, 10);
        common(5, 10);
    } else {
        e("不受支持的页面!");
    }
    setTimeout(function() {
        NProgress.done();
    }, 1500);
    l("超级优化完毕。");
    l("如果觉得好用,来 https://greasyfork.org/zh-CN/scripts/378351 收藏脚本来支持我吧!");
    l("开源&&提建议:https://github.com/AdlerED/CSDNGreener");
    l("我的博客:https://www.stackoverflow.wiki/");
    l("我的微信:1101635162");
})();

function l(log) {
    console.log("[CSDNGreener] " + log);
}

function e(error) {
    console.error("[CSDNGreener] " + error);
}

function clear() {
    list = [];
}

function put(tag) {
    list.push(tag);
}

function clean(times) {
    var loop = setInterval(function () {
        --times;
        if (times <= 0) {
            clearInterval(loop);
        }
        /* for (var j = 0; j < list.length; j++) {
            $(list[j]).hide(1000);
        }
        setInterval(function () {
        for (var k = 0; k < list.length; k++) {
            $(list[k]).remove();
        }
        }, 1000); */
        for (var k = 0; k < list.length; k++) {
            $(list[k]).remove();
        }
    }, 100);
    NProgress.inc();
}

function loop(num) {
    var did = false;
    setInterval(function () {
        if (num === 1) {
            // 主页中间的广告
            $(".J_adv").remove();
            // 主页有新的内容横条
            $(".feed-fix-box").remove();
            // 主页广告 iframe
            if (currentURL == "https://www.csdn.net/") {
                $("iframe").remove();
            }
            // 删除 CSDN 官方在主页的文章(大多是广告)
            $("li.clearfix").each(function(index, ele) {
                var banned = /csdn<\/a>/;
                var aMark = $(ele).find(".name").html();
                if (banned.test(aMark)) {
                    $(ele).remove();
                }
            });
        } else if (num === 2) {
            // 评论查看更多展开监听
            $("div.comment-list-box").css("max-height", "none");
            // 屏蔽您的缩放不是100%的提示
            $('.leftPop').remove();
        }
    }, 500);
}

function common(num, times) {
    var loop = setInterval(function () {
        --times;
        if (times <= 0) {
            clearInterval(loop);
        }
        if (num === 1) {
            // 查看更多
            $(".btn-readmore").removeClass("no-login");
            $(".btn-readmore").addClass("fans-read-more");
            $(".btn-readmore").removeAttr("href");
            $(".btn-readmore").removeAttr("target");
            $(".btn-readmore").removeAttr("rel");
            $(".btn-readmore").click();
            // 已登录用户展开评论
            try {
                document.getElementById("btnMoreComment").click();
            } catch (e) {}
            // 删除查看更多按钮
            $("#btnMoreComment").parent("div.opt-box").remove();
            // 展开内容
            $("div.comment-list-box").css("max-height", "none");
            // 改回背景颜色
            $(".login-mark").remove();
            // 删除登录框
            $(".login-box").remove();
            // 背景删除
            $('body').attr('style', 'background-image: none !important; background-color: #f5f6f7 !important; background: #f5f6f7 !important');
        } else if (num === 2) {
            // 挡住评论的“出头推荐”
            if ($(".recommend-box").length > 1) {
                $(".recommend-box")[0].remove();
            }
            // 去外链
            $("#content_views").off();
            // 去除推广广告
            $("li[data-type='ad']").remove();
            // 免登录复制
            $(".hljs-button").removeClass("signin");
            $(".hljs-button").addClass("{2}");
            $(".hljs-button").attr("data-title", "免登录复制");
            // 去除剪贴板劫持
            $("code").attr("onclick", "mdcp.copyCode(event)");
            try {
                // 复制时保留原文格式,参考 https://greasyfork.org/en/scripts/390502-csdnremovecopyright/code
                Object.defineProperty(window, "articleType", {
                    value: 0,
                    writable: false,
                    configurable: false
                });
            } catch (err) {
            }
            csdn.copyright.init("", "", "");
            // 页头广告
            try {
                document.getElementsByClassName("column-advert-box")[0].style.display="none";
            } catch (e) {}
            // 自动检测是否有目录,如果没有则删除右边栏,文章居中
            if ($(".recommend-right_aside").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
                $("#rightAside").remove();
                $(".container").css("margin", "auto");
            } else if ($("#recommend-right").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
                $("#rightAside").remove();
                $(".container").css("margin", "auto");
            }
        } else if (num == 3) {
            //论坛自动展开
            $(".js_show_topic").click();
        } else if (num == 4) {
            // 在这里删除原有响应式样式
            $(".main_father").removeClass("justify-content-center");
            $("csdn-side-toolbar").css("left", "auto")
        } else if (num == 5) {
            // 改回背景颜色
            $(".login-mark").remove();
            // 删除登录框
            $(".login-box").remove();
        } else if (num == 6) {
            // 推荐内容开关 cookie
            var removeCookie = $.cookie("remove");
            var remove;
            if (removeCookie == undefined) {
                $.cookie('remove', true, {
                    path: '/'
                });
                remove = true;
            }
            if (removeCookie == "true") {
                remove = true;
            } else {
                remove = false;
            }
            // 删除推荐内容(自定义)
            if (remove) {
                $(".recommend-box").hide();
            }
            // 推荐内容开关
            $(".blog-content-box").append("<br><div class='blog-content-box' id='switch' style='text-align: right;'></div>");
            // 初始化按钮
            $("#switch").append('<input type="checkbox" id="toggle-button"> <label for="toggle-button" class="button-label"> <span class="circle"></span> <span class="text on">&nbsp;</span> <span class="text off">&nbsp;</span> </label>' +
                               '<p style="margin-top: 5px; font-size: 13px;">显示推荐内容</p>');
            if (remove) {
                // 隐藏推荐内容
                $("#toggle-button").prop("checked", false);
            } else {
                // 显示推荐内容
                $("#toggle-button").prop("checked", true);
            }
            // 开关监听
            $("#toggle-button").click(function () {
                if (remove) {
                    $.cookie('remove', false, {
                        path: '/'
                    });
                    remove = false;
                    $(".recommend-box").slideDown(200);
                    $("#toggle-button").prop("checked", true);
                } else {
                    $.cookie('remove', true, {
                        path: '/'
                    });
                    remove = true;
                    $(".recommend-box").slideUp(200);
                    $("#toggle-button").prop("checked", false);
                }
            });
        } else if (num === 7) {
            $(".me_r")[1].remove();
        } else if (num === 8) {
            $(".article-bar-top").append("<br>");
            $(".article-bar-top").append($(".aside-box-footerClassify").children("dd").html());
            $("dl").each(function (index, element) {
                var key = $(this).children("dt");
                var value = $(this).children("dd").children("span");
                if (key.html().indexOf("原创") != -1) {
                    key = $(this).children("dt").children("a")
                    value = $(this).children("dd").children("a").children("span");
                    addInfo(key, value);
                } else
                if (value.html() != undefined) {
                    addInfo(key, value);
                }
            } );
            function addInfo(key, value) {
                var bind = key.html() + "&nbsp;" + value.html() + "&nbsp;&nbsp;";
                $(".article-bar-top").append(bind + " ");
            }
            $(".blog_container_aside").remove();
        }
    }, 100);
    NProgress.inc();
}