[Userscript] WIP: Lock Script


#1

Hi all,

[Creating a new thread for this so that I don’t hijack @striker’s thread any more than I have done already.]

Purpose

The purpose of this user script is to allow users to lock a set number of reviews so that they don’t appear in their review sessions. This is to allow people to reduce the review queue size down to something they can manage at any particular time.

Whether you’ve been whisked away back into real life or you’ve toked too much from the lesson pipe, it’s no fun at all coming back to a review queue that you just can’t manage!

Method

As a user, all you specify is how many reviews are to be locked.

The method is actually very simple: The script maintains a list of all the active reviews you have and sorts them in order of when they entered your review queue. The script then locks the earliest reviews in the queue. You might think this is the wrong way around but I’ll try and make my case here.

Consider a review queue with 1000 items and you’ve been away from WK for some time. Oh dear.

If you’ve got the time and energy for, say, 100 reviews a day, then you’ve got a problem. Every time you get a review wrong, there’s only a 10% or so chance that it will appear when it’s next up for review. This amounts to a lot of wasted effort if you try and clear the queue this way because you won’t see an Apprentice item again until way after it actually appears again and SRS is unlikely to work well.

If the earliest 900 reviews are locked then, no matter how you perform, the remaining 100 reviews will always be for the same subjects (radicals / kanji / vocabulary) since they will always re-enter the review queue at later point compared to the locked reviews. This allows you to get comfortable with those subjects to the point where you’re scoring well before you choose to expand further into the locked reviews.

image
I’m almost on top of my queue with only 325 reviews locked.

Great, but what if real life rears its ugly head again and you’ve got less time again?

You simply lock more items until your review queue is manageable again. Let’s say we go down to 50 subjects this time. The set of active subjects is now a subset of the 100 subjects you were already working on just before and so you don’t have to start any of them from cold.

Once real life is less of a problem again, just go back to the previous setting and you’ll pick those from where you left off. If we go back to 100 subjects now then those will be the 50 most recent subjects and also the other 50 subjects you were working on when you had first set it to 100.

Hopefully you’ll agree with me that you only need to set the level to how much you can handle at any particular time and it will keep the wasted effort to the minimum.

Why not remember the actual list of locked subjects internally?

Using this sorting method, you only need to maintain a single number (the number of locked items) between devices if you frequently use multiple devices with WK. Also, if you regularly clear your browser data then you only need to supply the locked item count afterwards (and your API key) and everything is back to where it was.

What if I don’t like the script and uninstall it?

Nothing bad will happen. Your full review queue will appear again.

Personal evaluation

It’s bloody brilliant!

Status

Early release - expect gremlins! Help by reporting said gremlins!

Version 0.0.4:
https://greasyfork.org/en/scripts/370209-wanikani-lock-script

Version history:

0.0.1 Initial script.
0.0.2 Fixed incompatibility with the Similar Kanji script.
0.0.3 Fixed silly bug where it would lock items than requested.
0.0.4 Fix for items that have been removed from WaniKani.

Instructions

WARNING: It’s not very polished in terms of user experience at the moment but it does work.

  1. Go to https://www.wanikani.com/review
  2. Enter your API V2 key
  3. Click “Set API key”
  4. Set the number of items you want to lock
  5. Click “Save options”
  6. Start your reviews

You shouldn’t have to click the “Reload cache” button.

When you want to change the number of items to lock, redo the above from step 3.

Testing

  • Firefox - works for me™
  • Chrome - works for me™
  • Edge - works but there seems to be weird caching issues with WK API V2

Select number of reviews at one time
#2

Is this still planned or was it scrapped due to bugs? No worries either way, just curious since I have a backlog and it’s a bit of an uphill battle right now.


#3

No, it wasn’t scrapped due to bugs. Real life got in the way!

I’ve prepared an early release version here:

https://gist.githubusercontent.com/wkdonc/182aba21f4b8547cc136a1cabb75631e/raw/c36472ea2006b953bc1f654505bfdc2eecc8dbde/lockscript0.0.1.js

WARNING: It’s not very polished in terms of user experience at the moment but it does work.

