CSDN tools

download csdn page clearly!

当前为 2025-01-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CSDN tools
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.2
  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. if (right_content != null && right_content.length > 0) {
  40. right_content.remove();
  41. }
  42. var main_content = document.getElementsByClassName("blog-content-box");
  43. if (main_content.length > 0) {
  44. main_content[0].style.margin = "0 auto";
  45. main_content[0].style.maxWidth = "1000px";
  46. }
  47. //Auto expand the code of the article
  48. var code_expand_buttons = document.querySelectorAll(".look-more-preCode");
  49. if (code_expand_buttons != null && code_expand_buttons.length > 0) {
  50. code_expand_buttons.forEach(function (button) {
  51. button.click();
  52. })
  53. }
  54.  
  55.  
  56. }
  57. function removeElementsForCnblogs() {
  58. $("#navigator").remove();
  59. $("#cnblogs_ch").remove();
  60. $("#under_post_card2").remove();
  61. $("#under_post_card1").remove();
  62. $(".esa-catalog-contents").remove();
  63. $(".aplayer-body, #ap").remove();
  64. $("#scrollInfo").remove();
  65. $("#footer").remove();
  66. $(".login_tips").remove();
  67. $("#blog_c1").remove();
  68. $("#blog_post_info").remove();
  69. $(".postDesc").remove();
  70. $("#blog_post_info_block").remove();
  71. }
  72.  
  73. if (url.match("/.*?csdn\.net*?/")) {
  74. // alert("csdn");
  75. window.onload = removeElementsForCSDN();
  76. }
  77. if (url.match("/.*?cnblogs.*?/")) {
  78.  
  79. // alert("cnblogs");
  80. window.onload = removeElementsForCnblogs();
  81. }
  82.  
  83.  
  84. })();

QingJ © 2025

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