diff --git a/app.py b/app.py index 985a173..b175646 100644 --- a/app.py +++ b/app.py @@ -35,7 +35,7 @@ from khl_site.khl_data_center import APP as khl_site_app, configure_storage, syn from hockey_data.khl_career import KhlCareerService BASE_DIR = Path(__file__).resolve().parent -BUILD_VERSION = "2026.09.29.3" +BUILD_VERSION = "2026.09.29.4" # compatibility: BUILD_VERSION = "2026.09.24.2" # compatibility: BUILD_VERSION = "2026.09.23.8" # compatibility: BUILD_VERSION = "2026.09.23.7" diff --git a/hockey_data/static/match-status-header.css b/hockey_data/static/match-status-header.css index 97b8b5c..dbf31f2 100644 --- a/hockey_data/static/match-status-header.css +++ b/hockey_data/static/match-status-header.css @@ -147,6 +147,7 @@ .hockey-status-clock.is-running strong { color: #7af0d3; } .hockey-status-clock.is-running small { color: #4fd6b6; } .hockey-status-clock.is-paused strong { color: #dce6f1; } +.hockey-status-clock.is-editable { cursor: pointer; user-select: none; } .hockey-status-penalties { min-width: 0; diff --git a/hockey_data/static/match-status-header.js b/hockey_data/static/match-status-header.js index 7ae9c91..ecf6aa7 100644 --- a/hockey_data/static/match-status-header.js +++ b/hockey_data/static/match-status-header.js @@ -207,6 +207,8 @@ const scoreHome = Number.isFinite(Number(home.score)) ? Number(home.score) : 0; const scoreAway = Number.isFinite(Number(away.score)) ? Number(away.score) : 0; const clock = value.timer?.formatted || "—:—"; + const canEditClock = Boolean(value.timer && game + && window.HockeyMatchAccess?.canControl?.(String(game.external_id || game.id || ""))); const dateText = formatDate(game?.date, language); const startTime = String(game?.time || "").trim(); const league = value.tournament?.league || value.tournament?.name || ""; @@ -314,7 +316,7 @@ ${language === "en" ? "CURRENT PERIOD" : "ТЕКУЩИЙ ПЕРИОД"} -
+
${language === "en" ? "MAIN TIMER" : "ОСНОВНОЙ ТАЙМЕР"} ${escapeHtml(clock)} ${escapeHtml(timerStatus(value.timer, language))} @@ -339,6 +341,17 @@ state.periodEditing = false; state.root.dataset.periodSignature = periodSignature; state.root.dataset.periodGameId = String(game?.external_id || ""); + } else if (current && fresh.classList.contains("hockey-status-clock")) { + // Keep the click target alive between the two clicks, including when + // a running clock ticks or live match data refreshes in between. + current.className = fresh.className; + current.title = fresh.title; + for (const selector of ["span", "strong", "small"]) { + const target = current.querySelector(selector); + const text = fresh.querySelector(selector).textContent; + if (target.textContent !== text) target.textContent = text; + } + continue; } else if (current?.outerHTML === fresh.outerHTML) continue; if (current) current.replaceWith(fresh); else state.root.appendChild(fresh); @@ -373,6 +386,15 @@ if (!event.target.closest(".hockey-status-match")) return; document.querySelector(".runtime-actions .hockey-selected-chip")?.click(); }); + root.addEventListener("dblclick", (event) => { + if (!event.target.closest(".hockey-status-clock")) return; + event.preventDefault(); + event.stopPropagation(); + const value = snapshot(); + const gameId = String(value.game?.external_id || value.game?.id || ""); + if (!value.timer || !gameId || !window.HockeyMatchAccess?.canControl?.(gameId)) return; + window.UIBuilderRuntime?.openTimersEditor?.(state.timerId); + }); root.addEventListener("keydown", (event) => { if (event.target !== root && !event.target.closest(".hockey-status-match")) return; if (event.key !== "Enter" && event.key !== " ") return;