Add an optional countdown to every slide that collects answers
CI / Deploy / PHP 8.4 (push) Successful in 1m18s
CI / Deploy / PHP 8.5 (push) Successful in 1m29s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Choice, word cloud, open question, scale and ordering slides get a time
limit like the quiz. With a limit the slide waits ("ready") showing only
the question; next starts the countdown, the next one ends it, the third
moves on. Stage results and the ordering solution are withheld until the
countdown has started. The countdown music plays during any countdown.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-21 12:18:33 +01:00
1 parent 722e845cff
commit 27771e7470
19 files changed
+480 -34

No files matched your search

+31 -6
View File
@@ -652,7 +652,8 @@
var active = document.activeElement;
var focusKey = active && container.contains(active) ? active.getAttribute('data-comment-action') : null;
container.innerHTML = '';
if (!results) {
if (!results || results.ready) {
// A slide with a countdown that has not started shows only its question.
return;
}
var renderer = Results[results.type];
@@ -1514,6 +1515,7 @@
? 'Teilnehmende sehen gerade eine Pause-Seite. Drücke B oder → zum Fortsetzen.'
: 'Drücke → um zu starten.');
q('[data-results]').innerHTML = '';
q('[data-stage-timer]').textContent = '';
renderMedia(null);
renderImage(null);
root.classList.remove('stage--video');
@@ -1526,12 +1528,18 @@
var quizPhase = slide.type === 'quiz' && state.results ? state.results.phase : null;
var qaStage = slide.type === 'qa' && state.results ? state.results.stage : null;
var orderRevealed = slide.type === 'order' && state.results ? state.results.revealed : null;
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed;
// Countdown of any slide that has one (a quiz shows its timer inside its results).
var timer = state.results && state.results.timer ? state.results.timer : null;
var phase = timer ? timer.phase : null;
var timed = phase && !quizPhase ? phase : null;
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed && timed !== 'ready';
// Status line above the question: only what the room needs to know, not the slide type.
q('[data-status]').textContent = quizPhase
? { ready: 'Bereit', running: 'Läuft', finished: 'Auflösung' }[quizPhase]
: (qaStage ? Qa.labels[qaStage]
: (orderRevealed ? 'Auflösung' : (closed ? 'Abstimmung geschlossen' : '')));
: (orderRevealed ? 'Auflösung'
: (timed === 'ready' ? 'Bereit' : (timed === 'running' ? 'Läuft' : (closed ? 'Abstimmung geschlossen' : '')))));
renderStageTimer(timed === 'running' && timer.remaining !== null ? timer.remaining : null);
q('[data-question]').textContent = slide.question;
Format.render(q('[data-description]'), slide.description);
root.classList.toggle('stage--content', !slide.isInteractive);
@@ -1548,12 +1556,14 @@
? { ready: 'Quiz starten', running: 'Quiz beenden', finished: 'Quiz erneut öffnen' }[quizPhase]
: (qaStage
? { collect: 'Einreichen beenden', vote: 'Abstimmung beenden', discuss: '' }[qaStage]
: (slide.type === 'order'
: (timed
? { ready: 'Countdown starten', running: 'Abstimmung schließen', finished: 'Countdown erneut starten' }[timed]
: slide.type === 'order'
? (slide.isVotingOpen ? 'Schließen & auflösen' : 'Abstimmung wieder öffnen')
: (slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen')));
var count = qaStage ? state.results.questions.length : (slide.isInteractive ? state.results.participants : 0);
setText('[data-participants]', !slide.isInteractive ? '' : (qaStage
setText('[data-participants]', !slide.isInteractive || timed === 'ready' ? '' : (qaStage
? count + (count === 1 ? ' Frage' : ' Fragen')
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
@@ -1564,7 +1574,22 @@
}
renderResults();
Countdown.start();
StageAudio.sync(quizPhase === 'running' ? state.poll.audioUrl : null);
StageAudio.sync(phase === 'running' ? state.poll.audioUrl : null);
}
/** Big countdown below the question for slides that are not a quiz; null removes it. */
function renderStageTimer(remaining) {
var box = q('[data-stage-timer]');
box.textContent = '';
if (remaining === null) {
return;
}
box.appendChild(el('p', {
class: 'quiz-timer',
role: 'timer',
'data-countdown': '',
'data-remaining': String(remaining)
}, [el('strong', { 'data-countdown-value': '', text: formatSeconds(remaining) })]));
}
function isPrivate() {