Greasy Fork

Greasy Fork is available in English.

H2P: CSDN 界面优化

CSDN 界面优化

当前为 2020-07-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        H2P: CSDN 界面优化
// @namespace   http://tampermonkey.net/
// @version     0.0.2
// @icon        https://csdnimg.cn/cdn/content-toolbar/csdn-logo.png?v=20200416.1
// @description CSDN 界面优化
// @author      H2P
// @compatible  chrome
// @match       *://so.csdn.net/so/search/s.do?*
// @match       *://blog.csdn.net/*
// @note        2020.07.20-V0.0.01      搜索界面和博客界面元素隐藏
// @note        2020.07.20-V0.0.02      点赞栏位置固定
// ==/UserScript==

(function() {
  'use strict';

  const isCSDNSearch  = window.location.href.includes('/so.csdn.net/so/search/');
  const isCSDNBlog    = window.location.href.includes('/blog.csdn.net/');
  console.log(`isCSDNBlog: ${isCSDNBlog}`);

  let eleStyle = document.createElement('style');

  if (isCSDNSearch) {
    // 右侧边栏
    eleStyle.innerHTML += `
      .con-r { display: none!important; }
      .con-l { width: 100%; }
      .con-l .con-l-right { width: calc(100% - 104px); }
    `;
  } else if (isCSDNBlog) {
    // 右侧推荐、最新评论、热门文章
    eleStyle.innerHTML += `
      #rightAside, #asideNewComments,
      #asideHotArticle { display: none!important; }
      .more-toolbox .left-toolbox { position: relative!important; }
      #asideArchive { margin-bottom: 40px!important; }
    `;
    // 举报
    eleStyle.innerHTML += `
      .csdn-side-toolbar { display: none!important; }
    `;
    // 推荐、评论
    eleStyle.innerHTML += `
      .first-recommend-box,
      .second-recommend-box,
      .comment-box { display: none!important; }
    `;
    // 皮肤主题、底部
    eleStyle.innerHTML += `
      .template-box, .bottom-pub-footer { display: none!important; }
    `;
  }

  document.head.appendChild(eleStyle);
})();