[Userscript] Self-Study Quiz

The For scripter section in the top post was sufficient for me. You just need to add a note on the on_close callback there, unless there are more options I am unaware of.

I found the answer to my question by looking at the code. You shuffle the items randomly first, and you pick a number of them using the Maximum Quiz Size parameters if non 0. This is a feature you should advertise. How to quizz on Burned items is a recurring question in the forum. Self Study Quiz does it out of the box and nobody knows it. Maybe you should rename Maximum Quiz Size to Size of Random Selection and put a note in the top post of this thread saying this feature exist.

1 Like

Giving you an in =)

Or, 3 post max override :wink:

3 Likes

Why my internet so slow! I wanna save @prouleau too… >:C

I’ll guess I’ll leave you with another durtle I made today! ^>^ :zombie:

頑張って with all that scripting! ^^

3 Likes

This is what I feel like when I struggle with big reviews and try to push through! :rofl:

2 Likes

Thank you @Toyger @ekg

@rfindley

I plan to include all filters ever developed in Item Inspector via @ require directives. This causes a massive quantity of filters to be in the register. There are 64 of them. They will all load in Self Study Quiz in the filter page of the settings in some undetermined order.

There are user interface issues with this. Some of the most useful filters end up at the end of the list buried in other less useful ones. It will be hard for the users to locate the filter they need. We must control the order in which filters show up in the settings and group them into similarly themed groups.

I have written code to do this for Item Inspector and I have ported it to Self Study Quiz. The modified version is available here.

Modified Self Study Quiz

There are two major changes.

  • There are @ require directives for all available filters. you won’t need to chase them for your evaluation.

  • The function populate_items_config(config) has been modified to control the order where the filters are displayed and insert them into groups. This is the function responsible for creating the filter page in the settings.

I have the order nailed down in the const flt_ordering.object. The key is the filter name as registered. The value is a subobject with the following configuration.

  • group the identification of the group.
  • ‘order’ an integer indicating in which order the group belongs relative to other groups.
  • suborder an integer indicating in which order the filter appears within the group.

There is also the const group_labels that holds the labels for the group and the const dflt_ordering that provides the default ordering subobject for filters not categorized in flt_ordering. For now there are no such filters because I have categorized them all. But should a filter be developed in the future it will show up at the end of the list in a group called ‘Other Filters’.

Outline of the code:

  • It iterates over the filters in the registry and pushes them tagged with their ordering subobject in an array.
  • Then the array is sorted.
  • Then the code iterates over the array creating the filters in the setting page. Groups are added on the fly as they are needed.

I plan to write more filters once we get the html type sorted out. I will update the categorization and send you the data.

Take your time in evaluating this. There is no rush. I will postpone this release of filters until you have made up your mind about this proposal. There will be no impact on Self Study Quiz users if you delay.

As an aside I have found that the code for wrapping the html in a row with a checkbox is in the pre_open callback of the settings dialog. I will try to fix it in Item Inspector to get the html properly inserted. Then I will adapt Self Study Quiz pre_open callback to do the same and send you the code.

I have also set me up to be able to modify a local copy of the settings module of the framework. I will see if I can do something about the callbacks.

3 Likes

Wait, doesn’t not adding a type attribute already achieve this? For the JLPT filter, for example, I have one filter that simply adds the JLPT info to each item (doesn’t actually filter), and one filter that actually filters by JLPT level. For the former I only have a filter_func, and it doesn’t show up in the UI.

1 Like

I didn’t think of that. Your solution works too.

I found out about filters without type info when I wrote the categorization function for the filters. While the no type filters don’t show in the UI they are not marked as such. They caused the Other Filters section to appear in the UI even though there is not Other Filters to display. I had to test for those filters the same way I test for no_ui.

1 Like

Would it be possible to change the shortcut keys/make them configurable? When I need to retype the whole answer I used to use [CTRL/CMD]+A to select the whole text to quicker delete it (it’s much quicker that smashing the backspace button). But currently what it does is playing the audio - giving the answer straight up (and because I used to select text this way it happens a lot). Maybe changing the shortcut key to [CTRL/CMD] + J (almost like in the WK reviews) would work. Or blocking the audio until the answer is provided.

Also, would it be possible to display the link to an item being quizzed? In case I’d like to check the mnemonic etc.

Thanks!

Pretty much exactly what I asked for as well: [Userscript] Self-Study Quiz

@rfindley any comments?

I don’t have time to work on it, but all of the shortcut keys are in the same place in the code, in the function quiz_key_handler() if anyone wants to try modifying it.

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