[Userscript] Reorder Buttons

Aaaaalrighty, yet another update: version 3.1.0! This minor update accomplishes the following:

Features

  • adds configurable question type sorting!
    • you can now force a certain question type to show up before the other for each item!
    • if you prefer answer reading before meaning questions or the other way around, you can now force a certain question type to repeat until you get it right
    • this feature works entirely independently of any sorting, so if you’d like to take advantage of just sorting question types without any sorting rules beyond that, you can do so
  • 1x1 mode is now completely independent of any sorting logic
    • previously, 1x1 mode was enabled whenever reviews were sorted and disabled when reviews were randomized, but now 1x1 mode is enabled/disabled on startup or upon saving settings
    • specifically, this means users can now force 1x1 mode without sorting reviews whatsoever

Fixes

  • added compatibility for Compatibility Mode :exclamation:
    • a lot of recent bug submissions indicated behavior consistent with running this script with Compatibility Mode enabled in WK’s settings
    • these bugs all seemed related to a change made in version 2.0.0 to fix the script following an API deprecation – this change was not handled in a backwards compatible way, so only users with Compatibility Mode disabled would be able to fully use the script
    • some extra handling has been added to ensure users with Compatibility Mode enabled will be able to use this script, enabling inter-operability with userscripts that still require Compatibility Mode
  • remove “Sort on Startup” checkbox from settings panel
    • this was left behind during the addition of the “Startup Sort Ordering to Use” setting and no longer actually did anything

:exclamation: to update to the latest version, please either update using your userscript engine’s built-in update functionality, or try clicking here to install the latest version :exclamation:

Happy holidays, y’all! (again :eyes:)

6 Likes

@chrisl17 @dogandwolf @Beghaus
Tagging y’all just in case you aren’t subscribed to the thread in general as you’ve previously reported issues regarding Compatibility Mode :grin: this latest update should also allow interoperability with the Reorder Ultimate 2 script :eyes:

@chrisl17 @Risakisa
Tagging y’all just in case you aren’t subscribed to the thread in general as you’ve previously reported interest in being able to force certain question ordering (reading before meaning or meaning before reading).

Please let me know if you experience any issues while using these new features! :pray: Sorry for the potential double ping as well, I’ll probably only make new version announcements going forward to avoid this situation in the future :bowing_man:

3 Likes

Hello :wave: Sorry for taking a while to reply, I’ve been seriously wondering where this script is going – specifically whether or not it’ll be a project goal to take over the use-case that was previously filled in by the Reorder Ultimate 2 script.

Is there any option in this script for ordering reviews by Wanikani level?

No, but at least not currently. The main reason I switched over from RO2 to the script I forked from is the complexity and overhead that was excessive for me back when I made the switch. If I do start increasing the number of ways users can sort, I’m afraid it’ll start adding a lot of complexity to the UX and UI that I’m seriously worried to take on. :disappointed: If in the future I find a satisfactory way of adding this kind of feature in a succinct way that makes sense within the existing UX setup, I absolutely will!

In the meantime, I’d encourage anyone with the ability to fork my script to do so and make these kinds of changes! I’m entirely willing to help with any questions along the way :grin:

are there any working scripts out there that allow reordering by WK level?

Not that I know of, honestly. I tried checking the master list of WK userscripts and casually going over forum posts, but it’s quite a lot out there :eyes: if anyone here knows of one they can link, or any dev has already made one and wants to shill it here, please do so!

2 Likes

Thanks for the update. The bugs seem to be fixed, but now Reorder Ultimate 2’s 1-by-one mode no longer functions with this script. If it’s not one thing, it’s another, eh?

1 Like

Many thanks for the response! Certainly I didn’t mean to pressure you at all. I can only imagine how much work it is even to maintain the feature set you already have in this script, and I get that you don’t want to mess up user experience. In any case, I’m no longer desperate (:cold_sweat:) now that I was able to get it RoU2 working again.

2 Likes

Ah that’s no good. Have you tried disabling one or the other?
If you’re used to RoU2’s 1x1, I’d recommend disabling this script’s 1x1 mode in it’s settings. If the setting is off, it’s effectively a total no-op and shouldn’t cause any conflict with other scripts.

