Compare commits

..

3 Commits

2 changed files with 15 additions and 15 deletions

View File

@@ -186,7 +186,6 @@
<div class="side-btn-group"> <div class="side-btn-group">
<button class="btn btn-g btn-full" id="mod-round-btn" onclick="toggleRound()">▶ OPEN ROUND</button> <button class="btn btn-g btn-full" id="mod-round-btn" onclick="toggleRound()">▶ OPEN ROUND</button>
<button class="btn btn-ghost btn-full" id="mod-resume-btn" style="display:none;" onclick="resumeRound()">▶ RESUME ROUND</button> <button class="btn btn-ghost btn-full" id="mod-resume-btn" style="display:none;" onclick="resumeRound()">▶ RESUME ROUND</button>
<button class="btn btn-yellow btn-full" onclick="resetBuzzer()">↺ RESET BUZZER</button>
</div> </div>
</div> </div>

View File

@@ -86,8 +86,8 @@ function handle(msg){
break; break;
case 'round_closed': case 'round_closed':
room=msg.room; room=msg.room;
if(role==='mod'){renderMod();renderRoundButtons();} if(role==='mod'){renderMod();renderRoundButtons();toast('ROUND CLOSED','warn');}
else{renderPlayerBuzzer();stopPlayerTimer();toast('ROUND CLOSED','warn');} else{renderPlayerBuzzer();stopPlayerTimer();}
break; break;
case 'buzzer_reset': case 'buzzer_reset':
room=msg.room; room=msg.room;
@@ -342,11 +342,12 @@ function broadcastTimerToPlayers(sec,running){
// MOD ROUND CONTROL // MOD ROUND CONTROL
// ══════════════════════════════════════════════════════ // ══════════════════════════════════════════════════════
function toggleRound(){ function toggleRound(){
if(room.buzzerState.roundOpen){ // Reset buzzer and open round
ws_send({type:'close_round'}); ws_send({type:'open_round'});
} else { // Change button to pause state
ws_send({type:'open_round'}); const btn=document.getElementById('mod-round-btn');
} btn.innerHTML='■ PAUSE ROUND';
btn.className='btn btn-red btn-full';
} }
function resumeRound(){ function resumeRound(){
@@ -354,17 +355,17 @@ function resumeRound(){
} }
function renderRoundButtons(){ function renderRoundButtons(){
const openBtn=document.getElementById('mod-round-btn'); const btn=document.getElementById('mod-round-btn');
const resumeBtn=document.getElementById('mod-resume-btn'); const resumeBtn=document.getElementById('mod-resume-btn');
if(room.buzzerState.roundOpen){ if(room.buzzerState.roundOpen){
openBtn.innerHTML='■ CLOSE ROUND'; btn.innerHTML='■ PAUSE ROUND';
openBtn.className='btn btn-red btn-full'; btn.className='btn btn-red btn-full';
resumeBtn.style.display='block';
} else {
openBtn.innerHTML='▶ OPEN ROUND';
openBtn.className='btn btn-g btn-full';
resumeBtn.style.display='none'; resumeBtn.style.display='none';
} else {
btn.innerHTML='▶ OPEN ROUND';
btn.className='btn btn-g btn-full';
resumeBtn.style.display='block';
} }
} }