quiz/public/buzzer.html

102 lines
3.5 KiB
HTML
Raw Normal View History

<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="buzzer.css" />
<body class="player">
<div id="error">
Error:
<code></code>
</div>
<div id="points-admin" class="admin-only">
<h2>Admin</h2>
<div><a href="monitor.html" onclick="this.href='monitor.html'+location.hash">Monitor</a></div>
<div>
<label>points: <input type="number" name="points" value="0" /></label>
<button data-onclick="named.points.valueAsNumber += 100">+ 100</button>
<button data-onclick="named.points.valueAsNumber -= 100">- 100</button>
<button data-onclick="named.points.valueAsNumber *= -1">+/-</button>
</div>
<div>
<label>tokens: <input type="number" name="tokens" value="0" /></label>
</div>
<div>
<label>monitored:
<input type="text" name="monitored1" value="" />
<input type="text" name="monitored2" value="" />
<input type="text" name="monitored3" value="" />
</label>
<button data-onclick="conn.send('control', {targets: [
named.monitored1.value,
named.monitored2.value,
named.monitored3.value,
], action: 'monitor'})">resubmit</button>
</div>
<div>
<label>text overlay:
<textarea name="textbox" data-onselect="
const text = target.value.substring(
target.selectionStart,
target.selectionEnd
) || ''
conn.send('control', {action: 'text', text})
" data-onchange="
if (!target.value.length) {
conn.send('control', {action: 'text', text: ''})
}
"></textarea>
</label>
</div>
</div>
<div id="info">
<label class="myname player-only"
>You:
<input
type="text"
name="username"
id="username"
placeholder="Please put your name here ..."
/></label>
<h2>All Players</h2>
<ul class="players">
<!-- players (see template#player) will be inserted here -->
</ul>
</div>
<div id="buzzbox" class="player-only">
<p id="active">BZZZZZ!</p>
<p id="ready">Press <strong id="bkey">{key.name}</strong> to activate buzzer.</p>
<p id="inactive">Please focus the window to allow the buzzer to work.</p>
</div>
</body>
<template id="player">
<li class="player" data-cid="client ID">
<span class="name">player name</span>
<div class="admin-only">
(<span class="points">points</span> pts) (<span class="tokens">tokens</span> tks)
<button data-onclick="(!named.monitored1.value.length ? named.monitored1 :
(!named.monitored2.value.length ? named.monitored2 :
named.monitored3)).value = client.id;
let monitored = [
named.monitored1.value,
named.monitored2.value,
named.monitored3.value,
];
conn.send('control', {targets: monitored, action: 'monitor'})">
monitor
</button>
<button
data-onclick="client.points += named.points.valueAsNumber;
2021-02-02 21:41:22 +01:00
conn.send('points', {id: client.id, points: client.points})"
>
add points
</button>
<button
data-onclick="client.tokens += named.tokens.valueAsNumber;
2021-02-02 21:41:22 +01:00
conn.send('tokens', {id: client.id, tokens: client.tokens})"
>
add tokens
</button>
</div>
</li>
</template>
<script type="module" src="./buzzer.js"></script>