Greasy Fork is available in English.

EasyCNBLOGS

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

2023-12-17 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name EasyCNBLOGS
  3. // @description 这是一款促进博客园极致简洁和高效的插件。免费共享大量创新功能,如:净化页面等。让我们的学习体验无比简洁、专注、高效、畅快。
  4. // @version 6.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 {
  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. }
  59. .postText, .postBody {
  60. padding-right: unset !important;
  61. padding-left: unset !important;
  62. padding-bottom: unset !important;
  63. padding-top: unset !important;
  64. border-bottom: unset !important;
  65. }
  66.  
  67. /*调整标题*/
  68. span[role="heading"] {
  69. display: flex;
  70. justify-content: center;
  71. margin-top: 35px !important;
  72. margin-bottom: 20px !important;
  73. color: black !important;
  74. font-size: 33px !important;
  75. font-family: 'PingFang SC','Microsoft YaHei','SimHei','Arial','SimSun';
  76. font-weight: bold;
  77. }
  78.  
  79. /*调整文章信息栏*/
  80. .newinfo {
  81. background: #f8f8f8;
  82. border-radius: 4px;
  83. font-size: 13px !important;
  84. display: flex;
  85. margin-bottom: 32px;
  86. align-items: center;
  87. }
  88. .newinfo a[href^="https://www.cnblogs.com/"] {
  89. margin-right: 23px;
  90. }
  91.  
  92. /*调整头像*/
  93. .newinfoimg {
  94. border-radius: 4px;
  95. width: 28px;
  96. height: 28px;
  97. margin: 6px;
  98. margin-right: 33px;
  99. }
  100. `;
  101.  
  102. //净化页面
  103. const purifyPage = function() {
  104. GM_addStyle(purify_style_pc);
  105. };
  106.  
  107. //超净化页面
  108. const purifyPageSuper = function() {
  109. const p = $(".post");
  110. $('body').innerHTML = "";
  111. $('body').appendChild(p);
  112. };
  113.  
  114. //调整标题
  115. const beautyTitle = function() {
  116. $('.post').insertBefore($('span[role="heading"]'), $('.post').childNodes[0]);
  117. };
  118.  
  119. //调整文章信息栏
  120. const beautyInfo = function() {
  121. const ninfo = document.createElement('div');
  122. ninfo.classList.add('newinfo');
  123. const ninfoimg = document.createElement('img');
  124. ninfoimg.classList.add('newinfoimg');
  125. ninfoimg.src = $('link[rel="shortcut icon"]').href;
  126. const info_user = $('.postDesc a[href^="https://www.cnblogs.com/"]') || $('.postfoot a[href^="https://www.cnblogs.com/"]') ;
  127. info_user.style = 'color: #404040';
  128. const info_date = $('.postDesc #post-date') || $('.postfoot #post-date');
  129. info_date.style = 'color: #969696';
  130. ninfo.append(ninfoimg);
  131. ninfo.append(info_user);
  132. ninfo.append(info_date);
  133. $('.post').insertBefore(ninfo, $('.post').childNodes[1]);
  134. };
  135.  
  136. document.addEventListener("DOMContentLoaded", function() {
  137. purifyPageSuper();
  138. beautyTitle();
  139. beautyInfo();
  140. });
  141.  
  142. purifyPage();
  143.  
  144. })();