[Userscript] Wanikani Incorrect Driller

Desciption

After a review session I’ve always felt that just giving a list of incorrect items is pretty useless. Sure it’s nice to be able to go through the list a couple of times but you end up learning the sequence rather than items.

This script aims to fix that problem. With a quick click you’ll be drilled on your incorrect item.

In short, the script hides all the incorrect items, randomizes their order and then displays one item at a time. To see the next item you just press the spacebar. Since this is made to be able to quickly drill items, you don’t need to type your answers

Installation

  1. Install Tampermonkey on your browser
  2. Install the script from here.

Usage

To start a drill click on “Apprentice”, “Guru” or “Master” to start drilling items. To advance to the next item just press the spacebar. If the drill doesn’t start then refresh the page.

start

drill

Issues

  1. The script doesn’t load after finishing your reviews, it requires a refresh of the page.
  2. When drilling, if you mouse over an item to get the answer, the answer text will bleed outside the answers box. Fixed thanks to rfindley, will update script shortly

If anybody knows how to fix these issues, please tell me. I’ve never developed a userscript before and I’ve never really used javascript before.

Other issues might exist as I’ve not been able to test it as much as I would have liked. Simply put, I’ve been too accurate on my reviews recently and just haven’t been able to test all elements as a result.

Future Plans

This will probably be extended to allow you to do the same drills on the lesson screen.

7 Likes

I take it you partly built this to get practice writing JavaScript and building a user script?

For what it’s worth, you can already drill new lessons and recently failed reviews with Self Study + Additional Filters.

Partly practice and partly because I wanted something quicker than the Self Study Quiz. This was made to quickly drill mistakes after a review session, that’s why this doesn’t require you to actually answer, just press space.

This was really made for me but figured I’d share it here for anyone after something similar.

3 Likes

I’ll have to try this out tomorrow, see if it beneficial to me.
Thanks for sharing with the community! ( ^∀^)

You’re probably getting a race condition, such that document.getElementById("incorrect") doesn’t exist yet.

You could do something like this:

function start() {
    var incorrect = document.getElementById("incorrect");

    // Check if the results aren't rendered yet.
    if (incorrect === null) {
        // Try again in a moment.
        setTimeout(start, 200);
        return;
    }

    var inLinks = incorrect.querySelectorAll('span');
    inLinks[0].addEventListener('click',function() {startQuiz("master");}, false);
    inLinks[1].addEventListener('click',function() {startQuiz("guru");}, false);
    inLinks[2].addEventListener('click',function() {startQuiz("apprentice");}, false);
}

start();
2 Likes

The hover popup has a CSS property:

.hover {
    max-width: 200px;
}

You could override that with a larger value, or set it to ‘initial’ to let it get as big as it wants.
The purpose is to prevent really long English answers from making too big of a box, so you’ll need to decide how you want to handle that.
You could also set it to hide overflow.

// Add some CSS to fix hover popup overflow
var style = document.createElement('style');
style.innerHTML = 'div.hover {max-width:400px; overflow:hidden;}';
document.querySelector('head').append(style);
1 Like

Just gave that a go but it didn’t do anything. I’ll look into it a bit more but it seems the script just outright isn’t loading. Not even appearing as a script in Tampermonkey until I do a refresh

Was aware that was what I had to but just didn’t know how to do it. Thanks a lot for the help.

1 Like