The New And Improved List Of API and Third Party Apps

I feel silly asking this but…

Isn’t there a userscript for, when you answer correctly during reviews, the item info is automatically opened? I read through the list but I must have missed it if it’s there. I hope I didn’t make this up… xD

Thank you!

Edit : Wait… Is there a way to make it only do this when I answer correctly? Is that a separate userscript? I don’t want it to auto-expand if I answer incorrectly.

Errr… that’s a good point. But I couldn’t find any other similar user script.

That’s okay. Thanks for trying! I’ll keep looking and I’ll probably keep using this one for now. Thanks for your help.

Oh wait, found it!

1 Like

OMG yay!! Thank you so much @plantron! <3

Your welcome. But it’s not exactly 100% what you were looking for? You wanted the whole item info to expand, but that script only shows you the context sentence, if I read it correctly.

Ah, I just saw that. Yeah, not exactly what I’m after but I do like the functionality of this one as well and I will still use it.

Would still prefer to also have a correct-answer-only-auto-expander, though.

woah looks good

Found the opposite of what you want LOL

Haha. Poo.

On the bright side, I’ve done several reviews with the context sentence one that you provided that I wasn’t even looking for and it really is helping! So I fully appreciate your efforts nonetheless.

Here’s a one-line fix in the code for the “Item Info AutoExpander” script to make it only open when the answer is correct:

    var oldEvaluate = answerChecker.evaluate;
    answerChecker.evaluate = function(e,t) {

        // Add the following line to make it only open when answer is correct
        if (!$('#answer-form fieldset').hasClass('correct')) return oldEvaluate(e,t);

        // add listener to disable scroll
        window.addEventListener('scroll', noscroll);
4 Likes

Give this guy some catnip!

1 Like

My hero. :yellow_heart::green_heart::blue_heart::purple_heart:

有難うございました!

Edit : Of course, works flawlessly.

As you can see from my previous post, it WAS working. When I went to do my next batch of reviews after that, it wasn’t working anymore (as in not expanding at all, regardless of whether I answered correctly or not). I couldn’t figure out why as I didn’t change anything. I thought maybe some of my other userscripts were messing with it, so I disabled every one of them except the Info AutoExpander. Still didn’t work. Is something wrong in my code? Anything else I can try?

I see what I did wrong. Here’s a much cleaner version:

code
// ==UserScript==
// @name        WaniKani Item Info Expander
// @namespace   mvi
// @description Expands item info automatically without scrolling. Based on script by Takuya Kobayashi, with help from Mempo and rfindley.
// @include     https://www.wanikani.com/review/session
// @include     https://www.wanikani.com/lesson/session
// @version     0.22
// @run-at      document-end
// @grant       none
// ==/UserScript==

(function () {
    'use strict';

    function noscroll() {
        window.scrollTo( 0, 0 );
    }

    var oldEvaluate = answerChecker.evaluate;
    answerChecker.evaluate = function(e,t) {
        var answer = oldEvaluate.call(this,e,t);

        if (answer.passed) {
            // add listener to disable scroll
            window.addEventListener('scroll', noscroll);

            // expand item info
            setTimeout(function () {
                $('#option-item-info').click();
            }, 100);

            // Remove listener to disable scroll
            setTimeout(function () {
                window.removeEventListener('scroll', noscroll);
            }, 1000);
        }

        return answer;
    };

    console.log('WaniKani Item Info Expander: script load end');
}());
2 Likes

@rfindley先輩、ありがとうございます!

Thank you so much for taking the time to do that for me. It will help me out a lot!

Where’s that catnip?!?!

D:

I don’t have! Waaaaah~

Maybe I can sneak him some of my burned turtles? Sounds risky. I’m sure the Crabigator would sense it…

Also, happy cake day!

1 Like