Skip to content

Commit

Permalink
Add question details to display #231
Browse files Browse the repository at this point in the history
  • Loading branch information
tisboyo committed Sep 11, 2021
1 parent 6defa35 commit 2bbf098
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bot/mods/trivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def check_send_time(seconds_into_trivia: int):
"image": self.active_question.id if self.active_question.image is None else self.active_question.image,
"sound": self.active_question.id if self.active_question.sound is None else self.active_question.sound,
"active": True,
"question_num": self.questions_into_trivia,
}
# Pad out the answers if there are less than 4 so the spacing is correct on the front end
if len(mqtt_question_setup["answers"]) < min_number_of_questions_to_send:
Expand Down Expand Up @@ -328,7 +329,8 @@ async def trivia_start(self, msg: Message, debug=False):
"text": "",
"choices": [],
"answers": {},
"id": "default",
"id": "",
"question_num": "",
"active": True,
"image": "thumb-for-twitch",
"sound": 0,
Expand Down
10 changes: 10 additions & 0 deletions web/static_files/trivia/play.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ body {
max-width:100%;
}


.big-boi-container {
font-size: 1em;
position: relative;
Expand Down Expand Up @@ -197,7 +198,16 @@ body {
margin-top: 5%;
margin-right: 5%;
}
#questioninfo{
text-align:left;
position: absolute;
color:white;
font: 0.5em;
top: 950px;
right: 1100px;
width: 150px;

}
#footer-div {
margin: auto;
width: 80%;
Expand Down
6 changes: 5 additions & 1 deletion web/static_files/trivia/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
let box = document.createElement('div');
let picturebox = document.createElement('div');

let questioninfo = document.createElement('div');
questioninfo.setAttribute('id', 'questioninfo');
questioninfo.innerHTML = data.question_num + " " + data.id;
big_boi.appendChild(questioninfo);

if (Object.keys(data.answers).length) {

Expand Down Expand Up @@ -276,7 +280,7 @@

if (document.visibilityState === 'visible') {
//navigator.sendBeacon('/trivia/start?key=' + params.key);
var Httpreq = new XMLHttpRequest(); // a new request
//var Httpreq = new XMLHttpRequest(); // a new request
var url = "start?key=" + params.key;
if (params.debug) {
url = url + "&debug=" + params.debug
Expand Down

0 comments on commit 2bbf098

Please sign in to comment.