If that doesn’t work, maybe try disabling RoU2’s 1x1 setting and trying this script’s 1x1 mode – I really doubt it, but it’s not impossible that it might’ve broken recently. :thinking:

2 Likes

I was wondering if this is expected behaviour. Suppose my review session has 10 apprentices and 10 gurus, and I sort it by ascending srs.

What I expect is that 10 apprentices come first, then 10 gurus in my review (AAAAAGGGGG). But what I got is a few, but not all apprentices come first, then some gurus are mixed in too early (AAGAAGAGGG, or something like this). Clicking reordering button again still doesn’t order them the way I expect.

I didn’t test it properly and might miss something, since I have to wait for my reviews to pile up. What’s your input on this?

Hey, sorry it took a bit to get back to this – disconnected from stuff for the holidays.

That behavior’s definitely not right, though I’m not sure of anything that might cause that – this is the first report of mis-sorting I see actually. I’ll definitely need more info to debug this. Could you please include the information mentioned in this bug reporting guide so that I can look into it farther?

Sorry to have to drop back in, but I’m having a strange issue that I can only assume is an issue between this and WK, because turning every other script off still gives me the same issue. Basically what is happening is that everything works fine as long as I’m drilling kanji or vocabulary, but when I get radicals, I’m greeted with a text box that only takes hiragana.


When I’ve tested just writing something in (nonsense or こっれct), it jumps to another review without marking it right or wrong and the arrows in the top left disappear as if WaniKani killed the script.
image
In fact it seems like WK kills most of the scripts.
image
Here’s a screenshot of my scripts in tampermonkey. I’m on Windows 10, using chrome. I wasn’t using compatibility mode, but upon turning it on to try, I got the same issue.

Thanks in advance, and sorry for the bother.

2 Likes

I was having that problem too, but it went away when I removed another script (Wanikani Wrapup Button Enhancement). NB: disabling the script didn’t seem to help, but deleting it did. I know almost nothing about coding, so I can’t fathom why. :person_shrugging:

1 Like

Hey! Thanks for the detailed bug report (and thanks to @Rowena for elaboration on their similar experience) :pray:

So I’ve definitely never hit this before, even when sorting or using 1x1 mode on radicals. To narrow down where in the code base this issue may be cropping up, could you share your settings under the Sorting panel? (example below)

In fact it seems like WK kills most of the scripts.

Now this is really interesting. To be sure I understand, this comes up after a radical question comes up and you submit an answer for it? The button for the script gets removed entirely? What about the counters? And is that image Tampermonkey’s menu completely with the Reorder Buttons script completely removed?

Some other questions that could be relevant:

  • When you say “turning every other script off”, do you mean disabling it with the slider on the Tampermonkey dashboard and reloading the page?
  • Would you be able to recreate the issue and send me a picture of the javascript console’s output after it all goes down? If there’s some fatal error going on, I’d expect something being loud in the developer interface. (brief guide on how to do that here)

In the meantime, I’m going to look through those other userscripts and see if there’s any chance it could be related to this error :thinking: Rowena’s corroborating comment makes me think there’s some undocumented userscript engine oddity that may be affecting things…

2 Likes

Hey again :wave: went over the userscripts in that list but didn’t find anything that stood out greatly. I also didn’t find anything online about how or why userscripts would “unload” themselves.

I did add a new feature in the meantime (v3.2) that adds a new button that downloads all logs from this script in a single file you can upload with bug reports. It’s located in the Help tab in the settings panel at the bottom (info on that here). If you could share a log file from that button when you recreate the issue (or share your Javascript console logs instead if possible), that’d help in looking into this issue.

2 Likes

Hey! Some “great” news! I ran into a bug that seems exactly like what you and @Rowena described! I’m not sure it’s the exact same bug, but the behavior was the same. It was really quick, but basically as soon as I submitted an answer, the page was reloaded and the Reorder Button userscript was unregistered from TamperMonkey while I was on the page! To me it happened as I had a radical sorted as the first review item on my queue.

I went through the code base, and while I wasn’t able to be 100% sure I found the exact cause of this, I did make a quick fix to something that seemed wrong and after testing the change, I was able to continue my reviews as usual and the bug seemed gone.

