[Userscript]: Reorder Ultimate 2 [newest]

Ah, sorry, you’re right. It does show up and I can click the button and it kind of randomly shuffles the items. Also reading and meaning is asked consecutively, which is correct. Just sorting in the order that I want doesn’t work anymore. Other scripts somehow still work.

I’m using firefox on mobile since I often don’t have access to my computer, but it used to work before. I also installed the updated script, turned it off and on, but it didn’t help. And I don’t quite know how to actually check the console on mobile, just html. :confused:

Do you have the checkboxes checked and the scales tilted?

2 Likes

Ok, now I feel dumb. It was the scales actually… :woman_facepalming: thanks!

1 Like

No worries!

1 Like

I’ve done the same thing myself. Cleared the cache, didn’t think about the lost settings, and didn’t notice the scales.

In your case, the settings were lost due to a Wanikani change, so it’s even more understandable!

2 Likes


Um…any idea why is it stuck on the left? Thanks

Update: Fixed it, just had to scroll up a bit in this thread

2 Likes

@rfindley I’ve been thinking about reorder scripts lately, and the Math.random thing has been bothering me. I’ve been looking around to see whether it’s possible to vary the behavior depending on the caller, so that it can return 0 only when called by WK. It seems as though it’s possible, but you’d have to use deprecated or non-standard functions or methods. It seems to me that these are still sufficiently supported, though, to validate use in a userscript; what do you think? I’ve been looking in particular at Function.caller and Error.prototype.stack (instantiating an error to get the stack).

As you know, since Wanikani could change their code, using the call stack could fail eventually.
But if you want to go that route, the name of Wanikani’s function that calls Math.random() is ‘randomQuestion()’. So, this works:

oldRandom = Math.random;
Math.random = newRandom;
function newRandom() {
    if (arguments.callee.caller.name == 'randomQuestion') {
        console.log('randomQuestion()');
        return 0;
    } else {
        return oldRandom();
    }
}
1 Like

I just think it’s a shame to overwrite Math.random and mess with other scripts sweat_smile

I’ve put this in my WIP for now

let old_random = Math.random;
let new_random = function(){
    let re = /https:\/\/cdn.wanikani.com\/assets\/v03\/review\//;
    let match = re.exec(new Error().stack);
    if (match) return 0;
    return old_random();
}
Math.random = new_random;
1 Like

One potential down side of your solution: It looks like WK bundles jquery into the same file as the review page code, so anything in jquery that needs random() would also be affected. And I’m seeing two calls to random() in jquery:

  • One for generating a random ID ($.expando)
  • One in the Sizzle CSS Selector Engine. I’m not sure what it’s doing since it’s minified.

But if you don’t see any side-effects… go for it! :slight_smile:

1 Like

If it turns out to be an issue I can always specify the randomQuestion function in the regex, as it is written before the link. I was thinking that having just the link would be more robust, but perhaps I was wrong. 251446983644938240 Whatever I use it should be an easy fix if it were to break.

1 Like

I haven’t used a reorder script before, but I’m wondering, what does it exactly do?
I started it up and made it so that radicals appear first, but I’m still getting kanji and vocab appearing first (even though I know there are radicals in the queue)

It’s not obvious, but you have to tip the scales on the left and right (or only one side if you’re doing Lessons). The scales set the sort priority.

(see the instructions at the top of the thread).

1 Like

Hey there!
I thought it was a bit ugly having a big old black line added on the screen so I changed this:

Line 50 in the script:
’ background: rgb(238, 238, 238);’+

This should be the same background color as the page, so all you’re left it is the little +/- button on the right. Probably safer to do this instead of adblocker :wink:

I know this is an old post, but hopefully it can benefit someone in the future!

I know there’s been a few posts in this thread about reinstalling and turning off and on other scripts but i still can’t seem to get reorder to work again, included in pic is the only scripts I have running.

Edit: I dunno what I did differently, but it’s working again now.

Is there a way to make the lessons go in the default order? It’s not super important I guess but it would make things look better. Like, right now I want to focus on radicals and so my setup looks like this.

Which leads to situations like this.

So in other words, is there a way to show the first five radicals first, then the next five, and so on? Of course I can turn the script off to get default ordering while doing lessons, but then WaniKani wants me to do a bunch of vocab first.

This may not be what you ask for, but the script Dashboard Progress Plus will reorder your radicals in the dashboard in a way that avoids the situation that bothers you. Perhaps you should give it a try.

1 Like

Thanks, that’s a good enough solution. :slight_smile: My Kanji were out of order too, so now things look prettier.

2 Likes

This is good to hear. I am happy that you like it.

Here is a tip in case you haven’t already noticed. There is now a ring around most of your kanji. When you bring a kanji to guru it will turn grey. When all the kanji within the ring turn grey you will level up. This ring gives you a visual clue on how you progress toward the next level.

1 Like

For Reorder Ultimate 2, I’m seeing a layout error on Safari. No idea if anyone else sees this, but thought I’d post just in case. The layout error seems to be tied to using pure-u-1-4, pure-u-1-2, pure-u-1-4 to get 25%, 50%, 25% layout. For some reason, this 100% is wider than 100% and overflows onto 2 rows.

I’m no css expert, but I did poke around enough to notice that if I comment out “letter-spacing: -.31em” for reorder_ultimate, then things line up again…

I made a little hack to the Reorder Ultimate 2 for the “fix” in my personal copy, but I’m sure someone more savvy than me could make a better fix for everyone…