ok ui can rotate questions
parent
1816500617
commit
80d987b69e
|
|
@ -16,14 +16,15 @@
|
|||
</header>
|
||||
<body>
|
||||
<!--{{USER}}-->
|
||||
<form id="flash" action="" onsubmit="return false; trySolve(this.children.idq.value, this.children.answer.value); return false;">
|
||||
<form id="flash" action="">
|
||||
<input type="text" name="idq" readonly=true value="" style="display: none;">
|
||||
<div name="question"></div>
|
||||
<div name="clues"></div>
|
||||
<div name="solution"></div>
|
||||
<input type="button" value="clue">
|
||||
<input type="text" name="answer">
|
||||
<input type="submit" value="submit">
|
||||
<input type="button" value="pass" onclick="passQuestion(this.parentElement)">
|
||||
<input type="button" value="fail" onclick="failQuestion(this.parentElement)">
|
||||
<input type="button" value="skip" onclick="nextQuestion(this.parentElement)">
|
||||
</form>
|
||||
</body>
|
||||
|
|
@ -35,10 +36,35 @@
|
|||
map((key) => [
|
||||
[key, knowledgebase[key]]
|
||||
])
|
||||
console.log(0, knowledgebase)
|
||||
|
||||
function passQuestion(form) {
|
||||
pushAnswer(form.children.idq.value, form.children.answer.value, true)
|
||||
nextQuestion(form)
|
||||
}
|
||||
|
||||
function failQuestion(form) {
|
||||
pushAnswer(form.children.idq.value, form.children.answer.value, false)
|
||||
console.log(1, knowledgebase)
|
||||
knowledgebase.push([[
|
||||
form.children.idq.value,
|
||||
{
|
||||
Q: form.children.question.value,
|
||||
Clues: form.children.clues.value,
|
||||
Solution: form.children.solution.value,
|
||||
},
|
||||
]])
|
||||
console.log(2, knowledgebase)
|
||||
nextQuestion(form)
|
||||
}
|
||||
|
||||
function pushAnswer(idq, answer, passed) {
|
||||
console.log(idq, answer, passed)
|
||||
}
|
||||
|
||||
function nextQuestion(form) {
|
||||
form.children.answer.value = ""
|
||||
let todo = knowledgebase.pop()
|
||||
let todo = knowledgebase.shift()
|
||||
if (!todo) {
|
||||
todo = [0]
|
||||
}
|
||||
|
|
@ -50,12 +76,14 @@
|
|||
form.children.idq.value = todo[0]
|
||||
|
||||
form.children.question.innerHTML = `<h3>${todo[1].Q}</h3>`
|
||||
form.children.question.value = todo[1].Q
|
||||
|
||||
let clues = ""
|
||||
for (var i in todo[1].Clues) {
|
||||
clues += `<details><summary>clue #${i}</summary>${todo[1].Clues[i]}</details>`
|
||||
}
|
||||
form.children.clues.innerHTML = clues
|
||||
form.children.clues.value = todo[1].Clues
|
||||
|
||||
let solution = ""
|
||||
for (var i in todo[1].Solution) {
|
||||
|
|
@ -65,6 +93,7 @@
|
|||
solution = `<details><summary>solution</summary>${solution}</details>`
|
||||
}
|
||||
form.children.solution.innerHTML = solution
|
||||
form.children.solution.value = todo[1].Solution
|
||||
}
|
||||
|
||||
nextQuestion(document.getElementById("flash"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue