[Userscript] Self-Study Quiz


#243

Holy crap! Sounds amazing already. Thank you rfindley! :purple_heart:


#244

Yessssssss! I’m excited for this :3
You rule big time!


#245

Awesome!! Thank you :slight_smile:


#246

@rfindley You often recommend spending more time to front in lessons. Have you considered for the new version allowing quizzes during lessons themselves or on the lesson summary page?

Or at the very least, would this be an easy thing for someone to plug in via a function (i.e. studying all items that had their lesson done less than X hours ago)? Perhaps you could add that as one of the pre-canned options since it’s not subjective like leeches is.


#247

Yeah, we could have a way to binge the items learned right after the lessons. I always do that with kanji and it does help me a lot.


#248

In that case, you could select current-level items at Apprentice 1. You might catch some that have fallen back from higher srs levels (though still on the same level), but that wouldn’t be a bad thing to add to your queue.

And like you said, if you wanted to add an additional filter for unlocked_at, you could do that easily enough.


#249

Hello! Thanks rFindley for the great script. I just found it today and look forward to using it more.

I tried out the audio quiz, however the audio doesn’t play. I have the settings set to how you have them in the picture you uploaded and my volume is up. Could you help with this?

(Also, I’m running the Opera browser. Do you know how often Opera might not be compatible with userscripts, considering it’s not a very popular browser?)


#250

The usual reason for missing audio is the realization that audio only exists for vocab. Beyond that, make sure the audio icon is enabled in the upper-left of the quiz window.

I’ll be releasing a new version in the next few days.

I don’t have a feel for current Opera compatibility. For my own scripts, I try to write code with compatibility in mind based on previous compatibility experiences, but to be honest it’s been quite a while since I’ve tested them on multiple browsers. (I already spend more free time than I should on WK scripts >_> )


#251

Alright, thanks. I’ll play around with it.

Don’t work too hard on scripts!! haha


#252

Once you release the update I’ll try making an unlocked at function to register. If it works well I’ll post the code here so you can consider if you want to bundle it in.


#253

Can type be an object? In my hacked together leech script that I added into the old self study script, I let you specify the “time until review” to filter by per srs level. For example, you could set it to never review Enlightened items, review Master items that are 25 or more days until review, and so on. It’s a bit complicated, but I’m still curious if I could replicate that with the plugin functionality you’re adding. If not, I could still let users customize that aspect in my script that adds the leech filter, but ideally they could set that in the UI instead of by editing the script.


#254

The simplest would be to use a text box with comma-separated parameters, and just parse each section.

code
// Function to clean up a comma-separated list
function split_list(str) {return str.replace(/^\s+|\s*(,)\s*|\s+$/g, '$1').split(',').filter(function(name) {return (name.length > 0);});}

function parse_time(text) {
    var sections = split_list(text.toLowerCase());
    var time = 0;
    sections.forEach(function(section){
        var months = ((section.match(/^(\d+)\s*(mo|month|months)$/)) || [0,0])[1];
        var weeks = ((section.match(/^(\d+)\s*(w|week|weeks)$/)) || [0,0])[1];
        var days = ((section.match(/^(\d+)\s*(d|day|days)$/)) || [0,0])[1];
        var hours = ((section.match(/^(\d+)\s*(h|hr|hrs|hour|hours)$/)) || [0,0])[1];
        var minutes = ((section.match(/^(\d+)\s*(m|min|mins|minutes)$/)) || [0,0])[1];
        time += months*30*86400 + weeks*7*86400 + days*86400 + hours*3600 + minutes*60;
    });
    return time;
}
Result:
parse_time('1 week, 2 days, 3 hours');  // 788400 seconds
parse_time('  1w  ,2d, 3    hrs ');  // 788400 seconds

If you really need something complex, I was planning to support a 'button' type, which would call a function when clicked, then your callback would be responsible for displaying a more complex filter settings dialog.

wkof.ItemData.registry.sources.wk_items.filters['time_until_review'] = {
    type: 'button',
    label: 'Time until review',
    filter_func: time_until_review_filter_function,
    hover_tip: 'Filter items based on their next review time',
    filter_func: my_filter_function,
    on_click: open_my_filter_settings_dialog
};

The on_click callback would be passed an on_save callback that your filter dialog should call if the user saves the settings of your filter.

function open_my_filter_settings_dialog(on_save_callback) {
    // TODO: Display a dialog box with my filter's complex settings.
    ...
    // Tell the framework that the user changed my filter's settings.
    dialog.on_save = on_save_callback;
}

#255

The button approach will probably work out well. It’ll be more intuitive than a comma separated string. And by adding it as a filter, I could actually support the time until review filter separately from the leech filter.

Rather than everyone making their own threads for their filters (like normal script threads), do you think it might make sense for you to have a section in your main post for the additional filters? Then people could just post them here and you could add them to the main post. They’d still be scripts of course, but it might be more organized this way.


#256

Actually, the ideal place for filter discussions is in the Open Framework Discussion thread. These filters are generic. Any script can make use of them in choosing a set of items for whatever reason… for example, a script that exports items to csv, where you can choose items by level, by leech score, by SRS level, etc.


#257

Also, regarding complexity of text boxes, there are two parameters that are useful for helping the user understand how to use it:

placeholder: '(e.g. "1-3,5")'
hover_tip: 'Filter by Wanikani level\nExamples:\n  "*" (All levels)\n...'


#258

Instead of opening a dialog, would there be a way to still edit the “complex” filter values on the Self Study dialog? I’m thinking maybe a collapsible section so it’s not overwhelming, but then still allowing everything to be in one place. So perhaps the type is section or something like that, and the on_click function gives you the html to add, or something like that. I haven’t thought through the details, but what do you think at a high level?


#259

Hi I think I encountered a bug,

wanikani

It won’t accept the right answer.


#260

:point_right: [v2.1.1] - Strip spaces after reading in Wanikani data


#261

@rfindley Any update on when you expect to release the new version?


#262

Later today or tomorrow. I was delayed by a huge refactoring of the code, but now it’s a lot easier to read and modify.