[Userscript] WK Real Numbers

I think it’s reasonable to be wary of any extension that wants to see and control as much as tampermonkey. With that said, I eventually decided that it was popular enough that many people more diligent than me would have checked the code and verified that it was safe to use.

I agree with you about the 42+ thing by the way. I find this “joke” to be annoying.

3 Likes

I don’t mind it at all, but that’s partly because I have Ultimate Timeline (the number one script I think ought to become a core part of WaniKani). I quite like when companies include little jokes and things.

I do think that if they want to keep the 42+ thing it would be reasonable to include a popup on hover which displays the actual number though. Something like your (I think?) Lesson Hover Details script, but including reviews as well.

1 Like

This thread is about the Real Numbers script, guys, not about whether or not you like the 42+ and think we should change it. Let’s avoid further arguing here about whether or not it’s a good joke and stay on topic.

sorry CyrusS

1 Like

So I’ve been using the Real Numbers script and it has been working great until recently. For some reason over the past week or so it says that I have 60 lessons and 0 reviews even though I do not. For example right this second I have 120 reviews to do but it says I have 0. I tried uninstalling and reinstalling Real Numbers, but no dice. I there anything I can do to fix this? Thanks in advance.

Here is a picture:

This is actually really helpful, but I found a bug you may be interested in. I accidentally hit the “Generate New API Key” button, and once I did everything went back to 42+. I managed to fix it by clearing the apiKey token in the F12 developer options menu, but there really needs to be a simpler way to do this. Maybe a sanity check where it checks at the end whether the numbers have successfully changed and prompts the user for their apiKey again if they haven’t.

Also, serious question: Why is this not just a standard feature?

1 Like

Because the WK team likes the 42+ joke :man_shrugging:

1 Like

Thank you, this still works fine for me. ^^

I got that yesterday as well. Maybe you have another script that’s making so many requests that you’re hitting the limit?

Yep, same for me. Its been temperamental for about a week now! And today I have a big 0 when there should be 120, using Chrome…

People having trouble with the original might be interested in trying my version of WK real numbers. I made it mostly for personal use, but it should solve some of the issues discussed here. In particular it will always either have fresh data or fall back to the 42+ if there’s an error, instead of using out-of-date cached data. (Also, it can find your API key without the popup-and-redirect flow, assuming you have generated one.)

1 Like

Agreed–for a paid service it does seem like users disproportionately have to provide DIY solutions/improvements for themselves for things that should be taken care of by the people running the site. That said, I’m overall happy with what the site does provide for the price.

1 Like

Could you put this on something like greasefork for an easy download link? I know it’s not a big deal but if it’s easy enough it’d be nice. Thanks. :slight_smile:

You can click the link in the readme to install it. Or, this one.

@Mempo The dev team recently added global variables for the real number of lessons and reviews, making API calls unnecessary. Do you want me to send you my new version of the script so you can decide if you want to incorporate it? Or if you prefer not to own the script anymore, I don’t mind uploading mine as a new script. Up to you.

1 Like

Yea, please, if you have an improved version I’d greatly appreciate it if you paste it here. I’ll update the script asap.

To be honest, I don’t check in here that often any more and I probably won’t write my own patches/fixes any more. However, I know what a pain it can be to deal with abandoned scripts since I’ve adopted a few ones myself. So in the interest of the users I prefer to still ‘own’ the scripts (at the least ones with huge amounts of users like this one) so they can still get automatic updates from contributors such as yourself.

1 Like

@Mempo Feel free to use or change whatever you want.

(function($) {
	'use strict';

	var wkData = window.WaniKani;
	if (!wkData || !wkData.studyInformation) {
		return;
	}

	var studyData = wkData.studyInformation.requested_information;

	if (!studyData) {
		return;
	}

	var lessonsEl = $('.lessons span');
	var reviewsEl = $('.reviews span');

	if (lessonsEl.length === 0 || reviewsEl.length === 0) {
		return;
	}

	lessonsEl.text(studyData.lessons_available);
	reviewsEl.text(studyData.reviews_available);

})(window.jQuery);
1 Like

I had an issue with this script because when loaded, window.WaniKani.studyInformation was undefined. I just used a 1 second timer to fix the issue. (I am using Firefox with violentmonkey btw)

window.setTimeout(function() {
    'use strict';

    var $ = window.jQuery;
    var wkData = window.WaniKani;

    if (!wkData || !wkData.studyInformation) {
        return;
    }

    var studyData = wkData.studyInformation.requested_information;

    if (!studyData) {
        return;
    }

    var lessonsEl = $('.lessons span');
    var reviewsEl = $('.reviews span');

    if (lessonsEl.length === 0 || reviewsEl.length === 0) {
        return;
    }

    lessonsEl.text(studyData.lessons_available);
    reviewsEl.text(studyData.reviews_available);
}, 1000);
1 Like

This fixed the issue I was having as well.

Now that 42+ is not the default behavior, this script is no longer needed.
However, if you’re actually looking to re-insert 42+:

3 Likes