пауза данных пока находишься в настройках

This commit is contained in:
2026-09-24 15:19:43 +03:00
parent d264b06b77
commit cf751a4d49
2 changed files with 143 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
// BUILD159_COUNTDOWN_TRANSITION_FIXES
// BUILD155: all hockey game/penalty timers use native vMix Countdown; no per-second SetText mirroring.
// BUILD160: strict settings freeze; background vMix inventory refresh never rebuilds an open settings form.
// BUILD153: settings freeze all data-driven DOM rendering and keep dropdown popovers open.
// BUILD152: all browser-side hockey data polling pauses while operator settings are open.
// BUILD151: Schedule ONLINE is a toggle; one-second live polling uses isolated schedule_live.
@@ -15369,6 +15370,118 @@ function renderHockeyPenaltyDashboard(node, component, runtime) {
return card;
}
function shortcutSequenceStepById(stepId) {
const wanted = String(stepId || "").trim();
if (!wanted) return null;
for (const sequence of state.config.shortcut_sequences || []) {
const step = (sequence.steps || []).find((item) => String(item?.id || "") === wanted);
if (step) return step;
}
return null;
}
function shortcutInventorySelectIsBeingUsed(select) {
if (!select) return false;
const shell = select.closest?.(".css-select-shell");
const trigger = shell?.querySelector?.(".css-select-trigger");
if (activeControlPopover?.anchor === trigger) return true;
const focused = document.activeElement;
return Boolean(focused && (focused === select || shell?.contains?.(focused)));
}
function refreshShortcutInventorySelect(select, optionsHtml, value) {
if (!select || shortcutInventorySelectIsBeingUsed(select)) return false;
const selectedValue = String(value || "");
select.innerHTML = optionsHtml;
select.value = selectedValue;
refreshEnhancedControl(select);
return true;
}
function refreshShortcutEditorInventoryControls(editor) {
if (!editor?.isConnected) return;
const status = editor.querySelector("[data-vmix-inventory-status]");
if (status) status.textContent = shortcutInventoryLabel();
editor.querySelectorAll(".shortcut-vmix-inventory-note > span").forEach((node) => {
node.textContent = shortcutInventoryLabel();
});
editor.querySelectorAll("[data-step-id]").forEach((card) => {
const step = shortcutSequenceStepById(card.dataset.stepId);
if (!step) return;
if (step.type === "vmix_command") {
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="input"]'),
vmixInputOptions(step.input),
step.input
);
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="selected_name"]'),
vmixSelectedNameOptions(step.input, step.selected_name),
step.selected_name
);
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="scoreboard_alternate_input"]'),
vmixInputOptions(step.scoreboard_alternate_input),
step.scoreboard_alternate_input
);
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="scoreboard_alternate_selected_name"]'),
vmixSelectedNameOptions(step.scoreboard_alternate_input, step.scoreboard_alternate_selected_name),
step.scoreboard_alternate_selected_name
);
return;
}
if (step.type !== "hockey_vmix_timers_start") return;
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="game_vmix_input"]'),
vmixInputOptions(step.game_vmix_input),
step.game_vmix_input
);
refreshShortcutInventorySelect(
card.querySelector('[data-step-field="game_vmix_selected_name"]'),
vmixTextSelectedNameOptions(step.game_vmix_input, step.game_vmix_selected_name),
step.game_vmix_selected_name
);
const homeTargets = sequencePenaltyTargets(step, "home");
const awayTargets = sequencePenaltyTargets(step, "away");
card.querySelectorAll("[data-penalty-target-row]").forEach((row) => {
const targetId = String(row.dataset.penaltyTargetRow || "");
const side = row.querySelector("[data-penalty-target-side]")?.dataset?.penaltyTargetSide || "";
const targets = side === "away" ? awayTargets : homeTargets;
const target = targets.find((item) => String(item?.id || "") === targetId);
if (!target) return;
refreshShortcutInventorySelect(
row.querySelector('[data-penalty-target-field="input"]'),
vmixInputOptions(target.input),
target.input
);
refreshShortcutInventorySelect(
row.querySelector('[data-penalty-target-field="selected_name"]'),
vmixTextSelectedNameOptions(target.input, target.selected_name),
target.selected_name
);
});
const finishActions = normalizeTimerFinishActions(step.timer_finish_actions);
card.querySelectorAll("[data-finish-action-row]").forEach((row) => {
const actionId = String(row.dataset.finishActionRow || "");
const action = finishActions.find((item) => String(item?.id || "") === actionId);
if (!action) return;
refreshShortcutInventorySelect(
row.querySelector('[data-finish-action-field="input"]'),
vmixInputOptions(action.input),
action.input
);
});
});
}
function showShortcutsEditor() {
state.shortcutSequenceOpenId = "";
showSettingsModal("Шорткаты и сценарии", `<div class="shortcut-sequence-editor">
@@ -15446,11 +15559,19 @@ function renderHockeyPenaltyDashboard(node, component, runtime) {
render({ focusId: sequence.id });
});
editor.querySelector("[data-open-shortcut-reference]").addEventListener("click", showShortcutsReference);
editor.querySelector("[data-refresh-vmix-inventory]").addEventListener("click", async () => { await loadShortcutInventory(); render({ focusId: state.shortcutSequenceOpenId }); });
editor.querySelector("[data-refresh-vmix-inventory]").addEventListener("click", async () => {
await loadShortcutInventory();
refreshShortcutEditorInventoryControls(editor);
});
editor.querySelector("[data-save-shortcuts]").addEventListener("click", () => saveConfig());
editor.querySelector("[data-close-shortcuts]").addEventListener("click", closeModal);
render();
loadShortcutInventory({ silent: true }).then(() => render({ focusId: state.shortcutSequenceOpenId }));
loadShortcutInventory({ silent: true }).then(() => {
// BUILD160: do not replace the whole settings DOM after the async vMix
// inventory request completes. Replacing it can close an already-open
// dropdown and visually restore defaults while the operator is editing.
refreshShortcutEditorInventoryControls(editor);
});
}
function shortcutReferenceItems() {