WaniKani jStorage documentation?


#1

Is there any documentation on WaniKani’s use of jStorage, particularly in lessons? I’m considering making a script that would let people specify the number of radicals/kanji/vocab for a lesson session.

From digging through the official lesson code and the Ultimate Reorder script, I found some useful things, like l/activeQueue, l/lessonQueue and more. But knowing every key for data being stored as well as what listeners are available would be very helpful.


#2

Nah, there’s no documentation, as it’s not technically a public API. You can fairly easily reverse-engineer it, though. Call $.jStorage.index() and check what’s available! When I was writing Jitai, I reverse-engineered what I needed by beautifying the minified JS WaniKani provides, but you shouldn’t even need to do that here. Once you’ve identified the keys you’re interested in, you can use $.jStorage.listenKeyChange(key, callback) to do your stuff.

You can also take a look at the source code for a few popular userscripts to see how others have hooked into it before. For example I know WaniKani Reorder Ultimate uses it a bit – I’m sure others do too, though.


#3

Thanks, $.jStorage.index() is exactly what I was looking for!


#4

This is basically unrelated (apologies), but when did those solved buttons appear on the forum? Does only the OP have access to them? I was very surprised to see it in your OP, @seanblue, but it’s a handy feature to have.

Also, related: Thanks for working on this and good luck! If you need some help with testing, I have plenty of lessons (50) at the moment, and can probably level up in a few days if wanted (to add radicals into the mix). If somehow it worked with or became an extra feature of the ultimate reorder script, I’d be even more excited.


#5

Viet mentioned something about it, but in a Campfire topic for some reason. I think only OP can select it, but I’m not sure.

I’ve never written a WK script, so it might go a bit slowly while I figure out the events. I’m also not sure how I want the UI to look yet, so that might slow me down a bit.
I definitely want it to work independently from Ultimate Reorder. But as long as the UIs don’t conflict, I don’t see why they wouldn’t work together (assuming the events work as I expect them to).
And thanks for offering to test. I’ll be sure to let you know when it’s ready.


#6

Cool, sounds like a plan. : )


#7

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.