leetcode hide premium problems

Hide Premium Problems on Leetcode

اعتبارا من 04-04-2017. شاهد أحدث إصدار.

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         leetcode hide premium problems
// @description:en Hide Premium Problems on Leetcode
// @namespace    https://greatest.deepsurf.us/en/users/22079-hntee
// @version      0.4
// @author       hntee
// @match        https://leetcode.com/*
// @description Hide Premium Problems on Leetcode
// ==/UserScript==

(function() {
    'use strict';
    observeDomChange();
})();

function observeDomChange() {
    var MutationObserver = window.MutationObserver;
    var myObserver       = new MutationObserver (mutationHandler);
    var obsConfig        = {
        childList: true, attributes: true,
        subtree: true,   attributeFilter: ['list-group']
    };
    myObserver.observe(document, obsConfig);
    function mutationHandler (mutationRecords) {
        var locked = "div > i.fa-lock";
        var num_locked = $(locked).length;
        $(locked).parent().parent().parent().hide();
        if ($('#welcome strong').length == 1) {
            info = $('#welcome strong').text();
            num_finished = Number(info.split('/')[0]);
            num_questions = Number(info.split('/')[1]);
            num_unlocked = num_questions - num_locked;
            console.log(info);
            console.log(num_finished);
            console.log(num_questions);
            console.log(num_unlocked);
            $('#welcome').append(' (Locked: ' + num_locked + ')<br />You have solved: <strong>' + num_finished + "/" + num_unlocked + ' (' + (num_unlocked - num_finished) + ')</strong> remain');
        }
    }
}