[Userscript] Self-Study Quiz

For anyone inspired to hack their own shortcut keys… I made a little Self-Study shortcut key hack a while ago, and it’s pretty easy to do. rfindley’s code is well organized & pretty easy to understand.

I only use self-study quiz for a quick audio quiz after each study session, so I made shortcuts specifically for this purpose. WARNING - I did away with modifier keys (ctrl,…), so my shortcuts make it impossible to move the cursor around while typing (because I don’t type, I just think, then check my results). Thus, this isn’t a great solution for everyone.

For what it’s worth, here’s my shortcut hack…

back tick - replay audio
left arrow - prev item
right arrow - next item
up arrow - show help
down arrow - mark as incorrect, and show answer

That’s it. Super easy for my purposes (but again, not a general purpose solution, sorry)… here’s what I changed… (parts with jeff8v7)

var keycode_xlat = {
        '8':'Backspace', '13':'Enter', '27':'Escape', '37':'ArrowLeft', '39':'ArrowRight', '65':'KeyA',
        '69':'KeyE', '72':'KeyH', '76':'KeyL', '80':'KeyP', '82':'KeyR', '83':'KeyS', '112':'F1',
        '38':'ArrowUp', '40':'ArrowDown', '192': 'BackTick' // jeff8v7 additions for faster quizzing
    };
    function quiz_key_handler(e) {
        if (quiz_settings_state === 'open') return true;
        var input = quiz.dialog.find('.answer input');
        var input_readonly = input.prop('readonly');
        var code;
        if (e.type === 'keydown') {
            if (e.originalEvent.keyCode) {
                code = keycode_xlat[e.originalEvent.keyCode] || 'Unknown';
            } else {
                code = e.originalEvent.code;
            }
        } else {
            code = String.fromCharCode(e.charCode);
        }

        // jeff8v7 additions for faster quizzing
        if ( code === 'BackTick' ) { play_audio(true); }
        else if ( code === 'ArrowLeft' ) { quiz.prev(); }
        else if ( code === 'ArrowRight' ) { toggle_help('off'); quiz.next(); }
        else if ( code === 'ArrowUp' ) { toggle_help('on'); play_audio(true);  }
        else if ( code === 'ArrowDown' ) { // fail & show answer
            input.val('x'); submit_answer(); toggle_help('on');
        } else
        // jeff8v7 end
2 Likes

Hi, i’ve installed the script but it didn’t show for me, how to activate this? do i need to copy the api somewhere in the code?

1 Like

Click on the link in the open submenu and it will start.

selfstudy

Is it possible to create a Preset List with all the mistakes made on the items (kanji, radical and vocabulary) reviewed on the same day?

1 Like

Not sure if @prouleau already made something like what you are requesting, I wouldn’t be surprised, they do like filters. If not then if someone else wants to do it I think it wouldn’t be too hard to fetch the most recent reviews and make a filter to process them.

3 Likes

The required filter is in the Additional Filters set. It is called the Failed Last Review filter.

Once you have it installed go to the settings and add a new preset in your list. Then turn on the Failed Last Review filter by clicking on the checkbox. The filter is already set to 24 hours by default. You can change this time if you want. This will do what you want.

1 Like

Thank you very much. I didn’t know what the 24 in the filter meant.

1 Like

The problem is, that thing is not there after i install the script

Did you install the Open Framework as well?

1 Like

I guess you mean the Failed Last Review Filter?

Which script? If it is Self-Study Quiz you need to install Additional filters as well.

If it is Additional filters you need to place it is position 2 in Tampermonkey, right after Open Framework.

And as @Kumirei said, you need to install Open Framework. It must be in first position in Tampermonkey.

If you miss any of these steps the filter will not show up.

yes i did install the framework

2 Likes

I don’t see Additional Filters, or at least it is not in second position.

i replied before i see your reply xD. Yes i don’t have the additional filter, could you tell me where to get that?

I posted a link there.

And it still not there xD


You are looking at the wrong place.

First start Self Study Quiz.

selfstudy

Then you go into the settings of Self Study by clicking on the gear icon in the upper right corner.

selfstudy

Then you go to the Items tab. While you are there create a new preset using the new button. It is not a good idea to mess with the existing presets.

selfstudy

Then scroll down the list of filters and you will find it. It is greyed because by default it is disabled. Clicked on the checkbox to enable it.

selfstudy

yeah, the problem is the additional “scripts” is not there for me

This is odd because I see your scripts in your tampermonkey. Are they enabled?

There is a Tampermonkey icon on the upper right corner of your browser. Click on it.

Tampermonkey

The top row the checkbox must be at “enabled”. If not click to enable it.

Then in the list of your scripts the sliders must be at the green position. If not click on them to make them green.

Once this is done refresh your browser. Your changes won’t take effect until you do. Then check if this solves your problem.

i only need 3 scripts ( WK Open Framework, WK Open Framework Additional Filters and WK Self-Study Quiz) for this to work right? i already enabled the script from start so i really don’t know what’s happening here

Yes these scripts are sufficient. Something odd is happening and I am trying to find out what it is.

Did you check the Tampermonkey as I asked? We need to know if there is something wrong with your Tampermonkey. If everything is ok there are other things to check afterwards but there is an order to follow when troubleshooting these things. I need to be sure the Tampermonkey is OK before I proceed to the next step.