From 6377a99583a9e773ad3b90cacad6a12836376290 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Thu, 29 Jun 2023 07:47:33 +1000 Subject: [PATCH] feat: added ROM info modal --- gaseous-server/gaseous-server.csproj | 2 + gaseous-server/wwwroot/index.html | 16 +++- .../wwwroot/pages/dialogs/rominfo.html | 89 +++++++++++++++++++ gaseous-server/wwwroot/pages/game.html | 4 +- gaseous-server/wwwroot/scripts/main.js | 37 ++++++++ gaseous-server/wwwroot/styles/style.css | 49 ++++++++++ 6 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 gaseous-server/wwwroot/pages/dialogs/rominfo.html diff --git a/gaseous-server/gaseous-server.csproj b/gaseous-server/gaseous-server.csproj index ac0ffa6..547584f 100644 --- a/gaseous-server/gaseous-server.csproj +++ b/gaseous-server/gaseous-server.csproj @@ -104,6 +104,7 @@ + @@ -125,6 +126,7 @@ + diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index 29c8c95..b9c225b 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -22,10 +22,24 @@
- + +
+ + + \ No newline at end of file diff --git a/gaseous-server/wwwroot/pages/game.html b/gaseous-server/wwwroot/pages/game.html index f653bc1..56ffe81 100644 --- a/gaseous-server/wwwroot/pages/game.html +++ b/gaseous-server/wwwroot/pages/game.html @@ -34,7 +34,7 @@
-

ROM's

+

ROM's/Images

@@ -238,7 +238,7 @@ formatBytes(result[i].size, 2), result[i].romTypeMedia, result[i].mediaLabel, - '...' + '...' ]; newTable.appendChild(createTableRow(false, newRow, 'romrow', 'romcell')); } diff --git a/gaseous-server/wwwroot/scripts/main.js b/gaseous-server/wwwroot/scripts/main.js index de5e108..07b9ac7 100644 --- a/gaseous-server/wwwroot/scripts/main.js +++ b/gaseous-server/wwwroot/scripts/main.js @@ -33,4 +33,41 @@ function formatBytes(bytes, decimals = 2) { const i = Math.floor(Math.log(bytes) / Math.log(k)) return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` +} + +function showDialog(dialogPage, variables) { + // Get the modal + var modal = document.getElementById("myModal"); + + // Get the modal content + var modalContent = document.getElementById("modal-content"); + + // Get the button that opens the modal + var btn = document.getElementById("myBtn"); + + // Get the element that closes the modal + var span = document.getElementsByClassName("close")[0]; + + // When the user clicks on the button, open the modal + modal.style.display = "block"; + + // When the user clicks on (x), close the modal + span.onclick = function () { + modal.style.display = "none"; + modalContent.innerHTML = ""; + modalVariables = null; + } + + // When the user clicks anywhere outside of the modal, close it + window.onclick = function (event) { + if (event.target == modal) { + modal.style.display = "none"; + modalContent.innerHTML = ""; + modalVariables = null; + } + } + + modalVariables = variables; + + $('#modal-content').load('/pages/dialogs/' + dialogPage + '.html'); } \ No newline at end of file diff --git a/gaseous-server/wwwroot/styles/style.css b/gaseous-server/wwwroot/styles/style.css index 1305b25..80e91c5 100644 --- a/gaseous-server/wwwroot/styles/style.css +++ b/gaseous-server/wwwroot/styles/style.css @@ -22,6 +22,53 @@ h3 { border-image: linear-gradient(to right, rgba(255,0,0,1) 0%, rgba(251,255,0,1) 16%, rgba(0,255,250,1) 30%, rgba(0,16,255,1) 46%, rgba(250,0,255,1) 62%, rgba(255,0,0,1) 78%, rgba(255,237,0,1) 90%, rgba(20,255,0,1) 100%) 5; } +/* The Modal (background) */ +.modal { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +} + +/* Modal Content/Box */ +.modal-content { + background-color: #383838; + margin: 15% auto; /* 15% from the top and centered */ + padding: 10px; + border: 1px solid #888; + width: 600px; /* Could be more or less, depending on screen size */ +} +#modal-heading { + margin-block: 5px; + border-bottom-style: solid; + /*border-bottom-color: #916b01;*/ + border-bottom-width: 3px; + /*border-image: linear-gradient(to right, blue 25%, yellow 25%, yellow 50%,red 50%, red 75%, teal 75%) 5;*/ + + border-image: linear-gradient(to right, rgba(255,0,0,1) 0%, rgba(251,255,0,1) 16%, rgba(0,255,250,1) 30%, rgba(0,16,255,1) 46%, rgba(250,0,255,1) 62%, rgba(255,0,0,1) 78%, rgba(255,237,0,1) 90%, rgba(20,255,0,1) 100%) 5; +} + +/* The Close Button */ +.close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + #banner_icon { background-color: white; position: fixed; @@ -202,6 +249,7 @@ input[id='filter_panel_search'] { width: 90%; min-width: 911px; max-width: 1122px; + min-height: 550px; padding-top: 1px; padding-left: 20px; @@ -351,6 +399,7 @@ iframe { .romrow:hover { background-color: #383838; + background: rgba(56, 56, 56, 0.3); } .romcell {