diff --git a/web/quiz.js b/web/quiz.js index 1eb07f6..c8cb267 100644 --- a/web/quiz.js +++ b/web/quiz.js @@ -90,7 +90,7 @@ function updateSubmitInfo() { if (getRule('allowQOvertime')) si.innerHTML = ('Losing bonus points in ' + formatTime(state.submitTimer)) else - si.innerHTML = ('Forced hand-in in ' + formatTime(state.submitTimer)) + si.innerHTML = ( 'Question failed in ' + formatTime(state.submitTimer)) } else { if (getRule('allowQOvertime')) document.getElementById('submitinfo').innerHTML = 'Bonus points lost.' @@ -103,6 +103,23 @@ function updateSubmitInfo() { } +function resetQuestionResponse(qn) { + var q = document.querySelector('#quiz form #question' + qn) + var inputs = q.querySelectorAll('input') + + for (input of inputs) { + switch (input.type) { + case 'radio': + case 'checkbox': + input.checked = false + break; + case 'text': + input.value = "" + break; + } + } +} + function updateSubmitTimer() { if (state.submitTimer > 0) @@ -113,8 +130,10 @@ function updateSubmitTimer() { clearInterval(state.submitInterval) if (getRule('questionTimeout')) - if (state.waitNextQuestion || !getRule('allowQOvertime')) + if (state.waitNextQuestion || !getRule('allowQOvertime')) { + resetQuestionResponse(state.currentQuestion); submitQuiz() // Force next question + } }