тест простой подписи игроков и тренеров по клику из веб морды
This commit is contained in:
@@ -246,7 +246,14 @@
|
||||
<div class="coaches-block" id="homeCoachesBlock">
|
||||
{% for c in coaches.home %}
|
||||
<div class="coach-line">
|
||||
<div class="coach-left">
|
||||
<div
|
||||
class="coach-left vmix-person-trigger"
|
||||
data-vmix-person-type="coach"
|
||||
data-side="home"
|
||||
data-name="{{ c.coach_name }}"
|
||||
data-role="{{ c.role or '' }}"
|
||||
title="Показать титр тренера"
|
||||
>
|
||||
<span class="coach-name">{{ c.coach_name }}</span>
|
||||
{% if c.role %}
|
||||
<span class="coach-badge">{{ c.role }}</span>
|
||||
@@ -303,8 +310,15 @@
|
||||
data-player-captain="{{ 1 if p.is_captain else 0 }}"
|
||||
>
|
||||
<td class="num-cell">{{ p.number }}</td>
|
||||
<td class="player-cell">
|
||||
<div class="player-inline">
|
||||
<td
|
||||
class="player-cell vmix-person-trigger"
|
||||
data-vmix-person-type="player"
|
||||
data-side="{{ 'home' if true else 'away' }}"
|
||||
data-name="{{ ((p.last_name or p.player_name or '') ~ ' ' ~ (p.first_name or '')) | trim }}"
|
||||
data-role="{{ p.position or '' }}"
|
||||
title="Показать титр игрока"
|
||||
>
|
||||
<div class="player-inline">
|
||||
<div class="player-inline-text">
|
||||
<span
|
||||
class="last-name"
|
||||
@@ -408,8 +422,15 @@
|
||||
data-player-captain="{{ 1 if p.is_captain else 0 }}"
|
||||
>
|
||||
<td class="num-cell">{{ p.number }}</td>
|
||||
<td class="player-cell">
|
||||
<div class="player-inline">
|
||||
<td
|
||||
class="player-cell vmix-person-trigger"
|
||||
data-vmix-person-type="player"
|
||||
data-side="{{ 'home' if true else 'away' }}"
|
||||
data-name="{{ ((p.last_name or p.player_name or '') ~ ' ' ~ (p.first_name or '')) | trim }}"
|
||||
data-role="{{ p.position or '' }}"
|
||||
title="Показать титр игрока"
|
||||
>
|
||||
<div class="player-inline">
|
||||
<div class="player-inline-text">
|
||||
<span
|
||||
class="last-name"
|
||||
@@ -458,7 +479,14 @@
|
||||
>
|
||||
{% for c in coaches.away %}
|
||||
<div class="coach-line">
|
||||
<div class="coach-left">
|
||||
<div
|
||||
class="coach-left vmix-person-trigger"
|
||||
data-vmix-person-type="coach"
|
||||
data-side="away"
|
||||
data-name="{{ c.coach_name }}"
|
||||
data-role="{{ c.role or '' }}"
|
||||
title="Показать титр тренера"
|
||||
>
|
||||
<span class="coach-name">{{ c.coach_name }}</span>
|
||||
{% if c.role %}
|
||||
<span class="coach-badge">{{ c.role }}</span>
|
||||
@@ -515,8 +543,14 @@
|
||||
data-player-captain="{{ 1 if p.is_captain else 0 }}"
|
||||
>
|
||||
<td class="num-cell">{{ p.number }}</td>
|
||||
<td class="player-cell">
|
||||
<div class="player-inline">
|
||||
<td
|
||||
class="player-cell vmix-person-trigger"
|
||||
data-vmix-person-type="player"
|
||||
data-side="away"
|
||||
data-name="{{ ((p.last_name or p.player_name or '') ~ ' ' ~ (p.first_name or '')) | trim }}"
|
||||
data-role="{{ p.position or '' }}"
|
||||
title="Показать титр игрока"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
<span
|
||||
class="last-name"
|
||||
@@ -620,8 +654,14 @@
|
||||
data-player-captain="{{ 1 if p.is_captain else 0 }}"
|
||||
>
|
||||
<td class="num-cell">{{ p.number }}</td>
|
||||
<td class="player-cell">
|
||||
<div class="player-inline">
|
||||
<td
|
||||
class="player-cell vmix-person-trigger"
|
||||
data-vmix-person-type="player"
|
||||
data-side="away"
|
||||
data-name="{{ ((p.last_name or p.player_name or '') ~ ' ' ~ (p.first_name or '')) | trim }}"
|
||||
data-role="{{ p.position or '' }}"
|
||||
title="Показать титр игрока"
|
||||
>
|
||||
<div class="player-inline-text">
|
||||
<span
|
||||
class="last-name"
|
||||
@@ -932,35 +972,39 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.MATCH_DATA = {
|
||||
teamNames: {
|
||||
home: {{ session[14] | tojson }},
|
||||
away: {{ session[17] | tojson }}
|
||||
},
|
||||
sessionToken: {{ session[3] | tojson }},
|
||||
matchId: {{ session[1] | tojson }},
|
||||
<script>
|
||||
window.MATCH_DATA = {
|
||||
teamNames: {
|
||||
home: {{ session[14] | tojson }},
|
||||
away: {{ session[17] | tojson }}
|
||||
},
|
||||
teamLogos: {
|
||||
home: {{ session[15] | tojson }},
|
||||
away: {{ session[18] | tojson }}
|
||||
},
|
||||
sessionToken: {{ session[3] | tojson }},
|
||||
matchId: {{ session[1] | tojson }},
|
||||
|
||||
homeFormations: {{ home_formations | tojson }},
|
||||
awayFormations: {{ away_formations | tojson }},
|
||||
homeFormations: {{ home_formations | tojson }},
|
||||
awayFormations: {{ away_formations | tojson }},
|
||||
|
||||
homeStarting: {{ lineups.home_starting | tojson }},
|
||||
awayStarting: {{ lineups.away_starting | tojson }},
|
||||
homeBench: {{ lineups.home_bench | tojson }},
|
||||
awayBench: {{ lineups.away_bench | tojson }},
|
||||
homeStarting: {{ lineups.home_starting | tojson }},
|
||||
awayStarting: {{ lineups.away_starting | tojson }},
|
||||
homeBench: {{ lineups.home_bench | tojson }},
|
||||
awayBench: {{ lineups.away_bench | tojson }},
|
||||
|
||||
homeCoaches: {{ coaches.home | tojson }},
|
||||
awayCoaches: {{ coaches.away | tojson }},
|
||||
homeCoaches: {{ coaches.home | tojson }},
|
||||
awayCoaches: {{ coaches.away | tojson }},
|
||||
|
||||
referees: {{ referees | tojson }},
|
||||
refereePool: {{ referee_pool | tojson }},
|
||||
referees: {{ referees | tojson }},
|
||||
refereePool: {{ referee_pool | tojson }},
|
||||
|
||||
homeSquadPool: [],
|
||||
awaySquadPool: [],
|
||||
homeCoachPool: [],
|
||||
awayCoachPool: []
|
||||
};
|
||||
</script>
|
||||
homeSquadPool: [],
|
||||
awaySquadPool: [],
|
||||
homeCoachPool: [],
|
||||
awayCoachPool: []
|
||||
};
|
||||
</script>
|
||||
<div class="formation-modal" id="formationAssignModal">
|
||||
<div
|
||||
class="formation-modal-backdrop"
|
||||
@@ -1382,6 +1426,72 @@
|
||||
}
|
||||
});
|
||||
})();
|
||||
</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;
|
||||
}
|
||||
|
||||
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;
|
||||
const name = (trigger.dataset.name || "").trim();
|
||||
const role = (trigger.dataset.role || "").trim();
|
||||
const logoUrl = side === "away" ? teamLogos.away : teamLogos.home;
|
||||
|
||||
if (!name) return;
|
||||
|
||||
sendNeutralPersonTitle(name, role, logoUrl);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user