Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-05-24 15:59:17 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-05-24 15:59:17 -0700
commita80728f16f90616d93dcc9ed932528b35e2ef62d (patch)
tree3155abf47790f01c8fe87e374f30926cdd763b16 /public/assets/images/scenario-dragon_hunting.svg
parentd729079cdf63a4382e3e3225295784124e0a4d5d (diff)
WIP: mock selenium response
Diffstat (limited to 'public/assets/images/scenario-dragon_hunting.svg')
-rw-r--r--public/assets/images/scenario-dragon_hunting.svg20
1 files changed, 17 insertions, 3 deletions
diff --git a/public/assets/images/scenario-dragon_hunting.svg b/public/assets/images/scenario-dragon_hunting.svg
index 27b0bdf..cb33581 100644
--- a/public/assets/images/scenario-dragon_hunting.svg
+++ b/public/assets/images/scenario-dragon_hunting.svg
@@ -60,9 +60,9 @@
<rect id="background"/>
<g class="gameboard">
- <use href="http://localhost:8080/assets/images/mapsheets.svg#map2"/>
- <use href="http://localhost:8080/assets/images/mapsheets.svg#map1" style="transform: translate(0, 390.25px);"/>
- <use href="http://localhost:8080/assets/images/mapsheets.svg#map3" style="transform: translate(0, 780.5px);"/>
+ <use data-href="http://localhost:8080/assets/images/mapsheets.svg#map2"/>
+ <use data-href="http://localhost:8080/assets/images/mapsheets.svg#map1" style="transform: translate(0, 390.25px);"/>
+ <use data-href="http://localhost:8080/assets/images/mapsheets.svg#map3" style="transform: translate(0, 780.5px);"/>
<rect id="dots" fill="url(#asterisk)"/>
@@ -122,5 +122,19 @@
<g class="grid"/>
</g>
+ <script>//<![CDATA[
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random#getting_a_random_integer_between_two_values_inclusive
+ function getRandomIntInclusive(min, max) {
+ const minCeiled = Math.ceil(min);
+ const maxFloored = Math.floor(max);
+ return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); // The maximum is inclusive and the minimum is inclusive
+ }
+
+ const cacheBuster = Array(20).fill(null).map(() => getRandomIntInclusive(0, 9)).join('');
+
+ document.querySelectorAll('[data-href]').forEach(el => {
+ el.setAttributeNS(null, 'href', el.dataset.href.split('#').join(`?v=${cacheBuster}#`));
+ });
+ //]]></script>
<script data-cols="33" data-rows="77" href="http://localhost:8080/map.js"/>
</svg>