Add auto next question and auto explanation options

This commit is contained in:
toxinu 2021-10-10 20:51:14 +00:00
parent e57c18a4d9
commit bca1382230
2 changed files with 39 additions and 9 deletions

View File

@ -168,15 +168,30 @@
<div class="row justify-content-center mt-3 ml-2 mr-2">
<div class="form-group">
<div class="form-check"><input class="form-check-input" type="checkbox" id="trick" checked><label
class="form-check-label" for="trick">Trick questions (answers may be the same as the given form)</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="trick" checked>
<label class="form-check-label" for="trick">Trick questions (answers may be the same as the given form)</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="kana">
<label class="form-check-label" for="kana">Use hiragana throughout the test (no kanji)</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="furigana_always" checked>
<label class="form-check-label" for="furigana_always">Show furigana on questions</label>
</div>
<div class="form-check" id="goToNextQuestion">
<input class="form-check-input" type="checkbox" id="go_to_next_question">
<label class="form-check-label" for="go_to_next_question">Automatically go to the next question on success</label>
</div>
<div class="form-check" id="autoShowExplanatioj">
<input class="form-check-input" type="checkbox" id="auto_show_explanation">
<label class="form-check-label" for="auto_show_explanation">Automatically show the explanation on error</label>
</div>
<div class="form-check" id="useVoiceSection" style="display: none">
<input class="form-check-input" type="checkbox" id="use_voice">
<label class="form-check-label" for="use_voice">Use speech synthesis (experimental)</label>
</div>
<div class="form-check"><input class="form-check-input" type="checkbox" id="kana"><label
class="form-check-label" for="kana">Use hiragana throughout the test (no kanji)</label></div>
<div class="form-check"><input class="form-check-input" type="checkbox" id="furigana_always" checked><label
class="form-check-label" for="furigana_always">Show furigana on questions</label></div>
<div class="form-check" id="useVoiceSection" style="display: none"><input class="form-check-input" type="checkbox" id="use_voice"><label
class="form-check-label" for="use_voice">Use speech synthesis (experimental)</label></div>
</div>
</div>

View File

@ -9,7 +9,9 @@ const configOptions = {
options: ["plain", "polite", "negative", "past", "te-form", "progressive",
"potential", "imperative", "passive", "causative", "godan", "ichidan",
"iku", "kuru", "suru", "i-adjective", "na-adjective", "ii", "desire",
"volitional", "trick", "kana", "furigana_always", "use_voice"],
"volitional", "trick", "kana", "furigana_always", "use_voice", "go_to_next_question",
"auto_show_explanation",
],
selects: ["questionFocus"],
@ -40,6 +42,8 @@ const defaultConfig = {
"trick": true,
"kana": false,
"furigana_always": true,
"go_to_next_question": false,
"auto_show_explanation": false,
"use_voice": false,
"questionFocus": "none",
"numQuestions": "10"
@ -529,6 +533,7 @@ function generateQuestion() {
function processAnswer() {
var options = getOptions();
var questionData = window.questionData;
var response = $('#answer').val().trim();
@ -578,6 +583,16 @@ function processAnswer() {
$('#proceed button').focus();
updateHistoryView(log);
if (correct) {
if (options.go_to_next_question) {
proceed();
}
} else {
if (options.auto_show_explanation) {
$('#explanation').show();
}
}
}
function shakeInputArea() {