Notices + simpler example theme content

This commit is contained in:
Neale Pickett 2019-11-10 16:21:50 -07:00
parent aeadde8e17
commit 4f3c3fbd04
3 changed files with 276 additions and 10 deletions

View File

@ -10,7 +10,9 @@
<body> <body>
<h1 id="title">MOTH</h1> <h1 id="title">MOTH</h1>
<section> <section>
<div id="messages"></div> <div id="messages">
<div id="notices"></div>
</div>
<form id="login"> <form id="login">
<!-- <!--

View File

@ -14,6 +14,13 @@ function toast(message, timeout=5000) {
) )
} }
function renderNotices(obj) {
let ne = document.getElementById("notices")
if (ne) {
ne.innerHTML = obj
}
}
function renderPuzzles(obj) { function renderPuzzles(obj) {
let puzzlesElement = document.createElement('div') let puzzlesElement = document.createElement('div')
@ -78,6 +85,17 @@ function renderPuzzles(obj) {
} }
function heartbeat(teamId, participantId) { function heartbeat(teamId, participantId) {
let noticesUrl = new URL("notices.html", window.location)
fetch(noticesUrl)
.then(resp => {
if (resp.ok) {
resp.text()
.then(renderNotices)
.catch(err => console.log)
}
})
.catch(err => console.log)
let url = new URL("puzzles.json", window.location) let url = new URL("puzzles.json", window.location)
url.searchParams.set("id", teamId) url.searchParams.set("id", teamId)
if (participantId) { if (participantId) {

File diff suppressed because one or more lines are too long