Greasy Fork is available in English.

EasyCSDN

这是一款促进CSDN极致简洁和高效的插件。免费共享大量创新功能,如:净化页面、展示全屏、临时显示推荐等。让我们的学习体验无比简洁、专注、高效、畅快。

Fra 06.12.2023. Se den seneste versjonen.

  1. // ==UserScript==
  2. // @name EasyCSDN
  3. // @description 这是一款促进CSDN极致简洁和高效的插件。免费共享大量创新功能,如:净化页面、展示全屏、临时显示推荐等。让我们的学习体验无比简洁、专注、高效、畅快。
  4. // @version 16.0
  5. // @author xcanwin
  6. // @namespace https://github.com/xcanwin/EasyCSDN/
  7. // @supportURL https://github.com/xcanwin/EasyCSDN/
  8. // @license GPL-2.0-only
  9. // @match *://blog.csdn.net/*/article/details/*
  10. // @match *://*.blog.csdn.net/article/details/*
  11. // @grant GM_addStyle
  12. // @run-at document-start
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const $ = (Selector, el) => (el || document).querySelector(Selector);
  19. const $$ = (Selector, el) => (el || document).querySelectorAll(Selector);
  20.  
  21. /*电脑端净化样式*/
  22. const purify_style_pc = `
  23. .passport-login-container /*隐藏[置顶的]登录提示*/,
  24. .passport-login-tip-container /*隐藏[置顶的]登录权益提示*/,
  25. body>#toolbarBox /*隐藏[置顶的][顶部的]菜单栏*/,
  26. .left-toolbox /*隐藏[置顶的][底部的]关注栏*/,
  27. .blog_container_aside /*隐藏[左边的]栏*/,
  28. #rightAside /*隐藏[右边的]栏*/,
  29. .csdn-side-toolbar /*隐藏[右边的]磁吸栏*/,
  30. .blog-footer-bottom /*隐藏[底部的]网站介绍*/,
  31. .recommend-nps-box /*隐藏[底部的]打分*/,
  32. .blog-tags-box /*隐藏[正文的][顶部的]分类*/,
  33. .column-group /*隐藏[正文的][顶部的]加入社区*/,
  34. #blogColumnPayAdvert /*隐藏[正文的][顶部的]专栏*/,
  35. .more-toolbox-new /*隐藏[正文的][底部的]关注栏*/,
  36. #treeSkill /*隐藏[正文的][底部的]技能树*/,
  37. .recommend-box /*隐藏[正文的][底部的]推荐文章*/,
  38. code .hljs-button /*隐藏[正文的][代码块的]复制提示*/,
  39. .article-search-tip /*隐藏[正文的]搜索提示*/
  40. {
  41. display: none !important;
  42. }
  43.  
  44. /*隐藏背景*/
  45. body {
  46. background: none !important;
  47. background-image: unset !important;
  48. background-color: unset !important;
  49. }
  50.  
  51. /*标题居中*/
  52. #articleContentId {
  53. display: flex;
  54. justify-content: center;
  55. }
  56.  
  57. /*正文的div居中*/
  58. #mainBox {
  59. display: flex;
  60. justify-content: center;
  61. }
  62.  
  63. /*展示全屏*/
  64. #mainBox {
  65. width: 100%;
  66. }
  67. #mainBox main {
  68. width: 95%;
  69. margin-bottom: unset !important;
  70. }
  71. .main_father {
  72. padding: unset !important;
  73. }
  74. .main_father.d-flex {
  75. display: unset !important;
  76. }
  77.  
  78. /*临时显示*/
  79. .show-temp {
  80. display: unset !important;
  81. }
  82.  
  83. /*适当展示图片*/
  84. img {
  85. max-width: 70% !important;
  86. }
  87. `;
  88.  
  89.  
  90. /*移动端净化样式*/
  91. const purify_style_mb = `
  92. #csdn-toolbar /*隐藏[置顶的][顶部的]菜单栏*/,
  93. #operate /*隐藏[置顶的][底部的]搜索标签与评论*/,
  94. .aside-header-fixed /*隐藏[顶部的]关注*/
  95. {
  96. display: none !important;
  97. }
  98.  
  99. /*展示全屏*/
  100. body #main {
  101. padding-top: unset !important;
  102. margin-top: unset !important;
  103. }
  104. body {
  105. padding-bottom: unset !important;
  106. }
  107.  
  108. /*展示分界线*/
  109. .spec_space {
  110. background-color: #ffebeb !important;
  111. height: 32px !important;
  112. }
  113. `;
  114.  
  115. //净化页面
  116. const purifyPage = function() {
  117. GM_addStyle(purify_style_pc);
  118. GM_addStyle(purify_style_mb);
  119. };
  120.  
  121. //显示推荐的开关
  122. const showRecommend = function() {
  123. const sr = document.createElement("div");
  124. sr.style = "height: 64px; background-color: #eaeaea;";
  125. sr.onclick = function() {
  126. $$(".recommend-box").forEach(el => {
  127. el.classList.toggle("show-temp");
  128. });
  129. $(".recommend-box")?.scrollIntoView();
  130. };
  131. $('main').insertBefore(sr, $('.recommend-box'));
  132. };
  133.  
  134. window.onload = function() {
  135. showRecommend();
  136. };
  137.  
  138. purifyPage();
  139.  
  140. })();