Fixed random themes at first login. (this commit is from a macbook in Bilka)
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 21s

This commit is contained in:
BOTAlex 2025-05-31 17:00:48 +00:00
parent 11274585f6
commit 900888ee07

View file

@ -1,9 +1,12 @@
<!doctype html> <!doctype html>
<html lang="en" data-theme="Deprived" style="overflow-x: hidden;"> <html lang="en" data-theme="Deprived" style="overflow-x: hidden">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="description" content=" <meta
We are the deprived devs, and we are a team of developers specializing in indie game development, full-stack development, and anything tech-related!"> name="description"
content="
We are the deprived devs, and we are a team of developers specializing in indie game development, full-stack development, and anything tech-related!"
/>
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> <link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
@ -14,29 +17,26 @@
<script> <script>
let theme = null; let theme = null;
if (typeof localStorage !== 'undefined') { if (typeof localStorage !== "undefined") {
theme = localStorage.getItem('theme'); theme = localStorage.getItem("theme");
} }
window.AvailableThemes = ["green", "netherrack", "dark", "pink"]; window.AvailableThemes = ["green", "netherrack", "dark", "pink"];
if (!theme) { if (!theme) {
const randomNumber = Math.floor(Math.random() * 4); // const randomNumber = Math.floor(Math.random() * 4);
console.log("Slecting: " + AvailableThemes[randomNumber]); // console.log("Slecting: " + AvailableThemes[randomNumber]);
document.documentElement.setAttribute('data-theme', AvailableThemes[randomNumber]); // document.documentElement.setAttribute('data-theme', AvailableThemes[randomNumber]);
localStorage.setItem('theme', AvailableThemes[randomNumber]); localStorage.setItem("theme", AvailableThemes[0]);
} }
//else { //else {
// console.log("Slecting: " + theme); // console.log("Slecting: " + theme);
// document.documentElement.setAttribute('data-theme', theme); // document.documentElement.setAttribute('data-theme', theme);
//} //}
</script> </script>
</head> </head>
<body style="display: contents"> <body style="display: contents">
<div class="inline relative w-full h-full"> <div class="inline relative w-full h-full">%sveltekit.body%</div>
%sveltekit.body%
</div>
</body> </body>
</html> </html>