Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-07-08 18:13:37 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-07-08 18:13:37 -0700
commit4cf7aaab807f36721416eedfe5f9fab3f0c55e20 (patch)
treecf1bd30a44f4c143daf42906c845b74f27539aac /src/index.js
parent16b987f46f446398eececf72aa01c551305948d3 (diff)
View squad records
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js
index 2ab35fa..98a3c1b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -255,6 +255,20 @@ document.querySelector('#toggle-grid-vis input').addEventListener('change', func
svg.querySelector('#dots').style.display = this.checked ? 'inline' : 'none';
});
+document.querySelectorAll('#record-sheet [data-allegiance]').forEach(el => {
+ const squadNumbers = el.querySelectorAll(`.squad-number`);
+ const recordContainer = el.querySelector('.records');
+
+ squadNumbers.forEach(sn =>
+ sn.addEventListener('click', function() {
+ recordContainer.dataset.viewSquadNumber = this.dataset.number;
+ squadNumbers.forEach(sn =>
+ sn.classList[sn.dataset.number === this.dataset.number ? 'add' : 'remove']('selected')
+ );
+ })
+ );
+});
+
contentVisToggleEl.addEventListener('input', toggleContentVis);
contentVisToggleEl.checked = (localStorage.getItem('content-visibility') !== 'false');
toggleContentVis();