To be clear, I’m not 100% sure this was the same bug for y’all but it at least seemed related. I’ve pushed a fix up in a new patch version (v3.2.1). If you update, you should get the fix :grin: I seriously hope it addresses the issue!

Update: “silent” patch update (v3.2.2) released :sweat_smile: if the script doesn’t actually update try manually installing the actual update by using the usual install like (this one).

Kinda embarrassing, but this bug had layers to it. I encountered an even worse problem after fixing it and going along with even later reviews. Basically, I think the reason TamperMonkey killed it on your browser was an infinite recursion bug (basically, some code kept triggering itself causing the browser to kill it). I found the cause of it thanks to some more logging I added to things (also included in patch for potential bug reports).

I sincerely hope I’m done fixing this now… :fearful:

2 Likes

I have some good news and some bad news…

The good news is that fix solved the issue with radicals coming up asking me for kana responses and the script being removed upon entering. I was planning on getting back to you with that extra info but you found it without me!

The bad news is something else broke. I still think it’s this script because it’s a new problem and goes away when I turn off Reorder Buttons. What happens now is that the script loads in radicals first (as intended), I answer one correctly, press enter, get the next, enter it, press enter, and THEN everything freezes. Enter does nothing, pressing the arrow button to move to the next card does nothing. I can press other buttons just fine but I can’t move on without reloading the page.

I’ve included my reorder button settings this time, as well as another picture of the other scripts I have just in case it’s an issue with that.
image

I love that you’re so on top of things, but I feel bad that I keep calling you back to the same project over and over. Let me know if you need any other info.

2 Likes

Ok I tried sorting meaning → reading instead and this seems to have alleviated the issue. I would conjecture that the script is trying to process the “reading” side of radicals and having issues when it, well, doesn’t exist. That’s not a very programmer-y way of thinking probably but it squares with the last bug asking me for kana input.

2 Likes

Actually it’s happening with kanji as well. I sorted meaning > reading to get rid of all the radicals but then I switched back for kanji and what’s happening is I’m initially getting reading before meaning as intended but after one card goes by it switches back to meaning > reading, and then gets stuck when I try to submit the correct reading. Very interesting.

Edit: Ok, I keep finding new “functionality.” So I tried to switch to meaning > reading for now just to be able to do reviews without killing the script, and apparently that wasn’t the issue because sure enough after one successful review it fails to submit on the next card. This time it’s on meaning. So perhaps the reading/meaning thing is not the core issue at all.

Edit: More testing reveals that if i press the arrow buttons at the top left to sort ascending/descending I don’t have this issue. Even if I switch back and forth. Even if I turn on reading > meaning. It’s only when the sort is first loaded on refresh that I encounter the issue on the 2nd review.

2 Likes

Now this definitely sounds mega-busted. I’m not sure how this issue keeps getting worse, honestly :disappointed: would you mind including some logs from the script (under the Help tab of the settings panel, there should be a button that offers to download logs for bug reports)? It’d also help if you could confirm that you’re on version 3.2.2 of the script and that the issue comes up with only WaniKani OpenFramework and Reorder Buttons active.

I’m fresh on this right now, so I’ll be available for rapid responses :grin:

1 Like

I have to go teach a class for the next couple periods so I won’t be on for a little bit, but just in case, check my edits to the last comment. I’ve figured out more or less when the issue crops up. Thanks!

I’m on the latest version (3.2.2). yes, and I’ll grab a log real quick.

2 Likes

Here’s a log with everything but reorder buttons turned off. The issue seems to have vanished [Tue Jan 25 2022 08:47:30 GMT+0900 (Japan Standard Time)] loading settings...[ - Pastebin.com

Here’s a log with everything back on, but for some reason the issue is still gone. I’m losing my mind. [Tue Jan 25 2022 08:49:58 GMT+0900 (Japan Standard Time)] loading settings...[ - Pastebin.com

Gotta run, sorry

2 Likes

Losing my mind over this too :grin: at this point, it’s looking like a majority of my development effort will go into user-side debugging tools. Not something I’ve worked on before, but a good learning experience regardless. :eyes:

I’ll comb the logs and see if/how I can replicate this – I’ve yet to think of a good way to test scenarios given I basically have to manually test against my own reviews :grimacing: anywho, good luck with classes!

1 Like