index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/index.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/index.js b/src/index.js index cc4dd6d..e6a8802 100644 --- a/src/index.js +++ b/src/index.js @@ -266,10 +266,15 @@ document.querySelectorAll('#record-sheet [data-allegiance]').forEach(el => { 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') - ); + if (!this.classList.contains('selected')) { + recordContainer.dataset.viewSquadNumber = this.dataset.number; + console.log(); + squadNumbers.forEach(sn => + sn.classList[sn.dataset.number === this.dataset.number ? 'add' : 'remove']('selected') + ); + + if (el.querySelector('.soldier-record.selected')) Observable.notify('select'); + } }) ); }); |