mirror of
https://github.com/ZetaKebab/japanese-conjugation-drill.git
synced 2025-01-14 22:08:44 +00:00
Added question focus feature.
This commit is contained in:
parent
2a3561eadc
commit
758ddb711d
@ -101,6 +101,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="questionFocusSection" class="row justify-content-center">
|
||||
<div class="form-inline">
|
||||
<label class="mb-2 mr-sm-2" for="questionFocus">Question focus</label>
|
||||
<select id="questionFocus" class="form-control mb-2 mr-sm-2">
|
||||
<option value="none">None</option>
|
||||
<option value="politeness">Politeness</option>
|
||||
<option value="negative">Negative</option>
|
||||
<option value="past">Past</option>
|
||||
<option value="te-form">て form</option>
|
||||
<option value="progressive">Progressive</option>
|
||||
<option value="desire">Desire</option>
|
||||
<option value="volitional">Volitional</option>
|
||||
<option value="potential">Potential</option>
|
||||
<option value="imperative">Imperative</option>
|
||||
<option value="passive">Passive</option>
|
||||
<option value="causative">Causative</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mb-4">Question pool size: <span id="questionCount">...</span></div>
|
||||
|
||||
<div class="container options">
|
||||
|
@ -238,6 +238,12 @@ function validQuestion(entry, forms, transformation, options) {
|
||||
if (!forms["furigana"][transformation.to])
|
||||
valid = false;
|
||||
|
||||
if (options.questionFocus != "none") {
|
||||
if (transformation.type != options.questionFocus) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
@ -660,6 +666,20 @@ function calculateTransitions() {
|
||||
transformation.from_tags = calculateTags(transformation.from);
|
||||
transformation.to_tags = calculateTags(transformation.to);
|
||||
transformation.tags = arrayUnique(calculateTags(transformation.from).concat(calculateTags(transformation.to)));
|
||||
|
||||
var diffFromTo = arrayDifference(transformation.from_tags, transformation.to_tags);
|
||||
|
||||
if (diffFromTo.length > 0) {
|
||||
type = diffFromTo[0];
|
||||
} else {
|
||||
type = arrayDifference(transformation.to_tags, transformation.from_tags)[0];
|
||||
}
|
||||
|
||||
if ((type == "plain") || (type == "polite")) {
|
||||
type = "politeness";
|
||||
}
|
||||
|
||||
transformation.type = type;
|
||||
});
|
||||
|
||||
// Add trick forms
|
||||
@ -670,6 +690,7 @@ function calculateTransitions() {
|
||||
trick_forms.push({
|
||||
from: transformation.to,
|
||||
to: transformation.to,
|
||||
type: transformation.type,
|
||||
phrase: transformation.phrase,
|
||||
from_tags: transformation.to_tags,
|
||||
to_tags: transformation.to_tags,
|
||||
@ -714,12 +735,18 @@ function getOptions() {
|
||||
"godan", "ichidan", "iku", "kuru", "suru", "i-adjective", "na-adjective",
|
||||
"ii", "desire", "volitional", "trick", "kana", "furigana_always"];
|
||||
|
||||
var selects = ["questionFocus"];
|
||||
|
||||
var result = {};
|
||||
|
||||
options.forEach(function (option) {
|
||||
result[option] = $('#' + option).is(':checked') != false;
|
||||
});
|
||||
|
||||
selects.forEach(function (select) {
|
||||
result[select] = $('#' + select).val();
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -732,6 +759,7 @@ $('window').ready(function () {
|
||||
$('#backToStart').click(showSplash);
|
||||
|
||||
$('div.options input').click(updateOptionSummary);
|
||||
$('select#questionFocus').on('change', updateOptionSummary);
|
||||
$('input#trick').click(updateOptionSummary);
|
||||
$('input#focus_mode').click(updateOptionSummary);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user