From 51c47a18d2b9f7554d6a93502e6e94b114803f58 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Mon, 10 Feb 2025 01:39:21 +0100 Subject: [PATCH] fix: external icons - battle screen --- index.html | 2 +- modules/ui/battle-screen.js | 12 +++++++++--- versioning.js | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 3f46c748..90f7299c 100644 --- a/index.html +++ b/index.html @@ -8151,7 +8151,7 @@ - + diff --git a/modules/ui/battle-screen.js b/modules/ui/battle-screen.js index f2e47452..b12ceea4 100644 --- a/modules/ui/battle-screen.js +++ b/modules/ui/battle-screen.js @@ -131,7 +131,9 @@ class Battle { for (const u of options.military) { const label = capitalize(u.name.replace(/_/g, " ")); - headers += `${u.icon}`; + const isExternal = u.icon.startsWith("http"); + const iconHTML = isExternal ? `` : u.icon; + headers += `${iconHTML}`; } headers += "Total"; @@ -145,9 +147,13 @@ class Battle { const state = pack.states[regiment.state]; const distance = (Math.hypot(this.y - regiment.by, this.x - regiment.bx) * distanceScale) | 0; // distance between regiment and its base const color = state.color[0] === "#" ? state.color : "#999"; + + const isExternal = regiment.icon.startsWith("http"); + const iconHtml = isExternal + ? `` + : `${regiment.icon}`; const icon = ` - - ${regiment.icon}`; + ${iconHtml}`; const body = ``; let initial = `${icon}