11 Commits
1.2.0 ... 1.2.3

Author SHA1 Message Date
gitea
ab51fdc281 [no ci] release 1.2.3 2025-02-22 11:44:25 +00:00
c04b4f67d2 Merge pull request 'reregister users on roll' (#38) from register-user-on-roll into main
All checks were successful
CI / deploy (push) Successful in 6m6s
Reviewed-on: #38
2025-02-22 12:38:27 +01:00
d030eda0e9 reregister users on roll
All checks were successful
CI / deploy (push) Successful in 5m48s
CI / deploy (pull_request) Successful in 6m0s
2025-02-22 12:16:22 +01:00
gitea
8a4032756e [no ci] prepare new Version 2025-02-16 19:05:25 +00:00
gitea
717d337535 [no ci] release 1.2.2 2025-02-16 19:05:17 +00:00
c79cce8651 Merge pull request 'adds install button' (#35) from install-as-app into main
All checks were successful
CI / deploy (push) Successful in 5m42s
Reviewed-on: #35
2025-02-16 19:59:43 +01:00
fc82d0397f adds install button
All checks were successful
CI / deploy (push) Successful in 5m42s
CI / deploy (pull_request) Successful in 5m37s
2025-02-16 19:45:54 +01:00
gitea
cd9942068f [no ci] prepare new Version 2025-02-16 17:52:56 +00:00
gitea
fb4c0e7b92 [no ci] release 1.2.1 2025-02-16 17:52:49 +00:00
1a0528933b adds d2 to easy roll
All checks were successful
CI / deploy (push) Successful in 5m49s
2025-02-16 18:47:02 +01:00
gitea
0d324239bf [no ci] prepare new Version 2025-02-16 17:37:27 +00:00
7 changed files with 78 additions and 31 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.arindy</groupId> <groupId>de.arindy</groupId>
<artifactId>dice-tower</artifactId> <artifactId>dice-tower</artifactId>
<version>1.2.0</version> <version>1.2.3</version>
<properties> <properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version> <compiler-plugin.version>3.13.0</compiler-plugin.version>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -14,6 +14,17 @@ function url() {
return window.location.protocol + '//' + window.location.hostname + (window.location.port?.length > 0 ? ':' + window.location.port : ''); return window.location.protocol + '//' + window.location.hostname + (window.location.port?.length > 0 ? ':' + window.location.port : '');
} }
function register() {
let httpRequest = new XMLHttpRequest();
httpRequest.open('POST', url() + '/dice/' + document.getElementById('room').value + '/register')
httpRequest.setRequestHeader('Content-Type', 'application/json')
httpRequest.send(JSON.stringify({
name: document.getElementById('name').value,
overlay: document.getElementById('overlayId').value,
id: document.getElementById('room').value + ':' + localStorage.getItem('userId')
}))
}
function start(event = undefined) { function start(event = undefined) {
if ((!event || event.keyCode === 13) && document.getElementById('name').value.length > 0 && document.getElementById('room').value.length > 0) { if ((!event || event.keyCode === 13) && document.getElementById('name').value.length > 0 && document.getElementById('room').value.length > 0) {
document.getElementById('overlayId').value = url() + '/overlay/' + document.getElementById('room').value + ':' + localStorage.getItem('userId') + '?scale=10&clearAfter=30'; document.getElementById('overlayId').value = url() + '/overlay/' + document.getElementById('room').value + ':' + localStorage.getItem('userId') + '?scale=10&clearAfter=30';
@@ -61,14 +72,7 @@ function start(event = undefined) {
localStorage.setItem(document.getElementById('name').value + '-started', "true") localStorage.setItem(document.getElementById('name').value + '-started', "true")
let httpRequest = new XMLHttpRequest(); register();
httpRequest.open('POST', url() + '/dice/' + document.getElementById('room').value + '/register')
httpRequest.setRequestHeader('Content-Type', 'application/json')
httpRequest.send(JSON.stringify({
name: document.getElementById('name').value,
overlay: document.getElementById('overlayId').value,
id: document.getElementById('room').value + ':' + localStorage.getItem('userId')
}))
if (document.getElementById('gm').checked) { if (document.getElementById('gm').checked) {
document.getElementById('resultSwitch').checked = true; document.getElementById('resultSwitch').checked = true;
document.getElementById('resultFrame').src = document.getElementById('resultsId').value; document.getElementById('resultFrame').src = document.getElementById('resultsId').value;
@@ -98,18 +102,21 @@ function start(event = undefined) {
newOverlay.appendChild(newInput); newOverlay.appendChild(newInput);
overlays.appendChild(newOverlay); overlays.appendChild(newOverlay);
let dice = document.createElement('iframe'); if (!document.getElementById(data.id + '-diceFrame')) {
dice.id = data.id + '-diceFrame' let dice = document.createElement('iframe');
dice.style.width = "50%"; dice.id = data.id + '-diceFrame'
dice.style.height = "100%"; dice.style.width = "50%";
dice.style.overflow = "hidden"; dice.style.height = "100%";
dice.style.border = "0"; dice.style.overflow = "hidden";
dice.style.zIndex = "4"; dice.style.border = "0";
dice.style.position = "absolute"; dice.style.zIndex = "4";
dice.style.top = "0"; dice.style.position = "absolute";
dice.style.left = "50%"; dice.style.top = "0";
dice.src = data.overlay; dice.style.left = "50%";
document.getElementById('results-dice').appendChild(dice) dice.src = data.overlay;
document.getElementById('results-dice').appendChild(dice)
}
} }
configurePopover(); configurePopover();
@@ -125,6 +132,7 @@ function rollEasy(dice) {
function roll(event) { function roll(event) {
if ((!event || event.keyCode === 13) && document.getElementById('command').value?.length > 0) { if ((!event || event.keyCode === 13) && document.getElementById('command').value?.length > 0) {
register()
let httpRequest = new XMLHttpRequest(); let httpRequest = new XMLHttpRequest();
httpRequest.open('POST', url() + '/dice/' + document.getElementById('room').value + ':' + localStorage.getItem(`userId`)) httpRequest.open('POST', url() + '/dice/' + document.getElementById('room').value + ':' + localStorage.getItem(`userId`))
httpRequest.setRequestHeader('Content-Type', 'application/json') httpRequest.setRequestHeader('Content-Type', 'application/json')
@@ -207,11 +215,7 @@ document.addEventListener("DOMContentLoaded", async () => {
}) })
document.getElementById('resultDiceSwitch').addEventListener('change', function () { document.getElementById('resultDiceSwitch').addEventListener('change', function () {
if (!this.checked) { document.getElementById('results-dice').hidden = !this.checked;
document.getElementById('results-dice').hidden = true
} else {
document.getElementById('results-dice').hidden = false
}
}) })
document.getElementById('chatOverlayLink').href = url() + '/chatoverlay' document.getElementById('chatOverlayLink').href = url() + '/chatoverlay'

View File

@@ -0,0 +1,18 @@
{
"name": "Dice-Tower",
"icons": [
{
"src": "192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/",
"display_override": ["window-controls-overlay", "minimal-ui"],
"display": "standalone"
}

View File

@@ -32,6 +32,22 @@ button:active {
background: #222222; background: #222222;
} }
#install {
padding: 10px;
border: #666666 3px solid;
border-radius: 10px;
background: #666666;
color: #fff
}
#install:hover {
background: #444444;
}
#install:active {
background: #222222;
}
input { input {
margin: 10px; margin: 10px;
} }

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Dice-Tower</title> <title>Dice-Tower</title>
<meta name="version" content="{version}"> <meta name="version" content="{version}">
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="/vendor/w3css/4/w3.css"> <link rel="stylesheet" href="/vendor/w3css/4/w3.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/fontawesome.css"> <link rel="stylesheet" href="/vendor/font-awesome/css/fontawesome.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/all.css"> <link rel="stylesheet" href="/vendor/font-awesome/css/all.css">
@@ -33,6 +33,17 @@
if (!localStorage.getItem("userId")) { if (!localStorage.getItem("userId")) {
localStorage.setItem("userId", self.crypto.randomUUID()); localStorage.setItem("userId", self.crypto.randomUUID());
} }
addEventListener("beforeinstallprompt", (event) => {
event.preventDefault()
let install = document.createElement('button');
install.id = 'install'
install.style.position = 'absolute'
install.style.top = '25px'
install.style.right = '25px'
install.innerHTML = 'Install Dice-Tower'
install.onclick = () => event.prompt()
document.body.appendChild(install)
});
</script> </script>
<div class="w3-container w3-content" <div class="w3-container w3-content"
style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px"> style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px">
@@ -78,6 +89,7 @@
<button style="border: transparent; border-radius: 100%; font-size: large; font-weight: bold; height: 50px; width: 50px" <button style="border: transparent; border-radius: 100%; font-size: large; font-weight: bold; height: 50px; width: 50px"
onclick="addDice()">+ onclick="addDice()">+
</button> </button>
<button style="font-size: large; font-weight: bold;" onclick="rollEasy('d2')">D2</button>
<button style="font-size: large; font-weight: bold;" onclick="rollEasy('d4')">D4</button> <button style="font-size: large; font-weight: bold;" onclick="rollEasy('d4')">D4</button>
<button style="font-size: large; font-weight: bold;" onclick="rollEasy('d6')">D6</button> <button style="font-size: large; font-weight: bold;" onclick="rollEasy('d6')">D6</button>
<button style="font-size: large; font-weight: bold;" onclick="rollEasy('d8')">D8</button> <button style="font-size: large; font-weight: bold;" onclick="rollEasy('d8')">D8</button>
@@ -190,11 +202,8 @@
<h2 style="text-align: center">How-To</h2> <h2 style="text-align: center">How-To</h2>
<ul> <ul>
<li> <li>
Join a room by entering your character name and the name of the room.<br/> Join a room by entering your character name and the name of the room
<strong>If you are a GM, make sure to join the room first or let all other players rejoin to get all
Overlay-URLs.</strong>
</li> </li>
<li>Open your Dice-Overlay either in a new Tab or as a browser source in OBS</li> <li>Open your Dice-Overlay either in a new Tab or as a browser source in OBS</li>
<ul> <ul>
<li>You can configure your Overlay with query parameters (for more information hover over the link) <li>You can configure your Overlay with query parameters (for more information hover over the link)