This commit is contained in:
2026-04-21 16:57:17 +03:00
parent f62c48ccc3
commit f44792f2f2
2 changed files with 3 additions and 75 deletions

View File

@@ -1339,7 +1339,9 @@ data-role="{{ p.position_full or p.position or '' }}"
});
})();
</script>
<script src="/static/script.js"></script>
<script src="/static/script.js"></script>
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
@@ -1491,80 +1493,6 @@ data-role="{{ p.position_full or p.position or '' }}"
}
});
})();
</script>
<script>
(function () {
const matchId = window.MATCH_DATA?.matchId;
const sessionToken = window.MATCH_DATA?.sessionToken;
const teamLogos = window.MATCH_DATA?.teamLogos || {};
if (!matchId || !sessionToken) {
return;
}
function swapNameParts(rawName) {
const parts = String(rawName || "").trim().split(/\s+/).filter(Boolean);
if (parts.length >= 2) {
return `${parts[1]} ${parts[0]}`;
}
return String(rawName || "").trim();
}
async function sendNeutralPersonTitle(name, role, logoUrl) {
const inputName = "ИГРОК - НЕЙТРАЛЬНЫЙ";
const commands = [
`/api/?Function=SetText&Input=${encodeURIComponent(inputName)}&SelectedName=${encodeURIComponent("Тренер.Text")}&Value=${encodeURIComponent(name || "")}`,
`/api/?Function=SetText&Input=${encodeURIComponent(inputName)}&SelectedName=${encodeURIComponent("Должность.Text")}&Value=${encodeURIComponent(role || "")}`,
`/api/?Function=SetImage&Input=${encodeURIComponent(inputName)}&SelectedName=${encodeURIComponent("Лого.Source")}&Value=${encodeURIComponent(logoUrl || "")}`,
`/api/?Function=PreviewInput&Input=${encodeURIComponent(inputName)}`
];
try {
const response = await fetch("/api/vmix/publish-command", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
credentials: "same-origin",
body: JSON.stringify({
match_id: matchId,
session_token: sessionToken,
commands,
meta: {
source: "person_click",
title_input: inputName,
person_name: name,
person_role: role,
logo_url: logoUrl
}
})
});
if (!response.ok) {
console.error("Ошибка отправки титра в vMix:", response.status);
}
} catch (error) {
console.error("Не удалось отправить титр в vMix:", error);
}
}
document.addEventListener("click", function (event) {
const trigger = event.target.closest(".vmix-person-trigger");
if (!trigger) return;
const side = (trigger.dataset.side || "").trim();
const rawName = (trigger.dataset.name || "").trim();
const role = (trigger.dataset.role || "").trim();
const logoUrl = side === "away" ? teamLogos.away : teamLogos.home;
if (!rawName) return;
sendNeutralPersonTitle(rawName, role, logoUrl);
});
})();
</script>
</body>
</html>

BIN
vmix.zip Normal file

Binary file not shown.