answer prompt flips between question options as ul and input text
parent
f750f055b7
commit
44c670b7db
|
|
@ -4,22 +4,24 @@
|
|||
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.css">-->
|
||||
<link rel="stylesheet" href="/light.css">
|
||||
<style>
|
||||
:not(#answers[hidden]) + #question {
|
||||
:not(#answers-list[hidden]) + #question,
|
||||
:not(#answers-list[hidden]) + #question + #answer-form,
|
||||
:not(#question-options:empty) + #answers-freeform
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</header>
|
||||
<body>
|
||||
<h1>Hello World</h1>
|
||||
<div id="answers">
|
||||
<ul id="answers-list"></ul>
|
||||
<form id="answers-form" action="#" onsubmit="submitAnswersForm(this); return false;">
|
||||
</form>
|
||||
</div>
|
||||
<div id="answers-list"></div>
|
||||
<div id="question">
|
||||
<h1><span id="question-text"></span></h1>
|
||||
<ul id="question-options"></ul>
|
||||
</div>
|
||||
<form id="answer-form" action="#" onsubmit="submitAnswersForm(this); return false;">
|
||||
<ul id="question-options"></ul>
|
||||
<input id="answers-freeform" type="text" hidden/>
|
||||
</form>
|
||||
</body>
|
||||
<footer>
|
||||
<script>
|
||||
|
|
@ -53,16 +55,16 @@
|
|||
|
||||
function pollLiveAnswer() {
|
||||
if (!g_live_question || !g_live_question.Closed) {
|
||||
document.getElementById("answers").hidden = true;
|
||||
document.getElementById("answers-list").hidden = true;
|
||||
return;
|
||||
}
|
||||
document.getElementById("answers").hidden = false;
|
||||
document.getElementById("answers-list").hidden = false;
|
||||
http("GET", `/api/v1/questions/${g_live_question.ID}/answers`, (body) => {
|
||||
let answers = JSON.parse(body);
|
||||
let result = "";
|
||||
for (let i of answers)
|
||||
result += `<li>${i.Text}</li>`;
|
||||
document.getElementById("answers-list").innerHTML = result;
|
||||
document.getElementById("answers-list").innerHTML = `<ul>${result}</ul>`;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue