[userscript] Display lesson/review numbers as categories instead of numbers

Based on a request from @talpeer in this thread.

So here it is. The code is based almost completely on that of the WK Fake Numbers script.
It’s my first time making a script, so… yeah… humble beginnings…

Effect: replaces lessons, reviews, next hour and next day numbers by 0: “none”; <42: “light”; <200: “medium”; >=200: “heavy”

Grease monkey link: https://greasyfork.org/en/scripts/38029-wanikani-number-clobber/code

Screenshot:

Release notes:

Ver 1.2: Extension: works also on the lesson and review pages. Can be toggled manually but setting the variable clobberall in the script (true clobbers all, false only clobbers the dashboard). Also thanks to @The1AndMany

Ver 1.1: bug fix: works correctly on the dashboard when accessing through the root of the WK site. Thanks @The1AndMany

Ver 1.0: initial release

10 Likes

Congratulations on your first userscript!

4 Likes

This is really cool!

I hope you don’t mind me taking some liberties…

12 Likes

By all means! Those are the best liberties!

4 Likes

Sorry to necro the thread, but I noticed that the script works fine at www.wanikani.com/dashboard, but doesn’t alter the “next hour” and “next day” numbers at www.wanikani.com. With a little tweaking, I managed to get it to work in both locations. Below is my change, please feel free to use it!

function isDashboard() {
    if (window.location.pathname == '/' || window.location.pathname == '/dashboard') {
        return true;
    }
}
1 Like

Wow, okay, I never noticed that www.wanikani.com was actually also bringing up the dashboard!

Thanks for the fix, I’ll upload it in a jiffy.

Edit: done. Thanks again!

1 Like

That was quick. Actually, I found another thing, if you’re up for it. As it stands, the review queue number on www.wanikani.com/review and the lesson queue number on www.wanikani.com/lesson don’t change, and the script throws an error. A little more tweaking, et voila!

if (window.location.pathname == '/review') {
    var reviewqueue = document.getElementById("review-queue-count");
    replaceIfNeeded(reviewqueue);
} else if (window.location.pathname == '/lesson') {
    var lessonqueue = document.getElementById("lesson-queue-count");
    replaceIfNeeded(lessonqueue);
} else {
    var lessons = document.getElementsByClassName("nav")[0].children[1].children[0].children[0];
    replaceIfNeeded(lessons);
    var reviews = document.getElementsByClassName("nav")[0].children[2].children[0].children[0];
    replaceIfNeeded(reviews);
}

Ah, yeah, historically, that was based on someone’s request to replace numbers on the dashboard.
The JS fails rather gracefully, so I never really noticed there was a problem on the other pages.
I’ll update that tomorrow, now is way past the time I should be in bed.
Thanks again!

Understandable. Just happy to help. :slightly_smiling_face:

Almost forgot, but done :slight_smile:

1 Like