diff --git a/web/index.html b/web/index.html index e7cd67f..cd0e726 100644 --- a/web/index.html +++ b/web/index.html @@ -33,7 +33,7 @@ Title:
Style:
- @@ -42,6 +42,28 @@ +
+ Paste your questions from a spreadsheet here:

diff --git a/web/quiz.js b/web/quiz.js index f539cab..57f0329 100644 --- a/web/quiz.js +++ b/web/quiz.js @@ -134,7 +134,7 @@ function reStartQuiz() { state.totalTimer = 0 state.submitTimer = 0 - state.success = 0 + state.success = false startQuiz() @@ -153,6 +153,9 @@ function createQuiz(e) { state.title = document.getElementById('titleField').value state.style = document.getElementById('styleField').value + // After state.style is set + applyRuleSettingsFromForm() + if (parseSpreadsheet().success == false) { alert('Quiz creation failed.') return @@ -164,7 +167,8 @@ function createQuiz(e) { changeView('prescreen') - console.log('Quiz created') + console.log('Quiz created:') + console.log(state) return false diff --git a/web/style.css b/web/style.css index 530fb60..7868f38 100644 --- a/web/style.css +++ b/web/style.css @@ -89,7 +89,7 @@ input[type="button"]:disabled, input[type="submit"]:disabled { background: #888 !important; } -textarea, input[type="text"], select { +input[type="text"], input[type="number"], textarea, select { background: #ddd; margin-bottom: 16px; padding: .5em; diff --git a/web/util.js b/web/util.js index 2600e34..8941410 100644 --- a/web/util.js +++ b/web/util.js @@ -3,7 +3,9 @@ const defaultState = { id: null, title: null, questions: [], - success: 0, + success: false, + submitTries: 1, + submits: 0, submitTime: null, submitTimer: 0, submitInterval: null, @@ -32,7 +34,7 @@ function updateTitles() { } -const rules = { +var rules = { __default__: { sequential: false, submitTries: 1, @@ -66,6 +68,23 @@ function getRule(name) { } +function applyRuleSettingsFromForm() { + + switch (state.style) { + case 'FSG': + case 'FSA': + state.questionTime = parseInt(document.getElementById('qTimeField').value) + break + case 'FSCzech': + state.submitTime = parseInt(document.getElementById('sTOutField').value) + break + case 'FSSpain': + state.submitTries = parseInt(document.getElementById('sTriesField').value) + break + } + +} + function changeView(view) {