diff --git a/globalScript.js b/globalScript.js index 6525491..66e0ce3 100644 --- a/globalScript.js +++ b/globalScript.js @@ -1,3 +1,10 @@ +const PAGES = { + null: -1, + SYNTHWAVE: 0, +} + +let CURRENT_PAGE = PAGES.null + let isAnimating = true function randomFloat(min, max) { @@ -19,9 +26,9 @@ function clampNearest(n, mul) { if(n > 0) return Math.ceil(n / mul) * mul; else if( n < 0) - return Math.floor(n / mul) * mul; + return Math.floor(n / mul) * mul; else - return 0; + return 0; } @@ -78,4 +85,31 @@ function pauseAnimBtn(state) { } localStorage["isAnimating"] = state -} \ No newline at end of file +} + + +document.addEventListener("DOMContentLoaded", async function() { + startLoadingScreen() + + setLoadingProgress("Fetching tips...") + + await loadTips() + + newTip() + + setLoadingProgress("Calculating pixel density...") + calcPixelDensity() + + switch (CURRENT_PAGE) { + case (PAGES.SYNTHWAVE): loadingScreenSynthwave() + } + + pauseAnimBtn(localStorage["isAnimating"] || "true") + + if (showLoading != "true") { + removeLoadingScreen() + } + else { + setLoadingProgress("Cleaning up...") + } +}, false) \ No newline at end of file diff --git a/index.html b/index.html index b9c65f0..d755a93 100644 --- a/index.html +++ b/index.html @@ -67,12 +67,16 @@
Loading...
Loading files...
Tip: Tip loading...