test13
This commit is contained in:
@@ -1339,6 +1339,8 @@ data-role="{{ p.position_full or p.position or '' }}"
|
||||
});
|
||||
})();
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user