mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
feat: Update military overview UI to use lowercase data attributes
This commit is contained in:
parent
8e5a06540c
commit
e1c7305f71
3 changed files with 7 additions and 5 deletions
|
|
@ -8101,7 +8101,7 @@
|
||||||
<script defer src="modules/ui/zones-editor.js?v=1.97.13"></script>
|
<script defer src="modules/ui/zones-editor.js?v=1.97.13"></script>
|
||||||
<script defer src="modules/ui/burgs-overview.js?v=1.97.00"></script>
|
<script defer src="modules/ui/burgs-overview.js?v=1.97.00"></script>
|
||||||
<script defer src="modules/ui/rivers-overview.js"></script>
|
<script defer src="modules/ui/rivers-overview.js"></script>
|
||||||
<script defer src="modules/ui/military-overview.js?v=1.96.07"></script>
|
<script defer src="modules/ui/military-overview.js?v=1.97.15"></script>
|
||||||
<script defer src="modules/ui/regiments-overview.js?v=1.89.20"></script>
|
<script defer src="modules/ui/regiments-overview.js?v=1.89.20"></script>
|
||||||
<script defer src="modules/ui/markers-overview.js?v=1.89.38"></script>
|
<script defer src="modules/ui/markers-overview.js?v=1.89.38"></script>
|
||||||
<script defer src="modules/ui/regiment-editor.js?v=1.97.14"></script>
|
<script defer src="modules/ui/regiment-editor.js?v=1.97.14"></script>
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,9 @@ function overviewMilitary() {
|
||||||
for (const u of options.military) {
|
for (const u of options.military) {
|
||||||
const label = capitalize(u.name.replace(/_/g, " "));
|
const label = capitalize(u.name.replace(/_/g, " "));
|
||||||
insert(
|
insert(
|
||||||
`<div data-tip="State ${u.name} units number. Click to sort" class="sortable removable" data-sortby="${u.name}">${label} </div>`
|
`<div data-tip="State ${
|
||||||
|
u.name
|
||||||
|
} units number. Click to sort" class="sortable removable" data-sortby="${u.name.toLowerCase()}">${label} </div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
header.querySelectorAll(".removable").forEach(function (e) {
|
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 total = options.military.reduce((s, u) => s + getForces(u) * u.crew, 0);
|
||||||
const rate = (total / population) * 100;
|
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
|
const lineData = options.military
|
||||||
.map(u => `<div data-type="${u.name}" data-tip="State ${u.name} units number">${getForces(u)}</div>`)
|
.map(u => `<div data-type="${u.name}" data-tip="State ${u.name} units number">${getForces(u)}</div>`)
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|
@ -469,7 +471,7 @@ function overviewMilitary() {
|
||||||
body.querySelectorAll(":scope > div").forEach(function (el) {
|
body.querySelectorAll(":scope > div").forEach(function (el) {
|
||||||
data += el.dataset.id + ",";
|
data += el.dataset.id + ",";
|
||||||
data += el.dataset.state + ",";
|
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.total + ",";
|
||||||
data += el.dataset.population + ",";
|
data += el.dataset.population + ",";
|
||||||
data += rn(el.dataset.rate, 2) + "%,";
|
data += rn(el.dataset.rate, 2) + "%,";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// version and caching control
|
// 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;
|
document.title += " v" + version;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue