Show Number of LeetCode Unsolved Problems

Show Number of LeetCode Unsolved Problems for the new style

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Show Number of LeetCode Unsolved Problems
// @namespace    https://greasyfork.org/en/users/114838-groundzyy
// @version      0.1
// @author       groundzyy
// @match        https://leetcode.com/problemset/*
// @description Show Number of LeetCode Unsolved Problems for the new style
// ==/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) {
        if ($('#welcome > span').length == 1) {
            info = $('#welcome > span > span:nth-child(1)').text().split(" ");
            num_finished = Number(info[0].split('/')[0]);
            num_questions = Number(info[0].split('/')[1]);
            $('#welcome').append('<br/><span>' + num_finished + "/" + num_questions + ' (' + (num_questions - num_finished) + ')</span>');
        }
    }
}