167 build - двойной клик по времени для редактирования основного времени
This commit is contained in:
2
app.py
2
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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 @@
|
||||
<span>${language === "en" ? "CURRENT PERIOD" : "ТЕКУЩИЙ ПЕРИОД"}</span>
|
||||
<select data-hockey-current-period ${game && window.HockeyMatchAccess?.canControl?.(String(game.external_id || game.id || "")) ? "" : "disabled"}>${periodOptions.map((item) => `<option value="${escapeHtml(item.value)}" ${String(item.value) === currentPeriod ? "selected" : ""}>${escapeHtml(item.label)}</option>`).join("")}</select>
|
||||
</label>
|
||||
<div class="hockey-status-clock ${value.timer?.running ? "is-running" : "is-paused"}">
|
||||
<div class="hockey-status-clock ${value.timer?.running ? "is-running" : "is-paused"} ${canEditClock ? "is-editable" : ""}" title="${canEditClock ? (language === "en" ? "Double-click to edit the main timer" : "Двойной клик — изменить основное время") : ""}">
|
||||
<span>${language === "en" ? "MAIN TIMER" : "ОСНОВНОЙ ТАЙМЕР"}</span>
|
||||
<strong>${escapeHtml(clock)}</strong>
|
||||
<small>${escapeHtml(timerStatus(value.timer, language))}</small>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user