Pure_CSDN

净化CSDN

2023-04-20 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

  1. // ==UserScript==
  2. // @name Pure_CSDN
  3. // @namespace https://blog.csdn.net/*
  4. // @match https://blog.csdn.net/*
  5. // @grant none
  6. // @version 0.6.2
  7. // @author 13号寄信人
  8. // @description 净化CSDN
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. appendStyle(buildCss())
  16.  
  17. function buildCss() {
  18. if (browserDetection() !== "PC") {
  19. //------------------------移动端------------------------
  20. return `
  21. .wap-shadowbox , .readall_box {
  22. display: none !important;
  23. }
  24. .article_content{
  25. height:auto !important;
  26. }
  27. `
  28. } else {
  29. //------------------------桌面端------------------------
  30. return `
  31. .blog_container_aside , #rightAside , .csdn-side-toolbar {
  32. display: none !important;
  33. }
  34. #mainBox {
  35. display: flex !important;
  36. justify-content: center !important;
  37. }
  38. `
  39. }
  40. }
  41.  
  42. function appendStyle(css) {
  43. let styleNode = document.createElement("style");
  44. styleNode.appendChild(document.createTextNode(css));
  45. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  46. }
  47.  
  48. function browserDetection() {
  49. const userAgent = window.navigator.userAgent.toLowerCase();
  50. let browser = null;
  51. if (userAgent.match(/ipad/i)) {
  52. browser = 'ipad';
  53. } else if (userAgent.match(/iphone os/i)) {
  54. browser = 'iphone';
  55. } else if (userAgent.match(/midp/i)) {
  56. browser = 'midp'
  57. } else if (userAgent.match(/rv:1.2.3.4/i)) {
  58. browser = 'rv:1.2.3.4';
  59. } else if (userAgent.match(/ucweb/i)) {
  60. browser = 'ucweb';
  61. } else if (userAgent.match(/android/i)) {
  62. browser = 'android';
  63. } else if (userAgent.match(/windows ce/i)) {
  64. browser = 'windowsCe';
  65. } else if (userAgent.match(/windows mobile/i)) {
  66. browser = 'windowsMobile';
  67. } else {
  68. browser = 'PC'
  69. }
  70. return browser;
  71. }
  72. })();