Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/record_sheet.js')
-rw-r--r--src/modules/record_sheet.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js
index 736ffb2..6909249 100644
--- a/src/modules/record_sheet.js
+++ b/src/modules/record_sheet.js
@@ -94,12 +94,17 @@ export function getSelected() {
}
export function select(data) {
- const selector =
- `#record-sheet .soldier-record[data-number="${data.number}"][data-allegiance="${data.allegiance}"]`
-
unSelect();
+
+ if (!data) {
+ return;
+ }
+
+ const { allegiance: al, number: n } = data,
+ selector = `.soldier-record[data-number="${n}"][data-allegiance="${al}"]`;
+
document.querySelector(selector).classList.add('selected');
- document.getElementById('toggle-prone-counter').checked = data.prone;
+ document.querySelector('#toggle-prone-counter').checked = data.prone;
}
export function endMove() {