[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.4: Fixed the numbers in the navigation bar.

Ver 1.3: Updated to match the new page structure. The review preview on the side is still unaffected for now, though.

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

11 Likes

Congratulations on your first userscript!

5 Likes

This is really cool!

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

17 Likes

By all means! Those are the best liberties!

5 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

The new wanikani dashboard overhaul has broken the script for the main dashboard but still works for the review summary page. could this please be updated!

Sure, I’ll have a look later today.

Alright, I have updated the script. It seems to work for me, but let me know if there’s anything strange.

Edit: also, I have burned everything on WK, so I have no access to the review preview on the side, so I couldn’t update it to hide the number of reviews.

This is perfect! Thank you so much!!!

1 Like

This is not quite true, is it?

2 Likes

Well, it was at the time of posting.

3 Likes

Bug report: The actual number of lessons (instead of the categories medium/heavy/etc.) are still shown in the header lessons and reviews button (you can find these buttons only when you scroll)

1 Like

Wow, I didn’t even know those button existed.
I’ll have a look tonight (JP time).

2 Likes

Are you currently living in the Betelgeuse system, or is that where you’re from, like Ford Perfect?

It’s my current location.

2 Likes