jpdb.io - show non-redundant vocab on learn page

Replaces the "You know" known words stat with the "Total known non-redundant vocabulary" value

اعتبارا من 16-09-2025. شاهد أحدث إصدار.

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         jpdb.io - show non-redundant vocab on learn page
// @namespace    http://tampermonkey.net/
// @description  Replaces the "You know" known words stat with the "Total known non-redundant vocabulary" value
// @version      1.0
// @author       JawGBoi
// @match        https://jpdb.io/learn*
// @grant        none
// @run-at       document-idle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const totalWords = document.querySelector('table.cross-table tr:nth-child(2) td:nth-child(2)');
    const knownWords = document.querySelector('table.cross-table tr:nth-child(2) td:last-child');
    const nonRedundantSection = document.querySelector('table.cross-table + p');

    // script can only run if required elements are found
    if (nonRedundantSection && totalWords && knownWords) {
        try {
            // find the number at the end of the paragraph's text:
            const nonRedundantText = nonRedundantSection.textContent;
            const nonRedundantMatch = nonRedundantText.match(/(\d+)$/);
            const nonRedundantCount = parseInt(nonRedundantMatch[1], 10);

            // get total word count
            const totalNoWord = parseInt(totalWords.textContent.replace(/,/g, ''), 10);

            nonRedundantSection.remove(); // no need for the redundant words section anymore

            // recalculate percentage:
            let newPercentage = 0;
            if (totalNoWord > 0) {
                newPercentage = Math.floor((nonRedundantCount / totalNoWord) * 100);
            }

            // 5. Format the new string and update the 'You know' cell.
            knownWords.textContent = `${nonRedundantCount} (${newPercentage}%)`;

        }
        catch (error)
        {
            console.error("jpdb non redundant vocab script error:", error);
        }
    }
}
)();