Greasy Fork is available in English.

CSDN 1-Click Downloader

1-Click Download CSDN pages to PDF

2024-07-18 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

  1. // ==UserScript==
  2. // @name CSDN 1-Click Downloader
  3. // @namespace https://github.com/ySpica
  4. // @version 1.2
  5. // @description 1-Click Download CSDN pages to PDF
  6. // @author Spica Yeung
  7. // @connect www.csdn.net
  8. // @match https://blog.csdn.net/*/article/details/*
  9. // @icon none
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // Create a wrapper div for hover detection
  18. const hoverArea = document.createElement('div');
  19. hoverArea.style.position = 'fixed';
  20. hoverArea.style.left = '0';
  21. hoverArea.style.bottom = '0';
  22. hoverArea.style.width = '100px'; // Hover area width
  23. hoverArea.style.height = '100px'; // Hover area height
  24. hoverArea.style.zIndex = 999;
  25. hoverArea.style.background = 'transparent';
  26. document.body.appendChild(hoverArea);
  27.  
  28. // Add a button to the page
  29. const button = document.createElement('button');
  30. button.textContent = '↡';
  31. button.style.position = 'fixed';
  32. button.style.left = '10px';
  33. button.style.bottom = '10px';
  34. button.style.zIndex = 1000;
  35. button.style.padding = '7.5px 15px';
  36. button.style.fontSize = '1.5em';
  37. button.style.background = 'white';
  38. button.style.border = '1px solid #ccc';
  39. button.style.cursor = 'pointer';
  40. button.style.display = 'none';
  41. document.body.appendChild(button);
  42.  
  43. // Show the button when hovering over the hover area
  44. hoverArea.onmouseover = function() {
  45. button.style.display = 'block';
  46. };
  47.  
  48. // Hide the button when not hovering over the button or the hover area
  49. hoverArea.onmouseout = function() {
  50. if (!button.matches(':hover')) {
  51. button.style.display = 'none';
  52. }
  53. };
  54.  
  55. button.onmouseout = function() {
  56. if (!hoverArea.matches(':hover')) {
  57. button.style.display = 'none';
  58. }
  59. };
  60.  
  61. button.onclick = function() {
  62. button.style.display = 'none'; // Hide the button after clicking
  63. $("#side").remove();
  64. $("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
  65. $(".nav_top_2011, #header, #navigator").remove();
  66. $(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box").remove();
  67. $("aside").remove();
  68. $(".tool-box").remove();
  69. $("#toolBarBox").remove();
  70. $("main").css('display', 'block');
  71. $("main").css('float', 'none');
  72. $(".option-box").remove();
  73. $("body").css('min-width', '0');
  74. window.print();
  75. };
  76. })();