Simple Print LeetCode Problems

Removed unnecessary elements in the page for a clear PDF print of the leetcode question only

Από την 01/05/2017. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Simple Print LeetCode Problems
// @namespace    https://greatest.deepsurf.us/en/users/114838-groundzyy
// @version      0.2
// @description  Removed unnecessary elements in the page for a clear PDF print of the leetcode question only
// @author       groundzyy
// @match        https://leetcode.com/problems/*
// ==/UserScript==

(function() {
    'use strict';
    $(document).ready(function() {
        var diff = $('.question-info > ul li:nth-child(5)').text();
        $('#tab-view-app').remove();
        $('#add-to-favorite').remove();
        $('.question-info').remove();
        $('.notepad-wrapper').remove();
        $('#interviewed-div').remove();
        $('section.action').remove();
        $('div.ng-scope').remove();
        $('div.navbar').remove();
        $('#submission-form-app').remove();
        // $('footer').remove();
        $('#chat-link').remove();
        $('span.hidebutton').css('display', 'inline');
        $('#tags').remove();
        $('#similar').remove();
        $('a.btn-primary').css('border', '1px solid silver');
        $('a.btn-primary').removeAttr("href");
        $('a[href="/subscribe/"]').parent().remove();
        $('head title').text($('.question-title > h3').text().trim().replace('.', ''));
        $('body').css('font-size', '28px');
        $('pre').css('font-size', '22px');
        $('a.btn-primary').css('font-size', '20px');
        // $('a.btn-primary').parent().parent().css('margin-top', '10px');
        $('div.question-title h3').css('font-size', '32px');
        $('p').css('margin-bottom', '28px');
        $('p').css('margin-top', '28px');
        $('footer').remove();
        $('div.content-wrapper').append('<hr style="margin-top:100px;"/>');
        $('div.content-wrapper').append('<div><span class="hidebutton" style="display: inline;"> <a class="btn btn-xs btn-primary" style="border: 1px solid silver; font-size: 20px;">' + diff + '</a></span></div>');
        $('div.content-wrapper').append($('a.btn-primary').parent().parent());
        $('pre').css('white-space', 'pre-wrap');
        $('pre').css('font-size', '28px');
        $('.question-content').css('line-height', '42px');
        $('.showspoilers').remove();
        $('div.spoilers').css('display', 'block');
        $('div.spoilers').css('margin-top', '100px');
        $('div.spoilers').css('font-size', '20px');
        $("b:contains('Credits:')").parent().remove();
    });
})();