[Userscript] Self-Study Quiz

posting just to say i love this script! thx very much!

4 Likes

I want open the self-study quiz from the review summary page (either from a link or automatically) - specifically for “Audio Review” for my “Recent Reviews” items.

I’m sure there’s an easy way to do it, but I can’t seem to figure it out… any ideas?

To do this you will have to write a script. I can think of an easy way. Self Study Quiz relies on filters to select the items you will be quizzed on and there is no filter that selects the recently reviewed items. So without a script to make the required filter there is no hope.

Makes sense. I have the quiz filter setup and I have a script with a link I can click.

Just looking for the code to open the quiz window with a slecified quiz style and filter.

1 Like

Look in the top post of this thread. It is possible to invoke Self Study Quiz programmatically, passing the filter configuration as a parameter. There is a developer note on how to do this.

You can’t select the Quiz style but it won’t matter. You will be given the opportunity to select it manually when Self Study Quiz opens.

Edit: I am not sure you will be able to do it from the review page because the script is not loaded in Tampermonkey on this page. Would your filter still work when you are back on the dashboard?

I don’t know if you managed to launch SSQ the way you wanted but I am letting you know in case this is of interest to you.

I have made a filter for the date of last review that will work in SSQ launched from the dashboard. It is in the latest release of the date filters script. Install the script and look for this filter.

filter

This will select the items for which you had a review in the last four fours. It will work from the dashboard. If for some reason you can’t quiz yourself right away on your reviews you may leave the review summary page, attend your business and when you are done go back to Self Study Quiz and get your quiz.

The filter also works with Item Inspector if you are a user of this script.

Thanks for the filter! I’ll see if I can get this integrated into my flow.

1 Like

I see your point on launching SSQ from the dashboard. Perhaps my link on the Reviews Summary page could navigate back to the dashboard then automatically open the SSQ from the dashboard. Something like…

on review summary page
whenMyLinkIsClicked() {
// set some parameter like… openSSQ=true;
// open dashboard page
}

on dashboard
whenPageOpens() {
if ( openSSQ ) {
openSSQ = false;
// open self study quiz
}
}

Is is possible to set a parameter which is still set on the next page? (Sorry for the newbie questions!)

I suggest you write a script configured to run on both the review summary page and the dashboard.

You can set values silently in the wkof settings, that is without going through the dialog. This is one possible way you can communicate information between different pages.

In the summary page you do

wkof.setting[yourScriptId].needSSQ = true; 
wkof.Settings.save(yourScriptId);

In the dashboard page you do

if (wkof.settings[yourScriptId].needSSQ){
   wkof.setting[yourScriptId].needSSQ = false;  // so you don't launch ss_quiz every time you load the dashboard
   wkof.Settings.save(yourScriptId);
   wkof.wait_state('ss_quiz', 'ready')   // make sure ss_quiz is done initializing
       .then(open_quiz)
}

function open_quiz(){
    var custom_options = {
        ipreset: {name: yourScriptId, content: {
            wk_items: {enabled: true, filters: {
                dateFilters_lastReviewAfter: {enabled: true, value: '-4h'}, // setting the last review parameter
            }},
        }},
    };

    // Open the quiz
    ss_quiz.open(custom_options);
}

Of course this isn’t debugged. Too lazy to count brackets properly. And I haven’t tested it so there may be a snag or two that eludes me.

You will need to figure out the Tampermonkey @include directives that will get this script loaded on both the dashboard and the review summary page.

I am sure if @rfindley see this they will laugh at me and point out a better way.

That’s exactly what I was looking for. Thank you!! :pray:

1 Like

This was easier than I thought. The following code adds a link on the sessions review page which navigates to the dashboard and opens the Self Study Quiz window.

    if (/dashboard/.test(document.URL) || document.URL == "http://www.wanikani.com/" || document.URL == "https://www.wanikani.com/")
    {
        if (localStorage.getitem('autoOpenSSQ')) {
            localStorage.removeItem('autoOpenSSQ');
            wkof.wait_state('ss_quiz', 'ready').then(() => ss_quiz.open());
        }
    }
    else if (/review/.test(document.URL))
    {
        let reviews_summary = $('#reviews-summary div header');
        const $quizButton = $('<a href="/">Boost your memory with a quick audio quiz!</a>');
        reviews_summary.append( $quizButton.click(function() { localStorage.setItem('autoOpenSSQ', 'true'); }));
    }
2 Likes

I just installed the Item Inspector userscript and this one. When I try to do reviews they won’t load because either one of the scripts throwing an error, but I can’t quite tell which one is it.

Here are the errors:

This may relate to it, but I’m not actually using Tampermonkey for the scripts. I’m using Adguard (just because when I went to install the first one it prompted to use Adguard and I didn’t really know how to choose for it to use Tampermonkey instead). It worked fine for the other scripts, though.

1 Like

I am the author of Item Inspector and I can confirm that you have a problem with Item Inspector. You also have errors linked to the Prioritize Overdue Reviews and a script built-into the Wanikani web site called newrelic.

If you have no reason to use adguard you should uninstall it. This software is an adblocker and it blocks your scripts from functioning. There may be a way to make it play nice with scripts but I don’t know how to do it.

If you uninstall adguard and have tampermonkey installed things should go back to normal.

Wouldn’t mind changing to using Tampermonkey instead but, having to remove Adguard would be a pain. The common adblocks don’t really cut it anymore, and I already paid the annual subscription for it, rather keep it if possible.

I’m gonna check to see if I can just install all the scripts I currently have on Tampermonkey and see if it works.

I am not sure whether this will suffice. Item Inspector is checking if you have Self-Study Quiz installed because it is a pre-requisite to Item Inspector. Performing this check runs into the error. I suspect (I can’t verify this) that adguard is blocking this check as a side-effect of the add-blocking function. I don’t expect running Tampermonkey will disable this blocking function.

Also this is not just an issue of replacing Adguard with Tampermonkey. Adguard also blocks some scripts built into wanikani from doing their job. These scripts are not Tampermonkey scripts. They are built into the website and Wanikani expects them to run without interference.

If you want to use adguard you will have to find a way to whitelist or otherwise permit the scripts you need to run unhindered. There should be some settings in adguard for this.

I changed them all to use Tampermonkey instead and it seems to be working fine now. Thanks for the help! :heart:

1 Like

Great! :+1: I love it when Item Inspector users can use the script without problems.

this has improved my wanikani accuracy a lot! makes it easy to repeat the vocab that gets confusing, and now I’m memorizing the ones I kept getting wrong.

It also makes it easier to make mistakes, so you can review a lot without feeling like you lost something, thank you so much for making this

1 Like

I just want to thank the creator of this script. It has made learning Japanese sooo much easier.

3 Likes

For some reason, I no longer have the Kanji/Voc/Rad → Meaning option available.
The Question-Type I created a while ago still works, but it also no longer shows the Meaning option.
Any ideas on how to fix this? :frowning:

image