From 13eacc886d6126e486c1872252f95f2f10b8a71e Mon Sep 17 00:00:00 2001 From: Arindy Date: Mon, 10 Feb 2025 17:46:10 +0100 Subject: [PATCH 1/4] adds buttons for simple commands --- src/main/resources/templates/overlay.html | 4 +- src/main/resources/templates/pub/index.html | 59 +++++++++++++++++---- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/main/resources/templates/overlay.html b/src/main/resources/templates/overlay.html index bedb2a4..631eeff 100644 --- a/src/main/resources/templates/overlay.html +++ b/src/main/resources/templates/overlay.html @@ -61,7 +61,9 @@ document.addEventListener("DOMContentLoaded", async() => { await diceBox.init() + let timeout = 0; evtSource.addEventListener("message", function (event) { + clearInterval(timeout); let data = JSON.parse(event.data); diceBox.onRollComplete = (rollResult) => { let httpRequest = new XMLHttpRequest(); @@ -74,7 +76,7 @@ results: rollResult, } )) if ({clearAfter} > 0) { - setTimeout(() => diceBox.clear(), {clearAfter} * 1000) + timeout = setTimeout(() => diceBox.clear(), {clearAfter} * 1000) } } diff --git a/src/main/resources/templates/pub/index.html b/src/main/resources/templates/pub/index.html index 71cd0ec..1f140ca 100644 --- a/src/main/resources/templates/pub/index.html +++ b/src/main/resources/templates/pub/index.html @@ -168,22 +168,40 @@ -
-
+
-
-

Example Commands: "1d6", "2d8 1d100", "1d4 and 1d6", "2d20 & 1d2, "5d6+10"

- -

- - + +
+ + + + + + + + + + + +
+
+ + + + +
+ +
+ + +