blob: 120b3bc0c42f4555c5b1aa4bc244a2ff05b470ee (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
customElements.define(
'damage-block',
class extends HTMLElement {
constructor() {
super();
const template = document.querySelector('#damage-block'),
templateContent = template.content,
shadowRoot = this.attachShadow({ mode: "open" });
shadowRoot.appendChild(templateContent.cloneNode(true));
}
connectedCallback() {
const el = this.shadowRoot.querySelector('.damage-effect-indicator');
el.addEventListener('click', e => {
e.stopPropagation()
this.#cycleThroughDamageStates(el);
});
}
#cycleThroughDamageStates(el) {
if (el.classList.contains('bruise')) {
el.classList.remove('bruise');
el.classList.add('lethal');
} else if (el.classList.contains('lethal')) {
el.classList.remove('lethal');
} else {
el.classList.add('bruise');
}
}
},
);
customElements.define(
'soldier-record-block',
class extends HTMLElement {
constructor() {
super();
const template = document.querySelector('#soldier-record-block'),
templateContent = template.content,
shadowRoot = this.attachShadow({ mode: "open" });
shadowRoot.appendChild(templateContent.cloneNode(true));
}
connectedCallback() {
this.shadowRoot.querySelector('.grenades').addEventListener('click', e => e.stopPropagation());
}
},
);
|