blob: e5e8de6277661a63330b128be4ea0d491dee6f3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
export function unSelect() {
const selected = getSelected();
if (selected) {
selected.classList.remove('selected');
}
document.getElementById('toggle-prone-counter').checked = false;
}
export function getSelected() {
return document.querySelector('.soldier-record.selected');
}
export function select(data) {
const selector =
`#record-sheet .soldier-record[data-number="${data.number}"][data-allegiance="${data.allegiance}"]`
unSelect();
document.querySelector(selector).classList.add('selected');
document.getElementById('toggle-prone-counter').checked = data.prone;
}
export function endMove() {
const selected = getSelected();
if (selected) {
selected.classList.toggle('movement-ended');
}
unSelect();
}
|