diff --git a/global/globalScript.js b/global/globalScript.js
index 85fcf86..497baa4 100644
--- a/global/globalScript.js
+++ b/global/globalScript.js
@@ -161,10 +161,14 @@ document.addEventListener("DOMContentLoaded", async function() {
debugPrint("isAnimating", isAnimating)
if (showLoading != "true") {
- removeLoadingScreen()
+ removeLoadingScreen(true)
}
else {
setLoadingProgress("Cleaning up...")
+ loadingComplete = true
+ if (fakeLoadingComplete) {
+ removeLoadingScreen()
+ }
}
}, false)
diff --git a/global/loadingScreen.js b/global/loadingScreen.js
index 7248a58..568d9c2 100644
--- a/global/loadingScreen.js
+++ b/global/loadingScreen.js
@@ -1,6 +1,8 @@
let isLoading = true
let stopLoading = false
let loadingScreenEl = document.getElementById("loadingScreen")
+let loadingComplete = false
+let fakeLoadingComplete = false
loadingScreenEl.className = "bgDiv"
@@ -52,18 +54,20 @@ function setLoadingProgress(newText) {
loadingScreenProgress.innerHTML = `Loading...
${newText}
Tip: ${selectedTip}`
}
-
function startLoadingScreen() {
loadingScreenProgress.innerHTML = `Loading...
Tip: ${selectedTip}`
- const loadDur = randomFloat(3000, 6000)
+ const loadDur = randomFloat(2000, 4000)
debugPrint("loadDur initial", loadDur)
- setTimeout(removeLoadingScreen, loadDur)
+ setTimeout(function() {
+ if (loadingComplete) { removeLoadingScreen() }
+ fakeLoadingComplete = true
+ }, loadDur)
}
-function removeLoadingScreen() {
+function removeLoadingScreen(rmCornerText = false) {
if (!isLoading) { return }
setLoadingProgress("Done!")
@@ -76,8 +80,9 @@ function removeLoadingScreen() {
setTimeout(function() {
loadingScreenEl.style.left = "100vw"
- loadingScreenEl.style.pointerEvents = "none"
- document.getElementById("loadingCornerText").remove()
+ if (rmCornerText) {
+ document.getElementById("loadingCornerText").remove()
+ }
newTip()
}, fadeOutDur * 1000)
}, 500)
diff --git a/global/navBar.js b/global/navBar.js
index 7660abf..7f57a73 100644
--- a/global/navBar.js
+++ b/global/navBar.js
@@ -39,7 +39,7 @@ function createNavBarBtn(icon = "", action = "", actionValue = "", iconId = "",
let onClick
switch (action) {
- case "navigate": onClick = `slideTransition('${actionValue}')`; break
+ case "navigate": onClick = `slideTransition('${actionValue}', event)`; break
case "function": onClick = `${actionValue}`; break
default: ""
}
diff --git a/global/screenTransition.js b/global/screenTransition.js
index 98999f4..8da77ac 100644
--- a/global/screenTransition.js
+++ b/global/screenTransition.js
@@ -1,13 +1,14 @@
-function slideTransition(url) {
+let loadingScreen = document.getElementById("loadingScreen")
+let mainDiv = document.getElementById("mainDiv")
+
+function slideTransition(url, event) {
+ const ctrlPressed = event.ctrlKey
const dur = 500
const loadingTime = randomFloat(500, 1500)
debugPrint("loadDur transition", loadingTime)
const slideLeft = `slide-left ${dur / 1000}s cubic-bezier(0, 0, 0, 1.46) forwards`
- let loadingScreen = document.getElementById("loadingScreen")
- let mainDiv = document.getElementById("mainDiv")
-
loadingScreen.style.animation = slideLeft
loadingScreen.style.pointerEvents = "auto"
mainDiv.style.animation = slideLeft
@@ -16,6 +17,30 @@ function slideTransition(url) {
setTimeout(function() {
setLoadingProgress("Done!")
- setTimeout(function() { document.location = url }, loadingTime)
+ setTimeout(function() {
+ if (ctrlPressed) {
+ window.open(url, "_blank")
+ }
+ else if (url.startsWith("http")) {
+ window.open(url, "_blank").focus()
+ }
+ else {
+ document.location = url
+ }
+
+ resetLoadingScreen()
+ }, loadingTime)
}, dur + loadingTime)
+}
+
+function resetLoadingScreen() {
+ const fadeOutDur = 0.5
+
+ loadingScreen.style.left = "0vw"
+ loadingScreen.style.animation = `fade-out ${fadeOutDur}s forwards`
+ mainDiv.style.animation = "none"
+
+ setTimeout(function() {
+ loadingScreen.style.left = "100vw"
+ }, fadeOutDur * 1000)
}
\ No newline at end of file
diff --git a/toys/index.html b/toys/index.html
index 3f8594d..cb7f29a 100644
--- a/toys/index.html
+++ b/toys/index.html
@@ -20,7 +20,7 @@