CSDN tools

download csdn page clearly!

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name CSDN tools
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.4
  5. // @description download csdn page clearly!
  6. // @author youguess
  7. // @include *://blog.csdn.net/*
  8. // @include *://www.cnblogs.com/*
  9. // @icon https://img-home.csdnimg.cn/images/20201124032511.png
  10. // @grant none
  11. // @license Apache-2.0
  12. // ==/UserScript==
  13.  
  14. var download = (function () {
  15. 'use strict';
  16.  
  17. // Your code here...、
  18. // get url to identify the page
  19. let url = window.location.href;
  20. // alert(url);
  21.  
  22. function removeElementsForCSDN() {
  23. $("#side").remove();
  24. $("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
  25. $(".nav_top_2011, #header, #navigator").remove();
  26. $(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box").remove();
  27. $("aside").remove();
  28. $(".tool-box").remove();
  29. $("#toolBarBox").remove();
  30. $("main").css('display', 'content');
  31. $("main").css('float', 'left');
  32. $(".option-box").remove();
  33. $("body").css('min-width', 0);
  34. $(".option-box").remove();
  35. $("#copyright-box").remove();
  36. $("#blogExtensionBox").remove();
  37. $("#toolbarBox").remove();
  38. var right_content = document.getElementById("rightAsideConcision");
  39. console.log(right_content);
  40. if (right_content) {
  41. console.log("right_content cleared");
  42. right_content.remove();
  43. }
  44.  
  45. var main_content = document.getElementsByClassName("blog-content-box");
  46. if (main_content) {
  47. main_content[0].style.margin = "0 auto";
  48. main_content[0].style.maxWidth = "800px";
  49. }
  50.  
  51. //Auto expand the code of the article
  52. var code_expand_buttons = document.querySelectorAll(".look-more-preCode");
  53. if (code_expand_buttons) {
  54. code_expand_buttons.forEach(function (button) {
  55. button.click();
  56. })
  57. }
  58.  
  59.  
  60. }
  61. function removeElementsForCnblogs() {
  62. $("#navigator").remove();
  63. $("#cnblogs_ch").remove();
  64. $("#under_post_card2").remove();
  65. $("#under_post_card1").remove();
  66. $(".esa-catalog-contents").remove();
  67. $(".aplayer-body, #ap").remove();
  68. $("#scrollInfo").remove();
  69. $("#footer").remove();
  70. $(".login_tips").remove();
  71. $("#blog_c1").remove();
  72. $("#blog_post_info").remove();
  73. $(".postDesc").remove();
  74. $("#blog_post_info_block").remove();
  75. }
  76.  
  77. if (url.match("/.*?csdn\.net*?/")) {
  78. // alert("csdn");
  79. window.onload = removeElementsForCSDN();
  80. }
  81. if (url.match("/.*?cnblogs.*?/")) {
  82.  
  83. // alert("cnblogs");
  84. window.onload = removeElementsForCnblogs();
  85. }
  86.  
  87.  
  88. })();