Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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();