Some style tweaks

This commit is contained in:
2020-11-27 18:38:56 +00:00
parent aad99975c6
commit 623b53d542
3 changed files with 44 additions and 19 deletions

View File

@@ -14,16 +14,18 @@
</header>
<main>
<p>
<blockquote>
Share this link for players to join:<br>
<a id="playerRoom" href=""></a>
</p>
<button id="resetBuzzers">Reset</button>
</blockquote>
<h2>Participants</h2>
<div id="participants"></div>
<button id="resetBuzzers">Reset Buzzers</button>
<div id="participants">
No participants yet :(
</div>
</main>
<script>
@@ -42,16 +44,18 @@
buzzed.classList.add('buzzed');
} else if (msg.type === "participants") {
let participantContainer = document.getElementById('participants');
let contents = '';
msg.participants.forEach(p => {
contents += `
<figure class="participant ${!p.active ? 'hide': ''}" id="p-${p.participantId}">
<img src="${p.character}" />
<figcaption>${p.participantName}</figcaption>
</figure>
`;
});
participantContainer.innerHTML = contents;
if (msg.participants.length) {
let contents = '';
msg.participants.forEach(p => {
contents += `
<figure class="participant ${!p.active ? 'hide': ''}" id="p-${p.participantId}">
<img src="${p.character}" />
<figcaption>${p.participantName}</figcaption>
</figure>
`;
});
participantContainer.innerHTML = contents;
}
}
};