Web Dev Solutions

Catalin Mititiuc

From 4cf7aaab807f36721416eedfe5f9fab3f0c55e20 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Mon, 8 Jul 2024 18:13:37 -0700 Subject: View squad records --- src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/index.js') 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(); -- cgit v1.2.3