diff --git a/public/buzzer.html b/public/buzzer.html index 7b19ab6..150fca2 100644 --- a/public/buzzer.html +++ b/public/buzzer.html @@ -10,16 +10,39 @@
Monitor
- - - + + +
- - + + +
+
+
@@ -48,19 +71,25 @@ player name
(points pts) (tokens tks) -
+
diff --git a/public/monitor.js b/public/monitor.js index 36ae963..5c36589 100644 --- a/public/monitor.js +++ b/public/monitor.js @@ -128,6 +128,7 @@ function setup_ws() { me, monitored = [] const sid = session_id() + const overlay = q('#text-overlay') conn = new Connection() conn.on("helo", () => { conn.send("name", "Monitor") @@ -149,10 +150,17 @@ function setup_ws() { clients[client.id] = client redraw_clients(clients, monitored) }) - conn.on("control", ({ value: {payload: {action, targets}} }) => { - if (action === 'monitor' && Array.isArray(targets)) { - monitored = targets + conn.on("control", ({ value: {payload: {action, ...args}} }) => { + if (action === 'monitor' && Array.isArray(args.targets)) { + monitored = args.targets redraw_clients(clients, monitored) + } else if (action === 'text' && args.text !== undefined) { + if (args.text.length) { + overlay.textContent = args.text + overlay.classList.remove('hidden') + } else { + overlay.classList.add('hidden') + } } }) conn.connect(session_url(sid))