2 Commits

Author SHA1 Message Date
Bel LaPointe
64e992c6b6 shuffle http 2023-04-07 14:01:52 -06:00
Bel LaPointe
0fd0981a39 Q can be image in http 2023-04-07 13:56:04 -06:00

View File

@@ -17,6 +17,7 @@
<body>
<!--{{USER}}-->
<form id="flash" action="">
<h1 name="status"></h1>
<input type="text" name="idq" readonly=true value="" style="display: none;">
<div name="question"></div>
<div name="clues"></div>
@@ -36,6 +37,18 @@
map((key) => [
[key, knowledgebase[key]]
])
function shuffle(array) {
let currentIndex = array.length, randomIndex;
while (currentIndex != 0) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}
return array;
}
shuffle(knowledgebase)
console.log(0, knowledgebase)
function passQuestion(form) {
@@ -92,9 +105,15 @@
todo = ["", {Q: "ALL DONE"}]
}
form.children.status.innerHTML = knowledgebase.length.toString()
form.children.idq.value = todo[0]
form.children.question.innerHTML = `<h3>${todo[1].Q}</h3>`
if (todo[1].Q.startsWith("img:")) {
form.children.question.innerHTML = `<img src="static/${todo[1].Q.slice(4, 1000)}"/>`
} else {
form.children.question.innerHTML = `<h3>${todo[1].Q}</h3>`
}
form.children.question.value = todo[1].Q
let clues = ""