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