add buzz sounds

This commit is contained in:
ducklet 2021-02-25 22:54:56 +01:00
parent e7ecde32a2
commit a97f258348
9 changed files with 44 additions and 14 deletions

View file

@ -210,24 +210,36 @@ function enable_admin_ui() {
{ target: q("#points-admin") },
)
const client_for_target = (target) => {
let node = target
while (!node.dataset.cid && node.parentElement) {
node = node.parentElement
}
return find_client(node.dataset.cid)
}
on(
"click",
({ target }) => {
let node = target
while (!node.dataset.cid && node.parentElement) {
node = node.parentElement
}
if (!target.dataset.onclick) {
return
}
const client = find_client(node.dataset.cid)
if (!client) {
const client = client_for_target(target)
if (!client || !target.dataset.onclick) {
return
}
eval(`;{${target.dataset.onclick}};`)
},
{ target: q("#info .players") },
)
on(
"change",
({ target }) => {
const client = client_for_target(target)
if (!client || !target.dataset.onchange) {
return
}
eval(`;{${target.dataset.onchange}};`)
},
{ target: q("#info .players") },
)
}
function set_name(name) {