diff --git a/static/script.js b/static/script.js index 3c70ce1..7f0f282 100644 --- a/static/script.js +++ b/static/script.js @@ -353,6 +353,17 @@ function startTimer() { saveMatchState(); } +async function triggerVmixExtraTimeAction(minutes, half) { + const title = "ДОБАВЛЕННОЕ ВРЕМЯ ДЛЯ ВЕРХНЕГО СЧЕТА" + + const commands = [ + vmixCmd(`Function=SetText&Input=${encodeURIComponent(title)}&SelectedName=Добавленное.Text&Value=+${minutes}`), + vmixCmd(`Function=PreviewInput&Input=${encodeURIComponent(title)}`) + ]; + + await sendDirectVmixCommands(commands); +} + function applyExtraTime() { const input = document.getElementById("extraTimeMinutes"); const value = Math.max(0, Number(input ? input.value : 0)); @@ -371,6 +382,7 @@ function applyExtraTime() { `Добавлено ${value} мин. к 1-му тайму`, matchClockSeconds ); + triggerVmixExtraTimeAction(value, "first"); } else if (currentPeriod === "2H" || currentPeriod === "FT") { extraTimeMinutes.second = value; updatePeriodBadge(`2-й тайм +${value}`); @@ -380,6 +392,7 @@ function applyExtraTime() { `Добавлено ${value} мин. ко 2-му тайму`, matchClockSeconds ); + triggerVmixExtraTimeAction(value, "second"); } saveMatchState();