64 lines
1.8 KiB
HTML
64 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<header>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
|
|
<script>
|
|
let session = Number(
|
|
Date.
|
|
now().
|
|
toString().
|
|
split("").
|
|
reverse().
|
|
join("")
|
|
).toString(36);
|
|
console.log("session", session);
|
|
</script>
|
|
</header>
|
|
<body>
|
|
<!--{{USER}}-->
|
|
<form id="flash" action="" onsubmit="return false; trySolve(this.children.idq.value, this.children.answer.value); return false;">
|
|
<input type="text" name="idq" readonly=true value="" style="display: none;">
|
|
<div name="question"></div>
|
|
<div name="clues"></div>
|
|
<input type="button" value="clue">
|
|
<input type="text" name="answer">
|
|
<input type="submit" value="submit">
|
|
<input type="button" value="skip" onclick="nextQuestion(this.parentElement)">
|
|
</form>
|
|
</body>
|
|
<footer>
|
|
<script>
|
|
let knowledgebase = {{ASSIGNMENTS_JSON}};
|
|
knowledgebase = Object.
|
|
keys(knowledgebase).
|
|
map((key) => [
|
|
[key, knowledgebase[key]]
|
|
]);
|
|
|
|
function nextQuestion(form) {
|
|
form.children.answer.value = "";
|
|
let todo = knowledgebase.pop();
|
|
if (!todo) {
|
|
todo = [0];
|
|
}
|
|
todo = todo[0];
|
|
if (! todo) {
|
|
todo = ["", {Q: "ALL DONE"}];
|
|
}
|
|
|
|
form.children.idq.value = todo[0];
|
|
|
|
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}`
|
|
}
|
|
form.children.clues.innerHTML = clues;
|
|
}
|
|
|
|
nextQuestion(document.getElementById("flash"));
|
|
</script>
|
|
</footer>
|
|
</html>
|