display questions
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
split("").
|
||||
reverse().
|
||||
join("")
|
||||
).toString(36);
|
||||
console.log("session", session);
|
||||
).toString(36)
|
||||
console.log("session", session)
|
||||
</script>
|
||||
</header>
|
||||
<body>
|
||||
@@ -20,6 +20,7 @@
|
||||
<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">
|
||||
@@ -28,36 +29,45 @@
|
||||
</body>
|
||||
<footer>
|
||||
<script>
|
||||
let knowledgebase = {{ASSIGNMENTS_JSON}};
|
||||
let knowledgebase = {{ASSIGNMENTS_JSON}}
|
||||
knowledgebase = Object.
|
||||
keys(knowledgebase).
|
||||
map((key) => [
|
||||
[key, knowledgebase[key]]
|
||||
]);
|
||||
])
|
||||
|
||||
function nextQuestion(form) {
|
||||
form.children.answer.value = "";
|
||||
let todo = knowledgebase.pop();
|
||||
form.children.answer.value = ""
|
||||
let todo = knowledgebase.pop()
|
||||
if (!todo) {
|
||||
todo = [0];
|
||||
todo = [0]
|
||||
}
|
||||
todo = todo[0];
|
||||
todo = todo[0]
|
||||
if (! todo) {
|
||||
todo = ["", {Q: "ALL DONE"}];
|
||||
todo = ["", {Q: "ALL DONE"}]
|
||||
}
|
||||
|
||||
form.children.idq.value = todo[0];
|
||||
form.children.idq.value = todo[0]
|
||||
|
||||
form.children.question.innerHTML = `<h3>${todo[1].Q}</h3>`
|
||||
|
||||
console.log(todo[1]);
|
||||
form.children.question.innerHTML = `<h3>${todo[1].Q}</h3>`;
|
||||
let clues = ""
|
||||
for (var i of todo[1].Clues) {
|
||||
clues += `<br>${i}`
|
||||
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.innerHTML = clues
|
||||
|
||||
let solution = ""
|
||||
for (var i in todo[1].Solution) {
|
||||
solution += `<br>${todo[1].Solution[i]}`
|
||||
}
|
||||
if (solution) {
|
||||
solution = `<details><summary>solution</summary>${solution}</details>`
|
||||
}
|
||||
form.children.solution.innerHTML = solution
|
||||
}
|
||||
|
||||
nextQuestion(document.getElementById("flash"));
|
||||
nextQuestion(document.getElementById("flash"))
|
||||
</script>
|
||||
</footer>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user