-
diff --git a/web/quiz.js b/web/quiz.js
index 2c4a5aa..f539cab 100644
--- a/web/quiz.js
+++ b/web/quiz.js
@@ -51,7 +51,9 @@ function updateSubmitTimer() {
function startSubmitTimer(time) {
- state.submitTimer = time || 30
+ state.submitTimer = time || state.submitTime
+ if (state.submitTimer == null)
+ return
console.log('Setting submitTimer to ' + state.submitTimer + ' seconds.')
@@ -139,21 +141,20 @@ function reStartQuiz() {
}
-function createQuiz() {
+function createQuiz(e) {
+
+ e.preventDefault()
console.log('Creating new quiz')
- state.title = document.getElementById('titleField').value
- if (state.title == '') {
- alert('Please enter a title')
- return
- }
-
clearState()
removeLink()
+ state.title = document.getElementById('titleField').value
+ state.style = document.getElementById('styleField').value
+
if (parseSpreadsheet().success == false) {
- console.log('Quiz creation failed.')
+ alert('Quiz creation failed.')
return
}
@@ -165,6 +166,8 @@ function createQuiz() {
console.log('Quiz created')
+ return false
+
}
diff --git a/web/style.css b/web/style.css
index b78c003..530fb60 100644
--- a/web/style.css
+++ b/web/style.css
@@ -63,12 +63,12 @@ form {
text-align: left !important;
}
-textarea, input {
+textarea, input, select {
margin-top: 8px;
border-radius: 3px;
}
-input[type="button"] {
+input[type="button"], input[type="submit"] {
float: right;
cursor: pointer;
margin: 16px 0 16px 16px;
@@ -80,16 +80,16 @@ input[type="button"] {
font-weight: bold;
}
-input[type="button"].center {
+input[type="button"].center, input[type="submit"].center {
float: none;
}
-input[type="button"]:disabled {
+input[type="button"]:disabled, input[type="submit"]:disabled {
cursor: auto;
background: #888 !important;
}
-textarea, input[type="text"] {
+textarea, input[type="text"], select {
background: #ddd;
margin-bottom: 16px;
padding: .5em;
diff --git a/web/util.js b/web/util.js
index 1f34a2b..2600e34 100644
--- a/web/util.js
+++ b/web/util.js
@@ -4,10 +4,14 @@ const defaultState = {
title: null,
questions: [],
success: 0,
+ submitTime: null,
submitTimer: 0,
submitInterval: null,
totalTimer: 0,
totalInterval: null,
+ questionTime: null,
+ questionTimer: 0,
+ questionInterval: null,
}
var state
@@ -28,6 +32,41 @@ function updateTitles() {
}
+const rules = {
+ __default__: {
+ sequential: false,
+ submitTries: 1,
+ submitTimeout: null,
+ timedQs: false,
+ allowQOvertime: false
+ },
+ 'FSG' : { sequential: true, timedQs: true },
+ 'FSA' : { sequential: true, timedQs: true, allowQOvertime: true },
+ 'FSN' : { sequential: true },
+ 'FSEast' : { sequential: false },
+ 'FSCzech' : { sequential: false, submitTries: Infinity, submitTimeout: 30 },
+ 'FSSpain' : { sequential: true, submitTries: 3 },
+ 'FSSwitzerland' : { sequential: true },
+}
+
+function getRule(name) {
+
+ var r = rules[state.style]
+
+ if (r.hasOwnProperty(name))
+ return r[name]
+
+ var d = rules.__default__
+ if (d.hasOwnProperty(name))
+ return d[name]
+
+ console.error('No such rule:', name);
+
+ return undefined
+
+}
+
+
function changeView(view) {
for (el of document.querySelectorAll('.view'))