index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-24 15:50:59 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-24 15:50:59 -0700 |
commit | 62a745d59f27c55f2c3689d2bebdc11684621e7b (patch) | |
tree | 10e0bb1d0a17d3e69c7ff1f76a13c4ccc6718333 /src/index.js | |
parent | f215ef7920aa686276ffb2aeb24df3340774619f (diff) |
Change troop-number and troop-allegiance references to just number and allegiance
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/index.js b/src/index.js index b4216be..d6204e8 100644 --- a/src/index.js +++ b/src/index.js @@ -18,7 +18,7 @@ const RecordSheet = new function () { this.select = function (data) { this.unSelect(); - document.querySelector(`#record-sheet .soldier-record[data-troop-number="${data.number}"][data-troop-allegiance="${data.allegiance}"]`).classList.add('selected'); + document.querySelector(`#record-sheet .soldier-record[data-number="${data.number}"][data-allegiance="${data.allegiance}"]`).classList.add('selected'); document.getElementById('toggle-prone-counter').checked = data.prone; }; @@ -121,8 +121,7 @@ window.addEventListener('load', () => { game.unSelect(); RecordSheet.unSelect(); } else { - const { troopAllegiance: allegiance, troopNumber: number } = el.dataset; - game.select({ dataset: { allegiance, number }}); + game.select(el); } }) ); @@ -134,7 +133,7 @@ window.addEventListener('load', () => { document.querySelectorAll('.end-turn').forEach(el => el.addEventListener('click', ({ target: { dataset: { allegiance }}}) => { - let dataSelector = `[data-troop-allegiance="${allegiance}"]`, + let dataSelector = `[data-allegiance="${allegiance}"]`, records = Array.from(document.querySelectorAll(`.soldier-record${dataSelector}`)), turnCounter = document.getElementById('turn-count'), { textContent: count, dataset: { update }} = turnCounter; @@ -153,12 +152,11 @@ window.addEventListener('load', () => { } records - .sort((el1, el2) => el1.dataset.troopNumber > el2.dataset.troopNumber) + .sort((el1, el2) => el1.dataset.number > el2.dataset.number) .forEach(el => el.classList.remove('movement-ended')); game.endTurn(allegiance); - const { troopAllegiance, troopNumber } = records.at(0).dataset; - game.select({ dataset: { allegiance: troopAllegiance, number: troopNumber }}); + game.select(records.at(0)); }) ); |