From e1c7305f71421898a58068d027e407a6d2c5cb96 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Mon, 24 Jun 2024 17:22:20 +0200 Subject: [PATCH] feat: Update military overview UI to use lowercase data attributes --- index.html | 2 +- modules/ui/military-overview.js | 8 +++++--- versioning.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index b21696dd..c51c8154 100644 --- a/index.html +++ b/index.html @@ -8101,7 +8101,7 @@ - + diff --git a/modules/ui/military-overview.js b/modules/ui/military-overview.js index 7c83c757..2382cb27 100644 --- a/modules/ui/military-overview.js +++ b/modules/ui/military-overview.js @@ -55,7 +55,9 @@ function overviewMilitary() { for (const u of options.military) { const label = capitalize(u.name.replace(/_/g, " ")); insert( - `
${label} 
` + `
${label} 
` ); } header.querySelectorAll(".removable").forEach(function (e) { @@ -77,7 +79,7 @@ function overviewMilitary() { const total = options.military.reduce((s, u) => s + getForces(u) * u.crew, 0); const rate = (total / population) * 100; - const sortData = options.military.map(u => `data-${u.name}="${getForces(u)}"`).join(" "); + const sortData = options.military.map(u => `data-${u.name.toLowerCase()}="${getForces(u)}"`).join(" "); const lineData = options.military .map(u => `
${getForces(u)}
`) .join(" "); @@ -469,7 +471,7 @@ function overviewMilitary() { body.querySelectorAll(":scope > div").forEach(function (el) { data += el.dataset.id + ","; data += el.dataset.state + ","; - data += units.map(u => el.dataset[u]).join(",") + ","; + data += units.map(u => el.dataset[u.toLowerCase()]).join(",") + ","; data += el.dataset.total + ","; data += el.dataset.population + ","; data += rn(el.dataset.rate, 2) + "%,"; diff --git a/versioning.js b/versioning.js index af9ff6e5..5c5f3961 100644 --- a/versioning.js +++ b/versioning.js @@ -1,7 +1,7 @@ "use strict"; // version and caching control -const version = "1.97.14"; // generator version, update each time +const version = "1.97.15"; // generator version, update each time { document.title += " v" + version;