fix: freeze PP clock during intermission so it stops ticking toward zero
tickClocks iterates every [data-seconds][data-received-at] element. Rendering the PP indicator with those attrs during an intermission made the clock bleed seconds even though play is paused and the penalty isn't running. Drop the ticking attrs when game['Intermission'] is true — render a plain static "PP MM:SS" that resumes ticking on the next live payload. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -244,7 +244,9 @@ function teamRow(game, side, state) {
|
||||
|
||||
const sogHtml = (state === 'live' || state === 'final') && sog !== undefined
|
||||
? `<span class="team-sog">${sog} SOG</span>` : '';
|
||||
const ppHtml = state === 'live' && pp ? teamPpIndicator(pp) : '';
|
||||
const ppHtml = state === 'live' && pp
|
||||
? teamPpIndicator(pp, game['Intermission'])
|
||||
: '';
|
||||
|
||||
const subParts = [sogHtml, ppHtml].filter(Boolean).join('');
|
||||
const subline = subParts ? `<div class="team-subline">${subParts}</div>` : '';
|
||||
@@ -264,8 +266,11 @@ function teamRow(game, side, state) {
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function teamPpIndicator(pp) {
|
||||
function teamPpIndicator(pp, intermission) {
|
||||
const timeStr = pp.replace('PP ', '');
|
||||
if (intermission) {
|
||||
return `<span class="team-pp">PP ${timeStr}</span>`;
|
||||
}
|
||||
const seconds = timeToSeconds(timeStr);
|
||||
const attrs = `data-seconds="${seconds}" data-received-at="${Date.now()}" data-pp-clock`;
|
||||
return `<span class="team-pp">PP <span ${attrs}>${timeStr}</span></span>`;
|
||||
|
||||
Reference in New Issue
Block a user