Wanikani Open Framework [developer thread]

It’s on the list either way.
But if you ever get bored and have some spare time… :grin:

@rfindley Another question/request. Do you think it would be reasonable to have an (optional) Reset to Defaults button on the setting dialog? If there is a way for Open Framework to handle that generically, I think it would make sense.

That was actually my original intent with the defaults built into the Settings config, so yes… it would make sense.

1 Like

Cool, thanks. I look forward to seeing it eventually. :slight_smile:

Hi rfindley!

I wrote a user script that calculates how long to level up. As it is my first script I used your scripts code as a refference to know how to do it. This calculates the day and time depending on the srs stage radicals and kanjis are. And displays the result under the progress bar box. I’ve been testing this while I was writing it, for some days already and it seems to work ok. I would appreciate that you take a quick look at it before officialy releasing it.

Thank you! :slight_smile:

2 Likes

Nice! I had been considering making something like this myself! One issue, though; it doesn’t account for fast levels. Levels 1, 2, 26, 41, 43, 44, 46, 47, abd 49-60 can be completed in 3 days 10 hours, rather than the standard 7 days 20 hours, as 90% of kanji are unlocked upon level up and the radicals don’t have to reach guru. You could account for this by checking whether 90% of the level’s kanji have been unlocked before looking at radical progress.

Is this your first experience with JS? It looks very good

edit: Also it seems like you’re not accounting for only 90% of kanji in general having to be gurued to level up?

2 Likes

Hi Kumirei! Thanks for having a look at the script!!

I’ve coded before, plenty of jQuery, PHP and MySQL. But this was my first time using the wanikani framework and also coding a script. :slight_smile:

To calculate the level up date/time I try to find out when the last kanji (90%) will be reviewed. To do this:

First, I check if all radicals have been gurued. If not, I make an array of radicals and sort this by +stage and -date. Pick up the first radical from the array (which will be the last one to be reviewed) and, depending on its level, add 4,8,23 or 47 hours to the review date plus 4+8+23+27 which will be required to guru the kanjis.

If all radicals were gurued already, I make an array of kanjis, also sorted by +stage and -date. Then I calculate how many kanjis are needed for the 90%, and remove the kanjis which are not required from the array. Then, the first one is telling me which will be the last kanji to be reviewed. So, I add 4,8,23 or 47 to its review time depending on its stage, and this give me the level up date/time.

What’s the thing with fast levels? Could you guru kanjis before guring radicals?

1 Like

Indeed. You unlock more than 90% of the level’s kanji upon level up, so you can finish the level without touching the radicals. Level 1 and 2 are the exception that instead the apprentice stages are halved.

1 Like

Sorry, you were already telling me this. Sure, as you said, checking if 90% of the kanjis have been unlocked at the beginning, will let me calculate the level up time for this fast levels. I’ll try to code this during the weekend. Arigatou gozaimasu!

1 Like

we were replying at the same time… hahah! All cool. thanks!

1 Like

@Reeko182 image

All kanji are locked, and I have one radical at Master (due to it being moved in the recent radical overhaul)

FYI to everybody that ends up here regarding the Wanikani site change today…
I plan to update Open Framework tonight to get it working with the new site, so that should fix a lot of scripts that are broken today.

9 Likes

The update for Open Framework is now live.
:point_right: [v1.0.38]

7 Likes

Thank you!!!

1 Like

Just FYI, 1.0.38 is the greasyfork version, but open framework reports as 1.0.37

Thanks! It’s updated now.
edit: oh wait… no it’s not.
edit2: okay, now it’s really updated :grin:

2 Likes

Awesome!

All good now!

1 Like

@seanblue,
I’ve added auto-generation of APIv2 keys.

Initially, if you don’t have one, it will pop up a message:
image

If you click OK, if generates one and reloads the page.

If you click Cancel, it stops asking, but adds a link in the User Menu:

image

2 Likes

@seanblue,

I’ve also added a few debug functions to make script development easier:

To troubleshoot scripts with another user’s data:

wkof.Apiv2.spoof('<insert_apiv2_key_here>');  // Test scripts with another user's key
wkof.Apiv2.spoof();    // Check if you are currently using another user's key
wkof.Apiv2.spoof('');  // Stop using another user's key

^^^ That was just easier for me to remember than the old way:

localStorage.apiv2_key_override = '<insert_apiv2_key_here>';
delete localStorage.apiv2_key_override;

I added similar functions for the ‘wkof.include.nocache’ and ‘wkof.load_file.nocache’:

wkof.file_cache.no_cache();  // Check which modules/urls you're currently not caching
wkof.file_cache.no_cache('Apiv2,Menu');  // Don't cache the Apiv2 and Menu modules
wkof.file_cache.no_cache('Apiv2,https://www.github.com/blahblah/myscript.css');
2 Likes

Heya,

For some reason I am not able to close all submenus at the same time in the Account Menu of the dashboard. In the first image, I have closed the Settings part of Scripts

When I press the Open menu, “Open” closes, but Settings suddenly opens out of nowhere.

This also happens the other way around for all other submenus for me. Does anyone else experience this?