diff --git a/WebHostLib/static/assets/gameInfo.js b/WebHostLib/static/assets/gameInfo.js index 1d6d1361..797c9f64 100644 --- a/WebHostLib/static/assets/gameInfo.js +++ b/WebHostLib/static/assets/gameInfo.js @@ -23,7 +23,6 @@ window.addEventListener('load', () => { showdown.setOption('strikethrough', true); showdown.setOption('literalMidWordUnderscores', true); gameInfo.innerHTML += (new showdown.Converter()).makeHtml(results); - adjustHeaderWidth(); // Reset the id of all header divs to something nicer for (const header of document.querySelectorAll('h1, h2, h3, h4, h5, h6')) { diff --git a/WebHostLib/static/assets/hostGame.js b/WebHostLib/static/assets/hostGame.js index db1ab1dd..01a8da06 100644 --- a/WebHostLib/static/assets/hostGame.js +++ b/WebHostLib/static/assets/hostGame.js @@ -6,6 +6,4 @@ window.addEventListener('load', () => { document.getElementById('file-input').addEventListener('change', () => { document.getElementById('host-game-form').submit(); }); - - adjustFooterHeight(); }); diff --git a/WebHostLib/static/assets/styleController.js b/WebHostLib/static/assets/styleController.js deleted file mode 100644 index 924e86ee..00000000 --- a/WebHostLib/static/assets/styleController.js +++ /dev/null @@ -1,47 +0,0 @@ -const adjustFooterHeight = () => { - // If there is no footer on this page, do nothing - const footer = document.getElementById('island-footer'); - if (!footer) { return; } - - // If the body is taller than the window, also do nothing - if (document.body.offsetHeight > window.innerHeight) { - footer.style.marginTop = '0'; - return; - } - - // Add a margin-top to the footer to position it at the bottom of the screen - const sibling = footer.previousElementSibling; - const margin = (window.innerHeight - sibling.offsetTop - sibling.offsetHeight - footer.offsetHeight); - if (margin < 1) { - footer.style.marginTop = '0'; - return; - } - footer.style.marginTop = `${margin}px`; -}; - -const adjustHeaderWidth = () => { - // If there is no header, do nothing - const header = document.getElementById('base-header'); - if (!header) { return; } - - const tempDiv = document.createElement('div'); - tempDiv.style.width = '100px'; - tempDiv.style.height = '100px'; - tempDiv.style.overflow = 'scroll'; - tempDiv.style.position = 'absolute'; - tempDiv.style.top = '-500px'; - document.body.appendChild(tempDiv); - const scrollbarWidth = tempDiv.offsetWidth - tempDiv.clientWidth; - document.body.removeChild(tempDiv); - - const documentRoot = document.compatMode === 'BackCompat' ? document.body : document.documentElement; - const margin = (documentRoot.scrollHeight > documentRoot.clientHeight) ? 0-scrollbarWidth : 0; - document.getElementById('base-header-right').style.marginRight = `${margin}px`; -}; - -window.addEventListener('load', () => { - window.addEventListener('resize', adjustFooterHeight); - window.addEventListener('resize', adjustHeaderWidth); - adjustFooterHeight(); - adjustHeaderWidth(); -}); diff --git a/WebHostLib/static/assets/tutorial.js b/WebHostLib/static/assets/tutorial.js index d5279660..c9022719 100644 --- a/WebHostLib/static/assets/tutorial.js +++ b/WebHostLib/static/assets/tutorial.js @@ -25,7 +25,6 @@ window.addEventListener('load', () => { showdown.setOption('literalMidWordUnderscores', true); showdown.setOption('disableForced4SpacesIndentedSublists', true); tutorialWrapper.innerHTML += (new showdown.Converter()).makeHtml(results); - adjustHeaderWidth(); const title = document.querySelector('h1') if (title) { diff --git a/WebHostLib/static/styles/globalStyles.css b/WebHostLib/static/styles/globalStyles.css index 1a014483..adcee658 100644 --- a/WebHostLib/static/styles/globalStyles.css +++ b/WebHostLib/static/styles/globalStyles.css @@ -36,6 +36,13 @@ html{ body{ margin: 0; + display: flex; + flex-direction: column; + min-height: calc(100vh - 110px); +} + +main { + flex-grow: 1; } a{ diff --git a/WebHostLib/templates/404.html b/WebHostLib/templates/404.html index 9d567510..6c91fed4 100644 --- a/WebHostLib/templates/404.html +++ b/WebHostLib/templates/404.html @@ -1,5 +1,6 @@ {% extends 'pageWrapper.html' %} {% import "macros.html" as macros %} +{% set show_footer = True %} {% block head %} Page Not Found (404) @@ -13,5 +14,4 @@ The page you're looking for doesn't exist.
Click here to return to safety. - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/hostGame.html b/WebHostLib/templates/hostGame.html index 2bcb993a..d7d0a963 100644 --- a/WebHostLib/templates/hostGame.html +++ b/WebHostLib/templates/hostGame.html @@ -1,4 +1,5 @@ {% extends 'pageWrapper.html' %} +{% set show_footer = True %} {% block head %} Upload Multidata @@ -27,6 +28,4 @@ - - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/landing.html b/WebHostLib/templates/landing.html index b489ef18..e7d0569e 100644 --- a/WebHostLib/templates/landing.html +++ b/WebHostLib/templates/landing.html @@ -1,4 +1,5 @@ {% extends 'pageWrapper.html' %} +{% set show_footer = True %} {% block head %} Archipelago @@ -57,5 +58,4 @@ - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/pageWrapper.html b/WebHostLib/templates/pageWrapper.html index c7dda523..4347b4ad 100644 --- a/WebHostLib/templates/pageWrapper.html +++ b/WebHostLib/templates/pageWrapper.html @@ -5,26 +5,29 @@ - {% block head %} Archipelago {% endblock %} +
+ {% with messages = get_flashed_messages() %} + {% if messages %} +
+ {% for message in messages | unique %} +
{{ message }}
+ {% endfor %} +
+ {% endif %} + {% endwith %} -{% with messages = get_flashed_messages() %} - {% if messages %} -
- {% for message in messages | unique %} -
{{ message }}
- {% endfor %} -
+ {% block body %} + {% endblock %} +
+ + {% if show_footer %} + {% include "islandFooter.html" %} {% endif %} -{% endwith %} - -{% block body %} -{% endblock %} - diff --git a/WebHostLib/templates/seedError.html b/WebHostLib/templates/seedError.html index 0f5850da..a5eec1a4 100644 --- a/WebHostLib/templates/seedError.html +++ b/WebHostLib/templates/seedError.html @@ -1,5 +1,6 @@ {% extends 'pageWrapper.html' %} {% import "macros.html" as macros %} +{% set show_footer = True %} {% block head %} Generation failed, please retry. @@ -15,5 +16,4 @@ {{ seed_error }} - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/startPlaying.html b/WebHostLib/templates/startPlaying.html index ab2f021d..9e09474b 100644 --- a/WebHostLib/templates/startPlaying.html +++ b/WebHostLib/templates/startPlaying.html @@ -1,4 +1,5 @@ {% extends 'pageWrapper.html' %} +{% set show_footer = True %} {% block head %} Start Playing @@ -26,6 +27,4 @@

- - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/viewSeed.html b/WebHostLib/templates/viewSeed.html index a8478c95..70ffe23b 100644 --- a/WebHostLib/templates/viewSeed.html +++ b/WebHostLib/templates/viewSeed.html @@ -1,5 +1,6 @@ {% extends 'pageWrapper.html' %} {% import "macros.html" as macros %} +{% set show_footer = True %} {% block head %} View Seed {{ seed.id|suuid }} @@ -50,5 +51,4 @@ - {% include 'islandFooter.html' %} {% endblock %} diff --git a/WebHostLib/templates/waitSeed.html b/WebHostLib/templates/waitSeed.html index 9041b901..235c2f16 100644 --- a/WebHostLib/templates/waitSeed.html +++ b/WebHostLib/templates/waitSeed.html @@ -1,5 +1,6 @@ {% extends 'pageWrapper.html' %} {% import "macros.html" as macros %} +{% set show_footer = True %} {% block head %} Generation in Progress @@ -15,5 +16,4 @@ Waiting for game to generate, this page auto-refreshes to check. - {% include 'islandFooter.html' %} {% endblock %}