[Userscript] Reorder Buttons

:warning: This is a third-party script/app and is not created by the WaniKani team. By using this, you understand that it can stop working at any time or be discontinued indefinitely. :warning:

This script adds buttons that reorder remaining reviews by their SRS level in either ascending or descending order.

This is a fork (l33t for altered ripoff :stuck_out_tongue:) of @Towe’s awesome SRS Reorder Script (their post can be found here).

Differences

Particular to this fork:

  • Ability to also sort SRS in descending or randomized orders
  • Ability to force readings for items before meanings, or vice versa
  • Sorting icon to indicate what the current ordering is
  • Dedicated buttons and hotkey combos for sorting
  • Configurable ordering of review items on startup
  • Configurable UI components
  • Persistent settings and user-friendly settings panel
  • Updated to work with and without Compatibility Mode enabled

Documentation

Please reference the project homepage here on GitHub. It has way more detail and information about the userscript and its features!

Install

  • Ensure you have some userscript engine installed – User Mempo has a great guide on this here
  • Install the WaniKani Open Framework (instructions here)
  • Click this link to open the script file and be prompted to install it

:warning: Note: ensure that the WaniKani OpenFramework userscript is set to load before this reorder script :warning:

Links

Recommended Companion Scripts

  • Kumirei’s Back2Back userscript provides a 1x1 mode that can let you drill review items until you get correctly answer them
  • My own SRS Counter userscript provides a dedicated SRS counter that is more featured and better supported than this script’s implementation – just uncheck the Display SRS counters setting for Reorder Buttons
  • rfindley’s Double Check userscript mixes seamlessly with both Back2Back and this script, and can be a helpful tool in dealing with typos during longer review sessions

Reporting Bugs

Please reference my userscript bug reporting guide for info on how to best report issues and bugs. It’s seriously helpful for myself in particular when trying to help resolve issues :pray:

Screenshots

One-click sorting button and indicator
ordering-button

Review counters of each SRS level’s remaining items in this session
review-counters

Fleshed out settings panel

Cogwheel menu sorting buttons
cogwheel-buttons

19 Likes

Exactly what I wanted. Thanks, boss!

1 Like

Glad to hear. Chief! Let me know if anything about it feels like it could be improved!

Thanks for this script!

I was desperate for something like this to help me gently climb out of 1000+ review pile.
Focusing on Apprentice/Guru from time to time will make it a bit easier.

1 Like

It’s no problem! I’m super glad it’s helped!

I’m really interested in trying out this script to target my burnable items, but I can’t get it to work in Firefox. I’m able to run other WaniKani scripts, just not this one. I’ve edited the script a bit to try and do some print-line debugging, but I don’t even hit those. It seems like the script is not being run at all, despite no error/log information in the console indicating a failure.

Do you know of any common failure points I could try addressing? I’m using Firefox with ViolenceMonkey at the moment (though I also have TamperMonkey and have verified the same behavior in that environment as well).

1 Like

Update: I downloaded a chromium-based browser and verified that it works. It would be nice if this ran on Firefox, but it isn’t the end of the world. Thanks for the script!

1 Like

Heya! I’m super grateful you put in so much time looking into that! I’m not currently running FireFox on my machine, but I’ll set myself a reminder to try a fresh FireFox+Tampermonkey setup tonight and debug if needed.

Ideally, this would work across any user script engine/browser combo given there’s really nothing super specific going on with the script. It really helps knowing it at least still works on Chromium browsers – I personally use it daily on Safari+Tampermonkey and have had it work on FireFox+Tampermonkey before.

I’ll get back to this later today with an update.

2 Likes

Alrighty, tested out a fresh install of stable-channel Firefox on OS Catalina with a fresh install of Tampermonkey and no other config changes nor scripts.

I went to https://www.wanikani.com/review/session and the script activated just fine. Both ascending and descending order buttons worked, and counters remained updated as I cleared reviews.

@ihfdayton, I’m totally down to help you debug this so that it works with your intended setup. I wish I knew enough to add debug logging or utility to the script, but that’s honestly way out of my skill set for user scripts, so I’d definitely need your help in recreating your setup locally to iterate on things. If you want to go through with that, please open up a ticket on the project issue tracker and we can go back and forth there :grin:

1 Like

Thanks for being so willing to help! I’ll do some detailed reporting as soon as I can and open up an issue on github.

Interestingly, the script is now failing to run in my Chromium environment as well.

EDIT: Turns out I’m bad at JavaScript. I did a bit of debugging and tinkering with the code and I believe the problem I was seeing was a timing issue. It seems like sometimes the reviews kick up faster than the script can populate from the WK API. By adding a breakpoint in the script initialization and then continuing after a couple seconds, I can reliably run the script in both Chromium and Firefox.

1 Like

Oh! That’s super useful info!
So to be sure I understand, the issue is resolved by literally pausing the script’s initialization while reviews load? If so, I think I know some quick changes I can make to prevent sorting until reviews are loaded.
Thanks a bunch for the investigation! :grin:

2 Likes

Yep, spot on. Sorry for any confusion, I had WK vs. script backwards in my previous post. Let me know if you need anything else!

1 Like

Heya :wave: so I tried recreating things so I could be sure the issue would be fixed when I make edits to the script, but I really couldn’t get it worked out.

I’ve created this issue to track updates or maybe other reports of the same bug. If you could add any edits you made that helped out, it’d be really helpful for both myself and other potential users running into the same issue in the future.

Oh boy, stuff’s broken! :sweat_smile: I’ve noticed the recent change around how reviews are pulled locally affects the script as it’s currently implemented.
I’m working on a fix now, as well as a general set of improvements leveraging the new dependency I’ll be using to best address the problem: leveraging the WaniKani Open Framework plugin.
I’ll make another post when the new release is out!

3 Likes

Thanks very much - I put WK on VM a couple of days after it broke ‘cause I didn’t want to have to do ALL pending reviews just to progress each day’s new lessons. Much appreciated :partying_face:

2 Likes

I cannot overstate how much I’d like to thank @rfindley and @BIsTheAnswer for their help in getting this shipped out ASAP :heart:

New version of this user script is live! I’ve updated both the OP and the GitHub page with details on the new changes, features, and installation requirements.

:warning: The REALLY big deal right now is that this update fixes the script to work as it used to before the recent compatibility mode changes that were released – version 1.0.0 of this script will literally just not work at all going forward. Install the latest version to get back to your usual routine! :warning:

2 other major things to note right now about this release:

  • it was blitzed over the course of these last days, so if there’s some QA issue like a typo or broken link: that’s the reason why :sweat_smile: as usual, please let me know if anything comes up
  • thanks to the WaniKani Open Framework dependency that was added, I was able to create a whole new settings panel that exposes some config options that were previously only accessible by editing the user script. Not only is the new panel integrated into the UI, but it’s been set up to persist configuration across future upgrades and installations of this script – I highly recommend you check the new panel and play around with the toggles there!

Again, sorry for the delay in releasing this fix, I’ll be better about keeping up with WK developer announcements going forward! :grinning_face_with_smiling_eyes:

Edit:

I totally forgot to mention this, but I’ve updated the install instructions in the OP. To update, just reinstall if your userscript engine doesn’t update the script version for you :pray:

6 Likes

Thanks for the update as this script makes Wanikani usable for me, but it is behaving a little strangely on my end. Hard to explain, but for example when when I complete a review for a Level 1 SRS item, the number in the top right corner decreases for both Level 1 and Level 2. If I refresh the page then Level 2 goes back to the number that it should be. Hope that makes sense!

Also the buttons no longer appear for me in the bottom right corner. I guess that is on purpose as we have the menu option now?

With all other scripts disabled except the SRS reorder button and this one I am getting other weird results like this.

I’m happy to hear this script helps so much :grin:

when when I complete a review for a Level 1 SRS item, the number in the top right corner decreases for both Level 1 and Level 2. If I refresh the page then Level 2 goes back to the number that it should be.

I’ll try doing some manual testing to see if I can recreate that behavior. I could totally believe that the counter is somehow bugged.

Also the buttons no longer appear for me in the bottom right corner. I guess that is on purpose as we have the menu option now?

Yeap, I moved the buttons into the top-left menu. Weighing the benefits (one-click access to functions) against the costs (fragile, extra code to maintain, incompatibility with custom CSS scripts), I felt it was best to integrate it into the menu. I’m totally willing to fold on this though if popular opinion votes for getting those buttons back down there. If ease of access is an issue, I’d highly encourage using the keyboard shortcuts.

2 Likes

Oh no, that’s definitely not right. I’m even particularly curious as to why the counter is all over the place. The way this counter is added to the UI isn’t particularly amazing, so if there’s multiple scripts trying to add it, I could totally see this happening.

Could you send a quick screen cap showing what user scripts are active from the review page? (I’ll put an example of mine below)

Edit:
@Beghaus

I’ll try doing some manual testing to see if I can recreate that behavior.

Could you send a quick screen cap showing what user scripts are active from the review page?

I’m just realizing now that these two behaviors may be related, actually. I tested things on my end with/without sorting on startup, and from different SRS levels. I can’t seem to recreate the issue as reported.

1 Like