add an index page for all tools

This commit is contained in:
Greg Gauthier 2024-06-27 14:47:52 +01:00
parent 7f6464e89b
commit 204ef94d6a
2 changed files with 46 additions and 1 deletions

45
web/index.html Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gamma World Gaming Tools</title>
</head>
<body>
<div style="text-align: center">
<h1>Gamma World Gaming Tools</h1>
</div>
<div id="button-panel" style="text-align: center">
<button id="dieroller">Dice</button>
<button id="chargen">Characters</button>
<button id="encounter">Encounters</button>
</div>
<hr/>
<div id="toolPanel"></div>
<script>
document.getElementById("dieroller").addEventListener("click", function() {
loadContent("rolldice.html");
});
document.getElementById("chargen").addEventListener("click", function() {
loadContent("chargen.html");
});
document.getElementById("encounter").addEventListener("click", function() {
loadContent("encounter.html");
});
function loadContent(pageUrl) {
var iframe = document.createElement('iframe');
iframe.src = pageUrl;
iframe.style.width = '100%'; // make the iframe take full width of the container
iframe.style.border = 'none'; // hide the border
iframe.style.overflow = 'hidden'; // hide scrollbars, can be 'auto' if you prefer automatic scrollbars
iframe.style.height = '1000px'; // set a height so that the iframe is visible, adjust as per your needs
document.getElementById("toolPanel").innerHTML = '';
document.getElementById("toolPanel").appendChild(iframe);
}
</script>
</body>
</html>

View File

@ -13,7 +13,7 @@
const geometry = parseInt(document.getElementById('geometry').value, 10);
const discard = document.getElementById('discard').checked;
fetch('http://localhost:5000/roll/dice', {
fetch('https://gammaworld.gmgauthier.com/roll/dice', {
method: 'POST',
headers: {
'Content-Type': 'application/json',