тест 5
This commit is contained in:
@@ -1203,7 +1203,7 @@ function getPlayerNamesByEvent(event) {
|
||||
|
||||
if (event.type !== "sub") {
|
||||
return {
|
||||
out: event.player_name || "",
|
||||
out: getVmixPlayerDisplayName(event),
|
||||
in: ""
|
||||
};
|
||||
}
|
||||
@@ -1216,12 +1216,21 @@ function getPlayerNamesByEvent(event) {
|
||||
findLineupRowByPlayerId(event.side, "starting", event.player_in_id) ||
|
||||
findLineupRowByPlayerId(event.side, "bench", event.player_in_id);
|
||||
|
||||
const formatRow = (row) => {
|
||||
if (!row) return "";
|
||||
const firstName = String(row.dataset.playerFirst || "").trim();
|
||||
const lastName = String(row.dataset.playerLast || "").trim();
|
||||
if (firstName && lastName) return `${firstName} ${lastName}`;
|
||||
return lastName || firstName || String(row.dataset.playerName || "").trim();
|
||||
};
|
||||
|
||||
return {
|
||||
out: outRow?.dataset.playerName || "",
|
||||
in: inRow?.dataset.playerName || ""
|
||||
out: formatRow(outRow),
|
||||
in: formatRow(inRow)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function renderEvents() {
|
||||
const list = document.getElementById("eventsList");
|
||||
if (!list) return;
|
||||
@@ -1267,6 +1276,7 @@ function renderEvents() {
|
||||
|
||||
const isClickable = clickableTypes.includes(event.type);
|
||||
const eventNameData = getPlayerNamesByEvent(event);
|
||||
const vmixPlayerName = getVmixPlayerDisplayName(event);
|
||||
|
||||
const clickAttr = isClickable
|
||||
? buildVmixClickAttr({
|
||||
@@ -1275,7 +1285,7 @@ function renderEvents() {
|
||||
side: event.side ?? "center",
|
||||
minute: event.minute ?? "",
|
||||
seconds: event.seconds ?? 0,
|
||||
player_name: event.player_name ?? "",
|
||||
player_name: vmixPlayerName,
|
||||
player_id: event.player_id ?? null,
|
||||
player_out_id: event.player_out_id ?? null,
|
||||
player_in_id: event.player_in_id ?? null,
|
||||
@@ -1376,6 +1386,29 @@ function renderEvents() {
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function getVmixPlayerDisplayName(event) {
|
||||
if (!event || !event.player_id) {
|
||||
return String(event?.player_name || "").trim();
|
||||
}
|
||||
|
||||
const row =
|
||||
findLineupRowByPlayerId(event.side, "starting", event.player_id) ||
|
||||
findLineupRowByPlayerId(event.side, "bench", event.player_id);
|
||||
|
||||
if (!row) {
|
||||
return String(event.player_name || "").trim();
|
||||
}
|
||||
|
||||
const firstName = String(row.dataset.playerFirst || "").trim();
|
||||
const lastName = String(row.dataset.playerLast || "").trim();
|
||||
|
||||
if (firstName && lastName) return `${firstName} ${lastName}`;
|
||||
if (lastName) return lastName;
|
||||
if (firstName) return firstName;
|
||||
|
||||
return String(row.dataset.playerName || event.player_name || "").trim();
|
||||
}
|
||||
|
||||
function restoreEventsClickOrder(serverEvents, persistedEvents) {
|
||||
const persistedIds = new Map(
|
||||
persistedEvents
|
||||
|
||||
Reference in New Issue
Block a user