Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js38
1 files changed, 18 insertions, 20 deletions
diff --git a/index.js b/index.js
index 695eae5..15764a1 100644
--- a/index.js
+++ b/index.js
@@ -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');