From b8527e870c75d31d04b3e4673b51a14260fc9557 Mon Sep 17 00:00:00 2001 From: bitscuit Date: Fri, 30 Dec 2022 21:09:25 +0100 Subject: [PATCH] added logic to display answer preview --- html/index.html | 5 +++++ main.js | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/html/index.html b/html/index.html index cc5e75a..aec3be5 100644 --- a/html/index.html +++ b/html/index.html @@ -213,6 +213,11 @@ socket.on("WRITE", function(data){ page += "

Question "+data.questionNr+" of "+data.questionsTotal+"

"; page += "

"+data.question+"

"; + + if(data.answerPreview !== null){ + page += "

One of the existing answers is:
"+data.answerPreview+"

"; + } + page += "

Enter a false answer.

"; page += "
"; page += ""; diff --git a/main.js b/main.js index 1b311c6..482fbd3 100644 --- a/main.js +++ b/main.js @@ -349,8 +349,21 @@ function next(){ // Save data questionData = json.results[0]; + questionAnswers = [questionData.correct_answer]; + for(var i=0; i