[Userscript] Reorder Buttons

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

I disabled the scripts that could potentially be interfering so that we are left with just the essentials

This also happens when I try to organise the reviews by ascending order. I am using Chrome with Tampermonkey.

1 Like

Will also say that I get same results regardless of whether the SRS Reorder button is enabled or not.

Edit - Another update. I have been using Script Compatibility Mode :sweat_smile: After disabling that, as well as the SRS reorder button and the scripts which are no longer compatible, it is now working as intended. Not the perfect solution, but I think it should be okay now. :grinning:

Well that’s an interesting outcome.
So, for what it’s worth, I’m not sure what that other reorder button script is. The bare-minimum for this script is just WaniKani Open Framework and this script itself.

It seems you might have the original version of this script which isn’t being maintained anymore installed as well. The version I publish is “WaniKani Reorder Buttons”. I think the cause for conflicts here is that other script “WaniKani SRS Reorder Buttons”.

As for compatibility mode, I’m not sure if disabling or enabling it matters to my script :thinking: I could comb through the compatibility mode notes, but off the top of my head I don’t recall any conflicting effects…

1 Like

I have installed installed the script freshly now. I also turned off Script Compatibility Mode and it seems to running okay but when I enable Script Compatibly Mode I get the grey thing when sorting by Ascending. Anyway, it is basically functioning for me now, so thanks for the hard work!

2 Likes

this script was essential for me to get through my 1500 item review pile succesfully, and to reduce the momentum from going way too fast earlier.

3 Likes

I’m super glad to hear stuff like this :pray: this is one of the few public projects I maintain, so it’s nice it matters.

to reduce the momentum from going way too fast earlier.

Curious how you do this, actually :eyes: I feel that the straggling kanji and post-level-up vocabulary blow up and cause me to start every new level hampered. Is it just strictly doing reviews in descending SRS order?

2 Likes

that was more of an unintended side-effect, but very important. i started out more or less speed-running WK for the first 22 levels, which lead to a massive momentum problem. during the time i was working on my 1500 reviews pile, almost the same amount of reviews came got added to the pile by enlightened items coming up for burning. even without doing new lessons, i’d have had to keep up almost the same workload of reviews as before. indeed, for the first two or so weeks of working on my pile, it actually grew. but by being able to mostly just ignore the burn items (it’s been 4 months, another month won’t make a huge difference). eventually i was able to just do my normal reviews every day, and then at the end work through some burns (some days just a dozen, some almost a hundred).

WK tends to be very unforgiving of slowing down: you’ve done the lessons, it’ll give you the reviews. but this way i was able to go from doing 300 reviews a day to maybe 150 max.

i made a whole post about this: Beating 1500 reviews! a journey

3 Likes

I’ve been getting a recurring issue with this script since the last big WK update; for about 1-2 months now, I guess.

  1. Script doesn’t function without Reorder Ultimate 2 also installed and active

  2. When this script is active, after 10-11 reviews, my reviews get stuck after inputting the reading/meaning and I cannot continue reviews without a refresh.

Anyone else having these issues?