EasyCNBLOGS

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

  1. // ==UserScript==
  2. // @name EasyCNBLOGS
  3. // @description 这是一款促进博客园极致简洁和高效的插件。免费共享大量创新功能,如:净化页面、展示全屏、复制文本等。让我们的学习体验无比简洁、专注、高效、畅快。
  4. // @version 10.0
  5. // @author xcanwin
  6. // @namespace https://github.com/xcanwin/EasyCNBLOGS/
  7. // @supportURL https://github.com/xcanwin/EasyCNBLOGS/
  8. // @license GPL-2.0-only
  9. // @match *://www.cnblogs.com/*/p/*.html
  10. // @match *://www.cnblogs.com/*/archive/*.html
  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. .postTitle /*隐藏[正文的][顶部的]原标题*/,
  24. #right_meun /*隐藏[正文的][右边的]栏*/,
  25. #blog_post_info_block /*隐藏[正文的][底部的]推荐关注*/,
  26. .postDesc /*隐藏[正文的][底部的]文章信息栏*/,
  27. .postfoot /*隐藏[正文的][底部的]文章信息栏2*/
  28. {
  29. display: none !important;
  30. }
  31.  
  32. /*隐藏背景*/
  33. html body, .post, .postText, .postBody {
  34. background: none !important;
  35. background-image: unset !important;
  36. background-color: unset !important;
  37. }
  38.  
  39. /*展示全屏*/
  40. body {
  41. margin-left: unset !important;
  42. margin-right: unset !important;
  43. margin-bottom: unset !important;
  44. padding: unset !important;
  45. padding-bottom: unset !important;
  46. display: flex;
  47. justify-content: center;
  48. font-size: 16px !important;
  49. }
  50. .post {
  51. border: unset !important;
  52. border-bottom-width: unset !important;
  53. border-right-width: unset !important;
  54. padding: unset !important;
  55. margin-bottom: unset !important;
  56. width: 80%;
  57. font-size: 16px !important;
  58. line-height: 1.8 !important;
  59. }
  60. .postText, .postBody {
  61. padding-right: unset !important;
  62. padding-left: unset !important;
  63. padding-bottom: unset !important;
  64. padding-top: unset !important;
  65. border-bottom: unset !important;
  66. font-size: unset !important;
  67. line-height: unset !important;
  68. }
  69.  
  70. /*调整标题*/
  71. span[role="heading"] {
  72. display: flex;
  73. justify-content: center;
  74. margin-top: 35px !important;
  75. margin-bottom: 20px !important;
  76. color: black !important;
  77. font-size: 33px !important;
  78. font-family: 'PingFang SC','Microsoft YaHei','SimHei','Arial','SimSun';
  79. font-weight: bold;
  80. }
  81.  
  82. /*调整文章信息栏*/
  83. .newinfo {
  84. background: #f8f8f8;
  85. border-radius: 4px;
  86. font-size: 13px !important;
  87. display: flex;
  88. margin-bottom: 32px;
  89. align-items: center;
  90. }
  91. .newinfo a[href^="https://www.cnblogs.com/"] {
  92. margin-right: 23px;
  93. }
  94.  
  95. /*调整头像*/
  96. .newinfoimg {
  97. border-radius: 4px;
  98. width: 28px;
  99. height: 28px;
  100. margin: 6px;
  101. margin-right: 33px;
  102. border: 2px solid #eee;
  103. box-shadow: 0 0 0 2px #d9d9d9;
  104. }
  105.  
  106. /*正文的图片居中*/
  107. .post p img {
  108. display: flex;
  109. margin-left: auto;
  110. margin-right: auto;
  111. }
  112.  
  113. /*恢复滚动条*/
  114. body {
  115. overflow: unset !important;
  116. }
  117. `;
  118.  
  119. //净化页面
  120. const purifyPage = function() {
  121. GM_addStyle(purify_style_pc);
  122. };
  123.  
  124. //超净化页面
  125. const purifyPageSuper = function() {
  126. const p = $(".post");
  127. $('body').innerHTML = "";
  128. $('body').appendChild(p);
  129. };
  130.  
  131. //调整标题
  132. const beautyTitle = function() {
  133. $('.post').insertBefore($('span[role="heading"]'), $('.post').childNodes[0]);
  134. };
  135.  
  136. //调整文章信息栏
  137. const beautyInfo = function() {
  138. const ninfo = document.createElement('div');
  139. ninfo.classList.add('newinfo');
  140. const ninfoimg = document.createElement('img');
  141. ninfoimg.classList.add('newinfoimg');
  142. ninfoimg.src = $('link[rel="shortcut icon"]').href;
  143. const info_user = $('.postDesc a[href^="https://www.cnblogs.com/"]') || $('.postfoot a[href^="https://www.cnblogs.com/"]') ;
  144. info_user.style = 'color: #404040';
  145. const info_date = $('.postDesc #post-date') || $('.postfoot #post-date');
  146. info_date.style = 'color: #969696';
  147. ninfo.append(ninfoimg);
  148. ninfo.append(info_user);
  149. ninfo.append(info_date);
  150. $('.post').insertBefore(ninfo, $('.post').childNodes[1]);
  151. };
  152.  
  153. document.addEventListener("DOMContentLoaded", function() {
  154. purifyPageSuper();
  155. beautyTitle();
  156. beautyInfo();
  157. });
  158.  
  159. purifyPage();
  160.  
  161. })();

QingJ © 2025

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