Add support for adding score
This commit is contained in:
@@ -51,6 +51,11 @@
|
||||
<figure class="participant ${!p.active ? 'hide': ''}" id="p-${p.participantId}">
|
||||
<img src="${p.character}" />
|
||||
<figcaption>${p.participantName}</figcaption>
|
||||
<div>
|
||||
<button onclick="updateScore('${p.participantId}', -1)">-1</button>
|
||||
<div class="score">${p.score || 0}</div>
|
||||
<button onclick="updateScore('${p.participantId}', 1)">+1</button>
|
||||
</div>
|
||||
</figure>
|
||||
`;
|
||||
});
|
||||
@@ -63,6 +68,14 @@
|
||||
window.navigator.vibrate(500);
|
||||
}
|
||||
|
||||
function updateScore(participantId, points) {
|
||||
socket.send(JSON.stringify({
|
||||
type: "point",
|
||||
participantId,
|
||||
points,
|
||||
}));
|
||||
}
|
||||
|
||||
document.getElementById('resetBuzzers').addEventListener('click', function() {
|
||||
socket.send(JSON.stringify({
|
||||
type: "reset"
|
||||
|
Reference in New Issue
Block a user