diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 33c9a8a..c9e9c6b 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -27,27 +27,6 @@ border-radius: 10px; } - .collapsible { - background-color: #333333; - color: black; - margin-top: 10px; - padding: 18px; - width: 100%; - border: none; - text-align: left; - outline: none; - font-size: 15px; - } - - .content { - padding: 0 18px; - display: none; - overflow: hidden; - background-color: #999999; - color: #000; - border-radius: 10px; - } - button { padding: 10px; border: #333333 3px solid; @@ -146,6 +125,7 @@ #dice-box { position: relative; + justify-self: center; box-sizing: border-box; width: 100%; height: 100%; @@ -156,7 +136,6 @@ #dice-box canvas { width: 100%; height: 100%; - margin: 20px } .checkbox { @@ -259,136 +238,139 @@
Only the last loaded instance of that overlay rolls the dice!
-Query Params you can Change:
-Only the last loaded instance of that overlay rolls the dice!
+Query Params you can Change:
+Shows all Results in this room
Shows only my Results in this room
Example Commands: "1d6", "2d8 1d100", "1d4 and 1d6", "2d20 & 1d2, "5d6+10"
+How is your character called?
Room: ' + document.getElementById('room').value + '
'; document.getElementById('overlayLabel').innerHTML = 'Dice-Overlay for ' + document.getElementById('name').value + ''; document.title = document.getElementById('name').value + ' - Dice-Tower'; @@ -471,6 +453,9 @@ if (localStorage.getItem(document.getElementById('name').value + "-themeColor")) { document.getElementById('themeColor').setColor(localStorage.getItem(document.getElementById('name').value + "-themeColor")); } + + document.getElementById('urls-overlay').showPopover(); + let httpRequest = new XMLHttpRequest(); httpRequest.open('POST', url() + '/dice/' + document.getElementById('room').value + '/register') httpRequest.setRequestHeader('Content-Type', 'application/json') @@ -497,20 +482,18 @@ let newLabel = document.createElement('label'); newLabel.for = data.id + 'url'; newLabel.innerHTML = "Dice-Overlay for " + data.name + ""; - let newInput = document.createElement('input'); + let newInput = document.getElementById('overlayId').cloneNode(); newInput.type = "text"; newInput.readOnly = true; newInput.id = data.id + 'url'; newInput.style.flexGrow = '1'; newInput.value = data.overlay; newInput.onclick = () => copyToClipboard(newInput.id) - let hint = document.getElementById('overlay-hint-button').cloneNode(true); newOverlay.appendChild(newLabel); newOverlay.appendChild(newInput); - newOverlay.appendChild(hint); overlays.appendChild(newOverlay); } - showPopover(); + configurePopover(); }); } } @@ -540,21 +523,6 @@ localStorage.setItem(document.getElementById('name').value + "-themeColor", document.getElementById('themeColor').value) } - let coll = document.getElementsByClassName("collapsible"); - - for (let i = 0; i < coll.length; i++) { - coll[i].addEventListener("click", function () { - const content = this.nextElementSibling; - if (content.style.display === "block") { - content.style.display = "none"; - this.children[0].innerHTML = "" - } else { - content.style.display = "block"; - this.children[0].innerHTML = "" - } - }); - } - if (localStorage.getItem('last-name') && localStorage.getItem('last-room')) { let rejoin = document.createElement('button'); rejoin.id = 'rejoin'; @@ -571,22 +539,22 @@ document.getElementById('start-container').appendChild(rejoin) } - function showPopover() { + function configurePopover() { const popover = document.querySelectorAll("[popovertarget][data-trigger='hover']"); popover.forEach((e) => { const target = document.querySelector("#" + e.getAttribute("popovertarget")); e.addEventListener("mouseover", () => { - target.showPopover(); + showSnackbar(target.innerHTML); }); e.addEventListener("mouseout", () => { - target.hidePopover(); + hideSnackbar(); }); }); } - showPopover(); + configurePopover(); document.getElementById('resultSwitch').addEventListener('change', function () { if (!this.checked) { @@ -616,10 +584,13 @@ snackbar.innerHTML = message; snackbar.className = "show"; snackbarContainer.className = "show"; - setTimeout(function () { - snackbar.className = snackbar.className.replace("show", ""); - snackbarContainer.className = snackbarContainer.className.replace("show", ""); - }, 5000); + } + + function hideSnackbar() { + let snackbar = document.getElementById("snackbar"); + let snackbarContainer = document.getElementById("snackbar-container"); + snackbar.className = snackbar.className.replace("show", ""); + snackbarContainer.className = snackbarContainer.className.replace("show", ""); } -