|
157 | 157 | border-top: 1px solid rgba(255,255,255,0.12); padding-top: 6px; |
158 | 158 | } |
159 | 159 |
|
| 160 | + .stop-btn { |
| 161 | + padding: 10px 28px; font-size: 14px; font-weight: 800; |
| 162 | + background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.3); |
| 163 | + color: white; border-radius: 24px; cursor: pointer; |
| 164 | + transition: background 0.15s; |
| 165 | + } |
| 166 | + .stop-btn:hover { background: rgba(255,255,255,0.22); } |
| 167 | + .stop-btn.next-mode { |
| 168 | + background: rgba(99,102,241,0.35); border-color: #818cf8; |
| 169 | + } |
| 170 | + |
160 | 171 | /* ── Result ── */ |
161 | 172 | #result .trophy { font-size: 72px; text-align: center; margin: 16px 0 8px; } |
162 | 173 | #result h2 { font-size: 26px; font-weight: 900; text-align: center; margin-bottom: 6px; } |
@@ -248,6 +259,9 @@ <h3>Mixed (Both Types)</h3> |
248 | 259 | <button class="confirm-btn" id="confirmBtn" onclick="confirmMulti()" disabled>Confirm ✓</button> |
249 | 260 | </div> |
250 | 261 | <div class="feedback" id="feedback"></div> |
| 262 | + <div id="stopBar" style="display:none;text-align:center;margin-top:10px"> |
| 263 | + <button class="stop-btn" id="stopBtn" onclick="stopAutoAdvance()">⏸ Pause · Next →</button> |
| 264 | + </div> |
251 | 265 | </div> |
252 | 266 |
|
253 | 267 | <!-- ── RESULT ── --> |
@@ -359,6 +373,9 @@ <h2 id="rTitle"></h2> |
359 | 373 | function loadQuestion() { |
360 | 374 | multiSelected = new Set(); |
361 | 375 | clearInterval(timerInterval); |
| 376 | + clearTimeout(autoTimer); autoTimer = null; |
| 377 | + document.getElementById('stopBar').style.display = 'none'; |
| 378 | + document.getElementById('stopBtn').onclick = stopAutoAdvance; |
362 | 379 | timeLeft = 30; |
363 | 380 |
|
364 | 381 | const q = QUIZ_Q[currentIdx]; |
@@ -478,13 +495,38 @@ <h2 id="rTitle"></h2> |
478 | 495 |
|
479 | 496 | document.getElementById('scoreTop').textContent = score; |
480 | 497 |
|
481 | | - setTimeout(()=>{ |
| 498 | + // Show pause/next bar and start auto-advance timer |
| 499 | + const stopBar = document.getElementById('stopBar'); |
| 500 | + const stopBtn = document.getElementById('stopBtn'); |
| 501 | + stopBar.style.display = 'block'; |
| 502 | + stopBtn.className = 'stop-btn'; |
| 503 | + stopBtn.textContent = '⏸ Pause · Next →'; |
| 504 | + |
| 505 | + autoTimer = setTimeout(() => { |
| 506 | + stopBar.style.display = 'none'; |
482 | 507 | currentIdx++; |
483 | 508 | if (currentIdx < QUIZ_Q.length) loadQuestion(); |
484 | 509 | else showResult(); |
485 | 510 | }, 2500); |
486 | 511 | } |
487 | 512 |
|
| 513 | +let autoTimer = null; |
| 514 | + |
| 515 | +function stopAutoAdvance() { |
| 516 | + clearTimeout(autoTimer); |
| 517 | + autoTimer = null; |
| 518 | + const stopBtn = document.getElementById('stopBtn'); |
| 519 | + stopBtn.className = 'stop-btn next-mode'; |
| 520 | + stopBtn.textContent = '▶ Next question →'; |
| 521 | + stopBtn.onclick = () => { |
| 522 | + document.getElementById('stopBar').style.display = 'none'; |
| 523 | + currentIdx++; |
| 524 | + if (currentIdx < QUIZ_Q.length) loadQuestion(); |
| 525 | + else showResult(); |
| 526 | + stopBtn.onclick = stopAutoAdvance; // reset for next round |
| 527 | + }; |
| 528 | +} |
| 529 | + |
488 | 530 | // ── Result ──────────────────────────────────────────────────────────────── |
489 | 531 | function showResult() { |
490 | 532 | show('result'); |
|
0 commit comments