[Userscript] Wanikani Wrap-up Button Enhancement

I use the wrap-up button when my stop’s coming up, so I generally want two things from the wrap-up button: prioritise items that I’ve done half of, so I can at least bank some reviews, and, most importantly, be integrated into one of the mobile apps.

I made some edits to this script and ended up putting it on greasyfork. Check it out if you’d like!


This is great! Just noticed one thing - backspace doesn’t function, so if you want to delete a digit you have to use the delete key. I can see that the onkeypress listener is listening for backspaces, so is it intentionally stopping them from functioning?

I believe the latter half of that onkeypress was my attempt to remedy the exact issue you’re describing (it’s completely superfluous, however). You may’ve noticed that in the description for the script I put that information there.
That being said, apparently sometime over 3 weeks ago it stopped working. So, I’m guessing they changed something on the WK side that broke the functionality this utilized.
I haven’t been keeping up with WaniKani in a long while, but there’s a chance I’ll look into finding a solution for the basic functionality sometime soon.

Ah yeah I missed that in the description! The basic functionality is working fine for me, it’s just the backspace thing. I’ve had a play around with the code and I can capture the backspace use onkeydown instead of onkeypress, but even if it recognises the key as code 8, it still won’t do the backspace functionality. Weird!

Okay @Inserio I’ve implemented a soluton to the backspace issue, but it required changing the input type to text. I’ve implemented up/down arrow key functionality in the same way as a standard number input, but my version doesn’t have the on-screen up/down arrow buttons of a number input. Also added functionality so that pressing enter/return will automatically click the wrap up button, so you only need to type the number and hit enter to start wrap up mode.

Shall I upload it as a new version or would you like me to send you the code so you can update your version on GreasyFork and continue to maintain it after this fix (unless you prefer to keep the on-screen up/down arrow buttons instead of a working backspace and enter to wrap up functionality)?

Pretty sure the reason the backspace doesn’t work is something to do with React. I played around with it a lot, and could only get backspaces to work in the original answer input element. I changed the type to number and it still worked, deleted basically all its attributes and it still worked, copied the element to positons above and below both inside and outside the current parent and only the original element worked, and tried all sorts of attribute modifications and place changes for the wrap up element but none of them would work. So the default backspace functionality must be restricted on this page (but seemingly not on script settings pages in the dashboard) and only work in the answer input React component.

My solution was to get the position of the cursor when backspace is hit then change the value based on this, but you can’t get the position of the cursor in a number input, sadly!

I really appreciate you asking! I think I’m gonna continue to try to find a way to keep the number input box functionality, however. Therefore, I would suggest going with the option of creating your own fork so that people can have that alternative if they want it. It’ll also make it easier if you notice something else that needs fixing.

That’s pretty interesting really, and at least gives me another avenue to pursue if/when I decide to attempt to continue debugging this.

1 Like

New version/fork: Wanikani Wrap-up Button Enhancement (Tofurky fork)

Differences from @Inserio’s version:

  • backspace works
  • enter/return immediately starts wrap-up with the specified queue length and return to the answer input
  • up/down are no longer on-screen buttons, but the up/down keys offer the same functionality

No problem! Feel free to borrow anything from my code if it’s useful!

Edit: also added both our updates/forks to The New And Improved List Of API and Third Party Apps

This no longer works (nor does the fork above). After getting an answer correct, the background becomes gray and WK stops accepting answers.

Oh dear! I just reset my WaniKani account in the hopes of getting back into it properly. Once I have some reviews I’ll see if it’s broken for me too

I was seeing some grey vocab reviews before resetting, but it was before providing any answers and disabling WaniKani Prioritize Overdue Reviews seemed to fix it for me. Might be an unrelated issue though

@BlueRaja I’m not seeing any issues at the moment. Just used it successfully to wrap up at 2 reviews. I’d suggest turning off WaniKani Prioritize Overdue Reviews if you have it installed, otherwise try with just the wrap-up button script on and see if there are any problems

Hmm, the only other addons I have are Wanikani Open Framework and Wanikani Double-Check. I’ll have to try it without those, but “Double-Check” is pretty essential to me regardless (it includes both “lightning mode” and the ability to mark a wrong answer as correct).

I’m also on Firefox, if that makes a difference.

Yeah I have both of those active too. I’ll check on Firefox!

Just tried doing some reviews in Firefox (on macOS) with just the wrap-up enhancement (Tofurky fork) on and it worked for me. Same with WKOF and double-check enabled. I set the wrap-up to two items and it continued through them fine

Weird that it’s not working for you! Two things I can think of:

  • Do you have lightning mode active? I didn’t try it with that, but I also can’t see where to turn it on
  • Are you able to have a look at the console when you’re doing reviews? There might be a hint in there as to what’s causing the grey screen for you. If you see anything pop up when getting the grey screen, copy and pasting the log here would be helpful

Its intermittent but it also happens to me. just fyi. ill try to get logs next time. linux, firefox, not many addons