CSDN 1-Click Downloader

1-Click Download CSDN pages to PDF

اعتبارا من 20-05-2024. شاهد أحدث إصدار.

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         CSDN 1-Click Downloader
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  1-Click Download CSDN pages to PDF
// @author       Spica Yeung
// @connect      www.csdn.net
// @match        https://blog.csdn.net/*/article/details/*
// @icon         none
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Add a button to the page
    const button = document.createElement('button');
    button.textContent = '↡';
    button.style.position = 'fixed';
    button.style.top = '50px';
    button.style.right = '5px';
    button.style.zIndex = 1000;
    button.style.padding = '5px 10px';
    button.style.background = 'white';
    button.style.border = '1px solid #ccc';
    button.style.cursor = 'pointer';
    document.body.appendChild(button);

    // Add click event to the button
    button.onclick = function() {
        $("#side").remove();
        $("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
        $(".nav_top_2011, #header, #navigator").remove();
        $(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box").remove();
        $("aside").remove();
        $(".tool-box").remove();
        $("#toolBarBox").remove();
        $("main").css('display', 'block'); // Adjusting to 'block' instead of 'content' for proper display
        $("main").css('float', 'none');   // Adjusting to 'none' to center the content after other elements are removed
        $(".option-box").remove();
        $("body").css('min-width', '0');
        window.print();
    };
})();