Instructions

  1. Go to https://www.wanikani.com/review
  2. Enter your API V2 key
  3. Click “Set API key”
  4. Set the number of items you want to lock
  5. Click “Save options”
  6. Start your reviews

You shouldn’t have to click the “Reload cache” button.

When you want to change the number of items to lock, redo the above from step 3.

Note: I wrote and tested this in Firefox. I’ve not tried Chrome and I ran into caching issues with the WK API V2 with Edge.


#4

This is great! I’ve been testing it on Chrome and it appears to work. I don’t see the lock icon+number when I’m actually in the review section (which is where I think it’s showing in your picture above). This is a non-issue since I see it on the screen before I start reviews, but I thought I would bring it up in case it’s a browser-specific thing rather than something you changed on purpose.

Remarkably only one of my installed scripts broke it, and it’s not the one I would have expected. It’s the “Similar Kanji” script that injects a list of similar kanji into the review page to help you disambiguate. I’m more than happy to turn that off to get my queue down though, and it’s not anybody’s obligation to troubleshoot/change scripts to work with each other.

Things it did work with include the Override button, Jitai (randomizes fonts), Reorder Ultimate II, Keisei Phonetic-Semantic Composition, and Community Mnemonics. The Ultimate Timeline still shows the full amount of reviews, but I’d completely expect that given the nature of this script. Real Numbers shows 250 right now, which I’m locked at, but will show more when I get more reviews. All I have to do to see how many reviews I really have is subtract 250.

As an aside, I think you’re the first script I’ve seen that calls for the 2.0 key. Right on the bleeding edge of technology :slight_smile: Thank you so much! And I’m wiling to test/check anything you need me to.


#5

Thanks for the report!

I’ll check it with Chrome later this week. I’m in conference mode at the moment (which is exactly the sort of thing which sends me into needing this sort of script… :face_with_hand_over_mouth:)


#6

@foozlesprite What happens when you use the similar kanji script? Can you look at the error message in de developer console?

That script and Keisei share many parts, I don’t know what could break something when Keisei still works …


#7

That’s what I was thinking too. Why that script of all things, haha. What it’s doing is showing the full amount of reviews in the corner rather than the reduced amount I actually need to do. The similar kanji will show, but the lock script doesn’t work.

It’s showing me this:

Similar%20Kanji%20On

rather than this:

No%20Similar%20Kanji

and letting me do more reviews than what it takes to get me to my locked number.

Oddly there are no errors showing:

The two scripts it shows there are Override and Real Numbers, neither of which are error messages.

Another batch is about to hit so I’ll test some more with both scripts on.


#8

Not sure what is happening, the only reason I can imagine is that I had to modify the “related vocabulary” page because WK uses a ridiculously strong selector (I think three nested ids or something) and I needed to override the style, I wrapped it (div#supplement-kan-related-vocabulary) in something additional. Maybe @doncr can tell what it means, it seems the lock script is stopped by mine without error.


#9

It’s not too much of an issue for me since I can just turn the similar kanji script back on when I’m caught up, but if it ends up being an easy fix it’d be neat to have done. That being said, this script is very early in alpha, so I expect this is low priority compared to standalone bugtesting and UI fixes.


#10

OK - back in action!

I just installed The Similar Kanji script on Chrome and I can reproduce the issue, which is a good start…


#11

So that was an odd one.

I modify the XHR object in my script by monkey-patching the responseText property. I figured it was the easiest way to rewrite the data from WK. (Yes, reel back in horror if you will!)

I can only think that the method I used (now rewritten) had conflicted with GM_getResourceText in some exotic way.

Anyway, I’ve improved it now and it works with your script!

@foozlesprite - I’ve edited the top post with the URL for WK Lock Script 0.0.2. It should work without conflict now.


#12

Confirmed working. I haven’t seen any other issues so far. I’ll let you know if I see any more.

And as an aside this is proving the most helpful script I have to help get me back on track. I have several others that help in smaller ways but this takes the cake. I can do my reviews for the day then step back and say “whew, I’m done, I don’t have to do these other 200 for now.” It makes things much less daunting and lets the SRS process work on the ones that are unlocked, so I memorize them and clear them faster. A++ in concept and execution thus far.


#13

How’s it going?


#14

Everything’s going well, no more problems!