made EVEN MORE mobile compatible (missing screenTransition tips text & license font)

This commit is contained in:
2025-01-27 21:15:59 +01:00
parent 4744c4ba1c
commit edfc47c1cc
11 changed files with 39 additions and 25 deletions
+6 -1
View File
@@ -31,6 +31,11 @@
"icon": "pauseAnimation_8x8.png", "icon": "pauseAnimation_8x8.png",
"action": "function", "action": "function",
"actionValue": "pauseAnimBtn('auto')", "actionValue": "pauseAnimBtn('auto')",
"iconId": "animationToggle" "iconId": "animationToggle",
"disabled": false,
"alt": {
"name": "playDisabled",
"disabled": true
}
} }
] ]
+12
View File
@@ -137,7 +137,13 @@ function pauseAnimBtn(state) {
} }
function setVh() {
document.documentElement.style.setProperty("--vh", window.innerHeight * 0.01 + "px");
}
document.addEventListener("DOMContentLoaded", async function() { document.addEventListener("DOMContentLoaded", async function() {
debugPrint("currentPage", `${CURRENT_PAGE} ${Object.keys(PAGES)[CURRENT_PAGE + 1]}`) debugPrint("currentPage", `${CURRENT_PAGE} ${Object.keys(PAGES)[CURRENT_PAGE + 1]}`)
startLoadingScreen() startLoadingScreen()
@@ -180,6 +186,7 @@ document.addEventListener("DOMContentLoaded", async function() {
window.addEventListener("resize", function() { window.addEventListener("resize", function() {
document.documentElement.style.setProperty("--vh", window.innerHeight * 0.01 + "px");
calcPixelDensity() calcPixelDensity()
switch (CURRENT_PAGE) { switch (CURRENT_PAGE) {
@@ -194,6 +201,11 @@ window.addEventListener("resize", function() {
}) })
if ("scrollRestoration" in history) {
history.scrollRestoration = "manual";
}
window.addEventListener("pageshow", (event) => { window.addEventListener("pageshow", (event) => {
if (event.persisted) { if (event.persisted) {
// reload page to clear unwanted cache. // reload page to clear unwanted cache.
+2 -2
View File
@@ -15,10 +15,10 @@ html {
background-color: #323232; background-color: #323232;
overflow: hidden; overflow: hidden;
width: 100vw; width: 100vw;
height: 100vh; height: calc(var(--vh, 1vh) * 100);
} }
body { body {
height: 100vh; height: calc(var(--vh, 1vh) * 100);
background-color: #323232; background-color: #323232;
color: #ffffff; color: #ffffff;
overflow: hidden; overflow: hidden;
+4 -4
View File
@@ -4,7 +4,7 @@
top: 0%; top: 0%;
left: 0%; left: 0%;
width: 100vw; width: 100vw;
height: 100vh; height: calc(var(--vh, 1vh) * 100);
} }
.loadingImg { .loadingImg {
position: absolute; position: absolute;
@@ -19,7 +19,6 @@
0% {opacity: 100%;} 0% {opacity: 100%;}
100% {opacity: 0%;} 100% {opacity: 0%;}
} }
/* custom pixel 3x5 font */
#loadingCornerText { #loadingCornerText {
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
@@ -31,8 +30,8 @@
cursor: pointer; cursor: pointer;
} }
#loadingText { #loadingText {
position: absolute; position: fixed;
bottom: 0; bottom: 0%;
left: calc(50vw - min(45vw, 250px)); left: calc(50vw - min(45vw, 250px));
width: min(90vw, 500px); width: min(90vw, 500px);
text-align: center; text-align: center;
@@ -40,4 +39,5 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
color: #ffffff; color: #ffffff;
pointer-events: none;
} }
+6 -5
View File
@@ -32,11 +32,12 @@ function onLoadNavBar() {
function createNavBarBtn(icon = "", action = "", actionValue = "", iconId = "", alt = "", disabled = false) { function createNavBarBtn(icon = "", action = "", actionValue = "", iconId = "", alt = "", disabled = false) {
if (alts.includes(alt["name"])) { if (alts.includes(alt["name"])) {
icon = alt["icon"] || "" icon = alt["icon"] || icon || ""
action = alt["action"] || "" action = alt["action"] || action || ""
actionValue = alt["actionValue"] || "" actionValue = alt["actionValue"] || actionValue || ""
iconId = alt["iconId"] || "" iconId = alt["iconId"] || iconId || ""
disabled = alt["disabled"] || false
disabled = alt["disabled"] === undefined ? disabled : alt["disabled"] || false;
} }
let onClick let onClick
+2 -2
View File
@@ -1,4 +1,4 @@
let pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) let pxDensity = 1
let pxDensityDefined = false let pxDensityDefined = false
let pxWidth = 256 let pxWidth = 256
@@ -16,7 +16,7 @@ function calcPixelDensity() {
document.documentElement.style.setProperty("--pxDensity", widest) document.documentElement.style.setProperty("--pxDensity", widest)
document.documentElement.style.setProperty("--pxDensityPx", `${widest}px`) document.documentElement.style.setProperty("--pxDensityPx", `${widest}px`)
pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) pxDensity = widest
pxDensityDefined = true pxDensityDefined = true
} }
+3 -3
View File
@@ -3,7 +3,7 @@
<url> <url>
<loc>https://www.bytedice.net</loc> <loc>https://www.bytedice.net</loc>
<priority>1.00</priority> <priority>1.00</priority>
<lastmod>2025-01-25</lastmod> <lastmod>2025-01-27</lastmod>
</url> </url>
<url> <url>
<loc>https://www.bytedice.net/404.html</loc> <loc>https://www.bytedice.net/404.html</loc>
@@ -13,11 +13,11 @@
<url> <url>
<loc>https://www.bytedice.net/toys</loc> <loc>https://www.bytedice.net/toys</loc>
<priority>0.67</priority> <priority>0.67</priority>
<lastmod>2025-01-26</lastmod> <lastmod>2025-01-27</lastmod>
</url> </url>
<url> <url>
<loc>https://www.bytedice.net/toys/license</loc> <loc>https://www.bytedice.net/toys/license</loc>
<priority>0.33</priority> <priority>0.33</priority>
<lastmod>2025-01-26</lastmod> <lastmod>2025-01-27</lastmod>
</url> </url>
</urlset> </urlset>
-5
View File
@@ -18,11 +18,6 @@
image-rendering: pixelated; image-rendering: pixelated;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
#mainDiv {
overflow: hidden;
width: 100vw;
height: 100vh;
}
.bgGradient { .bgGradient {
image-rendering: pixelated; image-rendering: pixelated;
width: calc(256px * var(--pxDensity)); width: calc(256px * var(--pxDensity));
+1 -1
View File
@@ -16,7 +16,7 @@
<body> <body>
<div id="mainDiv"> <div id="mainDiv">
<div id="navBarContainer" data-alt="byte"></div> <div id="navBarContainer" data-alt="byte, playDisabled"></div>
<ul> <ul>
<li class="toyLi"> <li class="toyLi">
+2 -2
View File
@@ -44,8 +44,6 @@
<!-- Proof that I am Byte Dice? Check the commit history. --> <!-- Proof that I am Byte Dice? Check the commit history. -->
<div id="mainDiv"> <div id="mainDiv">
<div id="navBarContainer" data-alt="byte"></div>
<div class="allContainer"> <div class="allContainer">
<div id="optionsContainer" class="borderedRect"> <div id="optionsContainer" class="borderedRect">
<h1 class="optionsCredits h1Top"> <h1 class="optionsCredits h1Top">
@@ -186,6 +184,8 @@
<p id="credits_600x400">Original by Chilli<br>Remade by Byte Dice at bytedice.net/toys</p> <p id="credits_600x400">Original by Chilli<br>Remade by Byte Dice at bytedice.net/toys</p>
</div> </div>
<div id="navBarContainer" data-alt="byte, playDisabled"></div>
</div> </div>
<div id="loadingScreen"></div> <div id="loadingScreen"></div>
+1
View File
@@ -6,6 +6,7 @@
padding: calc(2px * var(--pxDensity)); padding: calc(2px * var(--pxDensity));
overflow-y: scroll; overflow-y: scroll;
max-width: min(600px, 100vw); max-width: min(600px, 100vw);
max-height: 40vh;
flex-grow: 1; flex-grow: 1;
font-size: calc(4px * var(--pxDensity)); font-size: calc(4px * var(--pxDensity));
} }