test11
This commit is contained in:
@@ -354,7 +354,8 @@
|
|||||||
class="player-inline vmix-person-trigger player-link"
|
class="player-inline vmix-person-trigger player-link"
|
||||||
data-vmix-person-type="player"
|
data-vmix-person-type="player"
|
||||||
data-side="home"
|
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 '' }}"
|
data-role="{{ p.position_full or p.position or '' }}"
|
||||||
>
|
>
|
||||||
<div class="player-inline-text">
|
<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"
|
class="player-inline vmix-person-trigger player-link"
|
||||||
data-vmix-person-type="player"
|
data-vmix-person-type="player"
|
||||||
data-side="home"
|
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 '' }}"
|
data-role="{{ p.position_full or p.position or '' }}"
|
||||||
>
|
>
|
||||||
<div class="player-inline-text">
|
<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"
|
class="player-inline vmix-person-trigger player-link"
|
||||||
data-vmix-person-type="player"
|
data-vmix-person-type="player"
|
||||||
data-side="away"
|
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 '' }}"
|
data-role="{{ p.position_full or p.position or '' }}"
|
||||||
>
|
>
|
||||||
<div class="player-inline-text">
|
<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"
|
class="player-inline vmix-person-trigger player-link"
|
||||||
data-vmix-person-type="player"
|
data-vmix-person-type="player"
|
||||||
data-side="away"
|
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 '' }}"
|
data-role="{{ p.position_full or p.position or '' }}"
|
||||||
>
|
>
|
||||||
<div class="player-inline-text">
|
<div class="player-inline-text">
|
||||||
@@ -995,37 +999,94 @@ data-role="{{ p.position_full or p.position or '' }}"
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.MATCH_DATA = {
|
(function () {
|
||||||
teamNames: {
|
const matchId = window.MATCH_DATA?.matchId;
|
||||||
home: {{ session[14] | tojson }},
|
const sessionToken = window.MATCH_DATA?.sessionToken;
|
||||||
away: {{ session[17] | tojson }}
|
const teamLogos = window.MATCH_DATA?.teamLogos || {};
|
||||||
},
|
|
||||||
teamLogos: {
|
|
||||||
home: {{ session[15] | tojson }},
|
|
||||||
away: {{ session[18] | tojson }}
|
|
||||||
},
|
|
||||||
sessionToken: {{ session[3] | tojson }},
|
|
||||||
matchId: {{ session[1] | tojson }},
|
|
||||||
|
|
||||||
homeFormations: {{ home_formations | tojson }},
|
if (!matchId || !sessionToken) {
|
||||||
awayFormations: {{ away_formations | tojson }},
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
homeStarting: {{ lineups.home_starting | tojson }},
|
function formatCoachName(rawName) {
|
||||||
awayStarting: {{ lineups.away_starting | tojson }},
|
const parts = String(rawName || "").trim().split(/\s+/).filter(Boolean);
|
||||||
homeBench: {{ lineups.home_bench | tojson }},
|
if (parts.length >= 2) {
|
||||||
awayBench: {{ lineups.away_bench | tojson }},
|
return `${parts[1]} ${parts[0]}`;
|
||||||
|
}
|
||||||
|
return String(rawName || "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
homeCoaches: {{ coaches.home | tojson }},
|
function formatPlayerName(firstName, lastName, fallbackName) {
|
||||||
awayCoaches: {{ coaches.away | tojson }},
|
const result = `${String(firstName || "").trim()} ${String(lastName || "").trim()}`.trim();
|
||||||
|
return result || String(fallbackName || "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
referees: {{ referees | tojson }},
|
async function sendNeutralPersonTitle(name, role, logoUrl) {
|
||||||
refereePool: {{ referee_pool | tojson }},
|
const inputName = "ИГРОК - НЕЙТРАЛЬНЫЙ";
|
||||||
|
|
||||||
homeSquadPool: [],
|
const commands = [
|
||||||
awaySquadPool: [],
|
`/api/?Function=SetText&Input=${encodeURIComponent(inputName)}&SelectedName=${encodeURIComponent("Тренер.Text")}&Value=${encodeURIComponent(name || "")}`,
|
||||||
homeCoachPool: [],
|
`/api/?Function=SetText&Input=${encodeURIComponent(inputName)}&SelectedName=${encodeURIComponent("Должность.Text")}&Value=${encodeURIComponent(role || "")}`,
|
||||||
awayCoachPool: []
|
`/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 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;
|
||||||
|
|
||||||
|
let formattedName = "";
|
||||||
|
|
||||||
|
if (personType === "coach") {
|
||||||
|
formattedName = formatCoachName(rawName);
|
||||||
|
} else {
|
||||||
|
formattedName = formatPlayerName(firstName, lastName, rawName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formattedName) return;
|
||||||
|
|
||||||
|
sendNeutralPersonTitle(formattedName, role, logoUrl);
|
||||||
|
});
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
<div class="formation-modal" id="formationAssignModal">
|
<div class="formation-modal" id="formationAssignModal">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user