index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 38 |
1 files changed, 18 insertions, 20 deletions
@@ -8,30 +8,30 @@ class SoldierRecordBlock extends HTMLDivElement { const shadowRoot = this.attachShadow({ mode: "open" }); shadowRoot.appendChild(templateContent.cloneNode(true)); - customElements.define( - 'damage-block', - class extends HTMLSpanElement { - constructor() { - super(); - - let template = document.getElementById('damage-block'); - let templateContent = template.content; - - const shadowRoot = this.attachShadow({ mode: "open" }); - shadowRoot.appendChild(templateContent.cloneNode(true)); - } - }, - { extends: 'span' } - ); - this.shadowRoot - .querySelector('input[type="number"]') - .addEventListener('click', e => e.stopPropagation()) + .querySelectorAll('p:has(input[type="number"]), .physical-status-track') + .forEach(el => el.addEventListener('click', e => e.stopPropagation())) ; } } customElements.define( + 'damage-block', + class extends HTMLSpanElement { + constructor() { + super(); + + let template = document.getElementById('damage-block'); + let templateContent = template.content; + + const shadowRoot = this.attachShadow({ mode: "open" }); + shadowRoot.appendChild(templateContent.cloneNode(true)); + } + }, + { extends: 'span' } +); + +customElements.define( 'soldier-record-block', SoldierRecordBlock, { extends: 'div'} @@ -313,8 +313,6 @@ document.querySelectorAll('.soldier-record').forEach(el => }) ); -document.querySelectorAll('#record-sheet .damage').forEach(el => el.addEventListener('click', e => e.stopPropagation())); - document.querySelectorAll('.set-firing-arc').forEach(el => el.addEventListener('click', e => { let selectedSoldier = document.querySelector('.soldier-record.selected'); |