From 1818218abb9451a96ad779ecba875d01878d77ef Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Mon, 20 May 2024 12:56:42 -0700
Subject: WIP: record sheet layout
---
src/index.js | 18 +++++++++---------
src/modules/record_sheet.js | 6 +++---
2 files changed, 12 insertions(+), 12 deletions(-)
(limited to 'src')
diff --git a/src/index.js b/src/index.js
index c71cc16..96b138f 100644
--- a/src/index.js
+++ b/src/index.js
@@ -15,15 +15,15 @@ const mapPlaceholder = document.querySelector('.map-placeholder'),
fileInputEl = document.querySelector('input[type="file"]'),
toggleContentVis = (function () {
- document.querySelectorAll('#content div').forEach(div => {
- if (this.checked) {
- div.style.display = div.id == 'record-sheet' ? 'flex' : 'block';
- } else {
- div.style.display = 'none';
- }
- });
-
- localStorage.setItem('content-visibility', this.checked);
+ // document.querySelectorAll('#content div').forEach(div => {
+ // if (this.checked) {
+ // div.style.display = div.id == 'record-sheet' ? 'flex' : 'block';
+ // } else {
+ // div.style.display = 'none';
+ // }
+ // });
+
+ // localStorage.setItem('content-visibility', this.checked);
}).bind(contentVisToggleEl);
let mapResourceEl = document.querySelector('object');
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js
index 9fd5b62..a9fb1c4 100644
--- a/src/modules/record_sheet.js
+++ b/src/modules/record_sheet.js
@@ -113,7 +113,7 @@ function addEventListeners(unSelectCounter, selectCounter) {
}
export function clear() {
- document.querySelectorAll('#attacker-record > div, #defender-record > div').forEach(el => el.remove());
+ document.querySelectorAll('#record-sheet .soldier-record').forEach(el => el.remove());
document.querySelector('#attacker-record .name').textContent = 'attacker';
document.querySelector('#defender-record .name').textContent = 'defender';
}
@@ -161,8 +161,8 @@ export function start(startLoc, units, gbUnSelect, gbSelect) {
const forces = createRecords(units);
for (const affiliation in forces) {
- const container = document.querySelector(`#${affiliation}-record`);
- const name = startLoc.dataset[`${affiliation}Name`];
+ const container = document.querySelector(`#${affiliation}-record .records`);
+ const name = startLoc.dataset[`#${affiliation}-record ${affiliation}Name`];
if (name) {
container.querySelector('.name').textContent = name;
}
--
cgit v1.2.3