Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html12
-rw-r--r--index.js10
2 files changed, 19 insertions, 3 deletions
diff --git a/index.html b/index.html
index 3f3ed56..db842b4 100644
--- a/index.html
+++ b/index.html
@@ -146,7 +146,11 @@
<div>
<!-- <img class="logo" src="logo-davion.png" /> -->
<p>
- Davion<br>
+ Davion
+ <button type="button" class="clear-firing-arcs" data-allegiance="davion">
+ Clear Firing Arcs
+ </button>
+ <br>
<!-- 1st Squad, 3rd Platoon, Bravo Company, 2nd Battalion<br>
17th Kestral Mechanized Infantry -->
</p>
@@ -175,7 +179,11 @@
<div>
<!-- <img class="logo" src="logo-liao.png" /> -->
<p>
- Liao<br>
+ Liao
+ <button type="button" class="clear-firing-arcs" data-allegiance="liao">
+ Clear Firing Arcs
+ </button>
+ <br>
<!-- 2nd Squad, 1st Platoon, 3rd Company, 2nd Battalion<br>
Aldebaran Home Guard -->
</p>
diff --git a/index.js b/index.js
index 15764a1..dfff1a3 100644
--- a/index.js
+++ b/index.js
@@ -354,4 +354,12 @@ document.querySelectorAll('.set-firing-arc').forEach(el => el.addEventListener('
document.querySelector('circle#point').style.display = 'none';
}
}
-})); \ No newline at end of file
+}));
+
+document.querySelectorAll('.clear-firing-arcs').forEach(el =>
+ el.addEventListener('click', ({target: {dataset: {allegiance}}}) =>
+ document
+ .querySelectorAll(`.firing-arc[data-troop-allegiance="${allegiance}"]`)
+ .forEach(el => el.remove())
+ )
+); \ No newline at end of file