From d7f13dcfe283e641a667a4843cec48c98769a8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Fri, 15 May 2026 13:42:19 +0300 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/script.js | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/static/script.js b/static/script.js index f1a26ea..3c70ce1 100644 --- a/static/script.js +++ b/static/script.js @@ -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