diff --git a/data/navBar.json b/data/navBar.json index a2175f2..568183c 100644 --- a/data/navBar.json +++ b/data/navBar.json @@ -31,6 +31,11 @@ "icon": "pauseAnimation_8x8.png", "action": "function", "actionValue": "pauseAnimBtn('auto')", - "iconId": "animationToggle" + "iconId": "animationToggle", + "disabled": false, + "alt": { + "name": "playDisabled", + "disabled": true + } } ] \ No newline at end of file diff --git a/global/globalScript.js b/global/globalScript.js index 453b869..273989a 100644 --- a/global/globalScript.js +++ b/global/globalScript.js @@ -137,7 +137,13 @@ function pauseAnimBtn(state) { } +function setVh() { + document.documentElement.style.setProperty("--vh", window.innerHeight * 0.01 + "px"); +} + + document.addEventListener("DOMContentLoaded", async function() { + debugPrint("currentPage", `${CURRENT_PAGE} ${Object.keys(PAGES)[CURRENT_PAGE + 1]}`) startLoadingScreen() @@ -180,6 +186,7 @@ document.addEventListener("DOMContentLoaded", async function() { window.addEventListener("resize", function() { + document.documentElement.style.setProperty("--vh", window.innerHeight * 0.01 + "px"); calcPixelDensity() switch (CURRENT_PAGE) { @@ -194,6 +201,11 @@ window.addEventListener("resize", function() { }) +if ("scrollRestoration" in history) { + history.scrollRestoration = "manual"; +} + + window.addEventListener("pageshow", (event) => { if (event.persisted) { // reload page to clear unwanted cache. diff --git a/global/globalStyle.css b/global/globalStyle.css index ec9dc31..91a7fa6 100644 --- a/global/globalStyle.css +++ b/global/globalStyle.css @@ -15,10 +15,10 @@ html { background-color: #323232; overflow: hidden; width: 100vw; - height: 100vh; + height: calc(var(--vh, 1vh) * 100); } body { - height: 100vh; + height: calc(var(--vh, 1vh) * 100); background-color: #323232; color: #ffffff; overflow: hidden; diff --git a/global/loadingScreen.css b/global/loadingScreen.css index 9d0f4d2..8cc53f4 100644 --- a/global/loadingScreen.css +++ b/global/loadingScreen.css @@ -4,7 +4,7 @@ top: 0%; left: 0%; width: 100vw; - height: 100vh; + height: calc(var(--vh, 1vh) * 100); } .loadingImg { position: absolute; @@ -19,7 +19,6 @@ 0% {opacity: 100%;} 100% {opacity: 0%;} } -/* custom pixel 3x5 font */ #loadingCornerText { background-color: transparent; color: #ffffff; @@ -31,8 +30,8 @@ cursor: pointer; } #loadingText { - position: absolute; - bottom: 0; + position: fixed; + bottom: 0%; left: calc(50vw - min(45vw, 250px)); width: min(90vw, 500px); text-align: center; @@ -40,4 +39,5 @@ display: flex; justify-content: center; color: #ffffff; + pointer-events: none; } \ No newline at end of file diff --git a/global/navBar.js b/global/navBar.js index f301034..b772a38 100644 --- a/global/navBar.js +++ b/global/navBar.js @@ -32,11 +32,12 @@ function onLoadNavBar() { function createNavBarBtn(icon = "", action = "", actionValue = "", iconId = "", alt = "", disabled = false) { if (alts.includes(alt["name"])) { - icon = alt["icon"] || "" - action = alt["action"] || "" - actionValue = alt["actionValue"] || "" - iconId = alt["iconId"] || "" - disabled = alt["disabled"] || false + icon = alt["icon"] || icon || "" + action = alt["action"] || action || "" + actionValue = alt["actionValue"] || actionValue || "" + iconId = alt["iconId"] || iconId || "" + + disabled = alt["disabled"] === undefined ? disabled : alt["disabled"] || false; } let onClick diff --git a/global/pxDensity.js b/global/pxDensity.js index 8b41224..4fc4cc4 100644 --- a/global/pxDensity.js +++ b/global/pxDensity.js @@ -1,4 +1,4 @@ -let pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) +let pxDensity = 1 let pxDensityDefined = false let pxWidth = 256 @@ -16,7 +16,7 @@ function calcPixelDensity() { document.documentElement.style.setProperty("--pxDensity", widest) document.documentElement.style.setProperty("--pxDensityPx", `${widest}px`) - pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) + pxDensity = widest pxDensityDefined = true } \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 0028cff..6fdac69 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -3,7 +3,7 @@ https://www.bytedice.net 1.00 - 2025-01-25 + 2025-01-27 https://www.bytedice.net/404.html @@ -13,11 +13,11 @@ https://www.bytedice.net/toys 0.67 - 2025-01-26 + 2025-01-27 https://www.bytedice.net/toys/license 0.33 - 2025-01-26 + 2025-01-27 \ No newline at end of file diff --git a/style.css b/style.css index 724545a..8f20761 100644 --- a/style.css +++ b/style.css @@ -18,11 +18,6 @@ image-rendering: pixelated; transform: translate(-50%, -50%); } -#mainDiv { - overflow: hidden; - width: 100vw; - height: 100vh; -} .bgGradient { image-rendering: pixelated; width: calc(256px * var(--pxDensity)); diff --git a/toys/index.html b/toys/index.html index 695cac5..19946e8 100644 --- a/toys/index.html +++ b/toys/index.html @@ -16,7 +16,7 @@
- +