test11
This commit is contained in:
@@ -354,7 +354,8 @@
|
||||
class="player-inline vmix-person-trigger player-link"
|
||||
data-vmix-person-type="player"
|
||||
data-side="home"
|
||||
data-name="{{ p.player_name or '' }}"
|
||||
data-first-name="{{ p.first_name or '' }}"
|
||||
data-last-name="{{ p.last_name or '' }}"
|
||||
data-role="{{ p.position_full or p.position or '' }}"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
@@ -461,7 +462,8 @@ data-role="{{ p.position_full or p.position or '' }}"
|
||||
class="player-inline vmix-person-trigger player-link"
|
||||
data-vmix-person-type="player"
|
||||
data-side="home"
|
||||
data-name="{{ p.player_name or '' }}"
|
||||
data-first-name="{{ p.first_name or '' }}"
|
||||
data-last-name="{{ p.last_name or '' }}"
|
||||
data-role="{{ p.position_full or p.position or '' }}"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
@@ -578,7 +580,8 @@ data-role="{{ p.position_full or p.position or '' }}"
|
||||
class="player-inline vmix-person-trigger player-link"
|
||||
data-vmix-person-type="player"
|
||||
data-side="away"
|
||||
data-name="{{ p.player_name or '' }}"
|
||||
data-first-name="{{ p.first_name or '' }}"
|
||||
data-last-name="{{ p.last_name or '' }}"
|
||||
data-role="{{ p.position_full or p.position or '' }}"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
@@ -685,7 +688,8 @@ data-role="{{ p.position_full or p.position or '' }}"
|
||||
class="player-inline vmix-person-trigger player-link"
|
||||
data-vmix-person-type="player"
|
||||
data-side="away"
|
||||
data-name="{{ p.player_name or '' }}"
|
||||
data-first-name="{{ p.first_name or '' }}"
|
||||
data-last-name="{{ p.last_name or '' }}"
|
||||
data-role="{{ p.position_full or p.position or '' }}"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
@@ -995,37 +999,94 @@ data-role="{{ p.position_full or p.position or '' }}"
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.MATCH_DATA = {
|
||||
teamNames: {
|
||||
home: {{ session[14] | tojson }},
|
||||
away: {{ session[17] | tojson }}
|
||||
(function () {
|
||||
const matchId = window.MATCH_DATA?.matchId;
|
||||
const sessionToken = window.MATCH_DATA?.sessionToken;
|
||||
const teamLogos = window.MATCH_DATA?.teamLogos || {};
|
||||
|
||||
if (!matchId || !sessionToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
function formatCoachName(rawName) {
|
||||
const parts = String(rawName || "").trim().split(/\s+/).filter(Boolean);
|
||||
if (parts.length >= 2) {
|
||||
return `${parts[1]} ${parts[0]}`;
|
||||
}
|
||||
return String(rawName || "").trim();
|
||||
}
|
||||
|
||||
function formatPlayerName(firstName, lastName, fallbackName) {
|
||||
const result = `${String(firstName || "").trim()} ${String(lastName || "").trim()}`.trim();
|
||||
return result || String(fallbackName || "").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"
|
||||
},
|
||||
teamLogos: {
|
||||
home: {{ session[15] | tojson }},
|
||||
away: {{ session[18] | tojson }}
|
||||
},
|
||||
sessionToken: {{ session[3] | tojson }},
|
||||
matchId: {{ session[1] | tojson }},
|
||||
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
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
homeFormations: {{ home_formations | tojson }},
|
||||
awayFormations: {{ away_formations | tojson }},
|
||||
if (!response.ok) {
|
||||
console.error("Ошибка отправки титра в vMix:", response.status);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Не удалось отправить титр в vMix:", error);
|
||||
}
|
||||
}
|
||||
|
||||
homeStarting: {{ lineups.home_starting | tojson }},
|
||||
awayStarting: {{ lineups.away_starting | tojson }},
|
||||
homeBench: {{ lineups.home_bench | tojson }},
|
||||
awayBench: {{ lineups.away_bench | tojson }},
|
||||
document.addEventListener("click", function (event) {
|
||||
const trigger = event.target.closest(".vmix-person-trigger");
|
||||
if (!trigger) return;
|
||||
|
||||
homeCoaches: {{ coaches.home | tojson }},
|
||||
awayCoaches: {{ coaches.away | tojson }},
|
||||
const personType = String(trigger.dataset.vmixPersonType || "").trim();
|
||||
const side = String(trigger.dataset.side || "").trim();
|
||||
const rawName = String(trigger.dataset.name || "").trim();
|
||||
const firstName = String(trigger.dataset.firstName || "").trim();
|
||||
const lastName = String(trigger.dataset.lastName || "").trim();
|
||||
const role = String(trigger.dataset.role || "").trim();
|
||||
const logoUrl = side === "away" ? teamLogos.away : teamLogos.home;
|
||||
|
||||
referees: {{ referees | tojson }},
|
||||
refereePool: {{ referee_pool | tojson }},
|
||||
let formattedName = "";
|
||||
|
||||
homeSquadPool: [],
|
||||
awaySquadPool: [],
|
||||
homeCoachPool: [],
|
||||
awayCoachPool: []
|
||||
};
|
||||
if (personType === "coach") {
|
||||
formattedName = formatCoachName(rawName);
|
||||
} else {
|
||||
formattedName = formatPlayerName(firstName, lastName, rawName);
|
||||
}
|
||||
|
||||
if (!formattedName) return;
|
||||
|
||||
sendNeutralPersonTitle(formattedName, role, logoUrl);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<div class="formation-modal" id="formationAssignModal">
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user