BUILD199 (2026.11.03.1) — исправить удаления и добавить разрешение плашек
This commit is contained in:
@@ -272,6 +272,7 @@
|
||||
const strengthHomeLabel = String(strength.home_label || "");
|
||||
const strengthAwayLabel = String(strength.away_label || "");
|
||||
const strengthStateLabel = String(strength.state_label || "");
|
||||
const auxiliaryGate = window.UIBuilderRuntime?.getAuxiliaryGate?.() || {};
|
||||
const signature = JSON.stringify({
|
||||
game: game?.external_id || "",
|
||||
canControl: window.HockeyMatchAccess?.canControl?.(String(game?.external_id || game?.id || "")) === true,
|
||||
@@ -290,6 +291,7 @@
|
||||
strengthHomeLabel,
|
||||
strengthAwayLabel,
|
||||
strengthStateLabel,
|
||||
auxiliaryGate,
|
||||
clock,
|
||||
timerRunning: Boolean(value.timer?.running),
|
||||
timerPaused: Boolean(value.timer?.paused),
|
||||
@@ -349,6 +351,13 @@
|
||||
<span>${language === "en" ? "MAIN TIMER" : "ОСНОВНОЙ ТАЙМЕР"}</span>
|
||||
<strong>${escapeHtml(clock)}</strong>
|
||||
<small>${escapeHtml(timerStatus(value.timer, language))}</small>
|
||||
<div class="hockey-auxiliary-gate" data-state="${auxiliaryGate.error ? "error" : auxiliaryGate.pending ? "pending" : auxiliaryGate.enabled ? "enabled" : "disabled"}">
|
||||
<label title="${escapeHtml(auxiliaryGate.error || (language === "en" ? "Allow penalty, empty net and delayed penalty plates above the score (F2)" : "Разрешить плашки удалений, пустых ворот и отложенного штрафа поверх счёта (F2)"))}">
|
||||
<input type="checkbox" data-hockey-auxiliary-toggle data-match-write ${auxiliaryGate.checked ? "checked" : ""} ${auxiliaryGate.can_control ? "" : `disabled data-access-disabled="${game ? "false" : "true"}"`}>
|
||||
<span class="hockey-auxiliary-gate-copy">${auxiliaryGate.pending ? (language === "en" ? "Plates · saving…" : "Плашки · сохранение…") : auxiliaryGate.error ? (language === "en" ? "Plates · not saved" : "Плашки · не сохранено") : (language === "en" ? "Plates · F2" : "Плашки · F2")}</span>
|
||||
</label>
|
||||
${auxiliaryGate.error ? `<button type="button" data-hockey-auxiliary-retry data-match-write title="${language === "en" ? "Retry plate setting" : "Повторить изменение плашек"}" ${auxiliaryGate.can_control ? "" : "disabled"}>↻</button>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
<div class="hockey-status-penalties" aria-label="${language === "en" ? "Active penalties" : "Активные удаления"}">
|
||||
${strengthMarkup}
|
||||
@@ -380,6 +389,22 @@
|
||||
const text = fresh.querySelector(selector).textContent;
|
||||
if (target.textContent !== text) target.textContent = text;
|
||||
}
|
||||
const gate = current.querySelector(".hockey-auxiliary-gate"), nextGate = fresh.querySelector(".hockey-auxiliary-gate");
|
||||
if (!gate) current.appendChild(nextGate);
|
||||
else {
|
||||
gate.dataset.state = nextGate.dataset.state;
|
||||
gate.querySelector("label").title = nextGate.querySelector("label").title;
|
||||
gate.querySelector(".hockey-auxiliary-gate-copy").textContent = nextGate.querySelector(".hockey-auxiliary-gate-copy").textContent;
|
||||
const input = gate.querySelector("input"), nextInput = nextGate.querySelector("input");
|
||||
input.checked = nextInput.checked;
|
||||
input.disabled = nextInput.disabled;
|
||||
if (nextInput.hasAttribute("data-access-disabled")) input.dataset.accessDisabled = nextInput.dataset.accessDisabled;
|
||||
else input.removeAttribute("data-access-disabled");
|
||||
const retry = gate.querySelector("button"), nextRetry = nextGate.querySelector("button");
|
||||
if (!nextRetry) retry?.remove();
|
||||
else if (!retry) gate.appendChild(nextRetry);
|
||||
else retry.disabled = nextRetry.disabled;
|
||||
}
|
||||
continue;
|
||||
} else if (current?.outerHTML === fresh.outerHTML) continue;
|
||||
if (current) current.replaceWith(fresh);
|
||||
@@ -416,6 +441,7 @@
|
||||
document.querySelector(".runtime-actions .hockey-selected-chip")?.click();
|
||||
});
|
||||
root.addEventListener("dblclick", (event) => {
|
||||
if (event.target.closest(".hockey-auxiliary-gate")) return;
|
||||
if (!event.target.closest(".hockey-status-clock")) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -430,6 +456,19 @@
|
||||
event.preventDefault();
|
||||
document.querySelector(".runtime-actions .hockey-selected-chip")?.click();
|
||||
});
|
||||
root.addEventListener("change", (event) => {
|
||||
if (!event.target.matches?.("[data-hockey-auxiliary-toggle]")) return;
|
||||
event.stopPropagation();
|
||||
if (!window.UIBuilderRuntime?.getAuxiliaryGate?.()?.can_control) { render(true); return; }
|
||||
Promise.resolve(window.UIBuilderRuntime?.setAuxiliaryGate?.(event.target.checked)).finally(() => render(true));
|
||||
});
|
||||
root.addEventListener("click", (event) => {
|
||||
if (!event.target.closest?.("[data-hockey-auxiliary-retry]")) return;
|
||||
event.preventDefault(); event.stopPropagation();
|
||||
const gate = window.UIBuilderRuntime?.getAuxiliaryGate?.();
|
||||
if (!gate?.can_control) return;
|
||||
Promise.resolve(window.UIBuilderRuntime?.setAuxiliaryGate?.(gate.retry_enabled === true)).finally(() => render(true));
|
||||
});
|
||||
topbar.appendChild(root);
|
||||
state.root = root;
|
||||
discoverActionIds();
|
||||
@@ -464,6 +503,7 @@
|
||||
render(true);
|
||||
});
|
||||
window.addEventListener("ui-builder:data-patched", () => render(true));
|
||||
window.addEventListener("hockey:auxiliary-gate-changed", () => render(true));
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (!document.hidden) render(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user