fix: shorten current match server display name
This commit is contained in:
@@ -80,7 +80,8 @@ async function loadKillFeed({ backendBaseUrl, serverSlug, nodes, killFeedState }
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderCurrentMatch(data, nodes) {
|
function renderCurrentMatch(data, nodes) {
|
||||||
const serverName = data.server_name || data.server_slug || "Servidor no disponible";
|
const rawServerName = data.server_name || data.server_slug || "Servidor no disponible";
|
||||||
|
const serverName = formatServerDisplayName(data, rawServerName);
|
||||||
const mapName = data.map_pretty_name || data.map || "Mapa no disponible";
|
const mapName = data.map_pretty_name || data.map || "Mapa no disponible";
|
||||||
const scoreboardUrl = resolveTrustedScoreboardUrl(data);
|
const scoreboardUrl = resolveTrustedScoreboardUrl(data);
|
||||||
nodes.title.textContent = mapName;
|
nodes.title.textContent = mapName;
|
||||||
@@ -349,6 +350,21 @@ function resolveTrustedScoreboardUrl(data) {
|
|||||||
return data.public_scoreboard_url === trustedUrl ? trustedUrl : "";
|
return data.public_scoreboard_url === trustedUrl ? trustedUrl : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatServerDisplayName(data, fallbackName) {
|
||||||
|
const trustedName = CURRENT_MATCH_SERVERS[data.server_slug];
|
||||||
|
if (trustedName) {
|
||||||
|
return trustedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalized = String(fallbackName || "").trim();
|
||||||
|
const serverNumber = normalized.match(/^#0?([1-9])\b/);
|
||||||
|
if (serverNumber) {
|
||||||
|
return `Comunidad Hispana #${serverNumber[1].padStart(2, "0")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalized || "Servidor no disponible";
|
||||||
|
}
|
||||||
|
|
||||||
function hasKnownScore(data) {
|
function hasKnownScore(data) {
|
||||||
return isNumericValue(data.allied_score) && isNumericValue(data.axis_score);
|
return isNumericValue(data.allied_score) && isNumericValue(data.axis_score);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user