diff --git a/public/buzzer.html b/public/buzzer.html
index 8a98e6e..43afeeb 100644
--- a/public/buzzer.html
+++ b/public/buzzer.html
@@ -8,7 +8,11 @@
@@ -56,10 +72,15 @@
id="username"
placeholder="Please put your name here ..."
data-onchange="q('#set-name').disabled = false"
- />set name
+ "
+ >
+ set name
+
@@ -85,7 +106,8 @@
player name
(
points pts) (
tokens tks)
-
+ conn.send('control', {targets: monitored, action: 'monitor'})"
+ >
monitor
add tokens
-
+ "
+ >
-
bark
chirp
diff --git a/public/index.html b/public/index.html
index f636389..32ca6e8 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,18 +1,34 @@
Qui z
diff --git a/public/monitor.js b/public/monitor.js
index b753665..12db086 100644
--- a/public/monitor.js
+++ b/public/monitor.js
@@ -59,7 +59,7 @@ function _redraw_clients(clients, monitored) {
const player_tpl = q("template#player").content.firstElementChild
for (const cid of monitored) {
- const c = clients[cid] ?? {id: cid, name:'', points:0, tokens:0}
+ const c = clients[cid] ?? { id: cid, name: "", points: 0, tokens: 0 }
let player_el = q(`.player[data-cid='${c.id}']`)
if (player_el) {
// Ensure the element is at the correct position.
@@ -129,7 +129,7 @@ function setup_ws() {
monitored = [],
sounds = {}
const sid = session_id()
- const overlay = q('#text-overlay')
+ const overlay = q("#text-overlay")
conn = new Connection()
conn.on("helo", () => {
conn.send("name", "Monitor")
@@ -154,22 +154,29 @@ function setup_ws() {
clients[client.id] = client
redraw_clients(clients, monitored)
})
- 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.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")
+ }
+ } else if (action === "sound" && args.sound) {
+ const { client_id, sound } = args
+ sounds[client_id] = new Audio(`sounds/${sound}.mp3`)
}
- } else if (action === 'sound' && args.sound) {
- const { client_id, sound } = args
- sounds[client_id] = new Audio(`sounds/${sound}.mp3`)
- }
- })
+ },
+ )
conn.connect(session_url(sid))
}