Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/index.js13
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');
+ }
})
);
});