WIP: record sheet layout

This commit is contained in:
2025-06-16 22:41:30 -07:00
parent 142d472e06
commit c0a6440b48
4 changed files with 238 additions and 276 deletions

View File

@@ -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';
}
});
// 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);
// localStorage.setItem('content-visibility', this.checked);
}).bind(contentVisToggleEl);
let mapResourceEl = document.querySelector('object');

View File

@@ -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;
}