added ctrl-clicking to link buttons
This commit is contained in:
@@ -161,10 +161,14 @@ document.addEventListener("DOMContentLoaded", async function() {
|
|||||||
debugPrint("isAnimating", isAnimating)
|
debugPrint("isAnimating", isAnimating)
|
||||||
|
|
||||||
if (showLoading != "true") {
|
if (showLoading != "true") {
|
||||||
removeLoadingScreen()
|
removeLoadingScreen(true)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setLoadingProgress("Cleaning up...")
|
setLoadingProgress("Cleaning up...")
|
||||||
|
loadingComplete = true
|
||||||
|
if (fakeLoadingComplete) {
|
||||||
|
removeLoadingScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
|
|||||||
+11
-6
@@ -1,6 +1,8 @@
|
|||||||
let isLoading = true
|
let isLoading = true
|
||||||
let stopLoading = false
|
let stopLoading = false
|
||||||
let loadingScreenEl = document.getElementById("loadingScreen")
|
let loadingScreenEl = document.getElementById("loadingScreen")
|
||||||
|
let loadingComplete = false
|
||||||
|
let fakeLoadingComplete = false
|
||||||
|
|
||||||
|
|
||||||
loadingScreenEl.className = "bgDiv"
|
loadingScreenEl.className = "bgDiv"
|
||||||
@@ -52,18 +54,20 @@ function setLoadingProgress(newText) {
|
|||||||
loadingScreenProgress.innerHTML = `Loading...<br>${newText}<br><br>Tip: ${selectedTip}`
|
loadingScreenProgress.innerHTML = `Loading...<br>${newText}<br><br>Tip: ${selectedTip}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function startLoadingScreen() {
|
function startLoadingScreen() {
|
||||||
loadingScreenProgress.innerHTML = `Loading...<br><br>Tip: ${selectedTip}`
|
loadingScreenProgress.innerHTML = `Loading...<br><br>Tip: ${selectedTip}`
|
||||||
|
|
||||||
const loadDur = randomFloat(3000, 6000)
|
const loadDur = randomFloat(2000, 4000)
|
||||||
debugPrint("loadDur initial", loadDur)
|
debugPrint("loadDur initial", loadDur)
|
||||||
|
|
||||||
setTimeout(removeLoadingScreen, loadDur)
|
setTimeout(function() {
|
||||||
|
if (loadingComplete) { removeLoadingScreen() }
|
||||||
|
fakeLoadingComplete = true
|
||||||
|
}, loadDur)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeLoadingScreen() {
|
function removeLoadingScreen(rmCornerText = false) {
|
||||||
if (!isLoading) { return }
|
if (!isLoading) { return }
|
||||||
|
|
||||||
setLoadingProgress("Done!")
|
setLoadingProgress("Done!")
|
||||||
@@ -76,8 +80,9 @@ function removeLoadingScreen() {
|
|||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
loadingScreenEl.style.left = "100vw"
|
loadingScreenEl.style.left = "100vw"
|
||||||
loadingScreenEl.style.pointerEvents = "none"
|
if (rmCornerText) {
|
||||||
document.getElementById("loadingCornerText").remove()
|
document.getElementById("loadingCornerText").remove()
|
||||||
|
}
|
||||||
newTip()
|
newTip()
|
||||||
}, fadeOutDur * 1000)
|
}, fadeOutDur * 1000)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ function createNavBarBtn(icon = "", action = "", actionValue = "", iconId = "",
|
|||||||
|
|
||||||
let onClick
|
let onClick
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "navigate": onClick = `slideTransition('${actionValue}')`; break
|
case "navigate": onClick = `slideTransition('${actionValue}', event)`; break
|
||||||
case "function": onClick = `${actionValue}`; break
|
case "function": onClick = `${actionValue}`; break
|
||||||
default: ""
|
default: ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 dur = 500
|
||||||
const loadingTime = randomFloat(500, 1500)
|
const loadingTime = randomFloat(500, 1500)
|
||||||
debugPrint("loadDur transition", loadingTime)
|
debugPrint("loadDur transition", loadingTime)
|
||||||
|
|
||||||
const slideLeft = `slide-left ${dur / 1000}s cubic-bezier(0, 0, 0, 1.46) forwards`
|
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.animation = slideLeft
|
||||||
loadingScreen.style.pointerEvents = "auto"
|
loadingScreen.style.pointerEvents = "auto"
|
||||||
mainDiv.style.animation = slideLeft
|
mainDiv.style.animation = slideLeft
|
||||||
@@ -16,6 +17,30 @@ function slideTransition(url) {
|
|||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
setLoadingProgress("Done!")
|
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)
|
}, 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)
|
||||||
}
|
}
|
||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li class="toyLi">
|
<li class="toyLi">
|
||||||
<button onclick="slideTransition('/toys/license')" class="toyContainer borderedRect">
|
<button onclick="slideTransition('/toys/license', event)" class="toyContainer borderedRect">
|
||||||
<img class="toyImg" src="/assets/boykisserLicenseEmpty.png">
|
<img class="toyImg" src="/assets/boykisserLicenseEmpty.png">
|
||||||
<div class="toyTextContainer">
|
<div class="toyTextContainer">
|
||||||
<h1>Boykisser license generator</h1>
|
<h1>Boykisser license generator</h1>
|
||||||
|
|||||||
@@ -29,11 +29,11 @@
|
|||||||
<div id="optionsContainer" class="borderedRect">
|
<div id="optionsContainer" class="borderedRect">
|
||||||
<h1 class="optionsCredits h1Top">
|
<h1 class="optionsCredits h1Top">
|
||||||
Check out the
|
Check out the
|
||||||
<a onclick="slideTransition('https://picrew.me/en/image_maker/2310778')">original</a> by Chilli!<br>
|
<a onclick="slideTransition('https://picrew.me/en/image_maker/2310778', event)">original</a> by Chilli!<br>
|
||||||
Boykisser picture presets made by
|
Boykisser picture presets made by
|
||||||
<a onclick="slideTransition('https://www.deviantart.com/greenbandit2004')">greenbandit2004</a>.<br>
|
<a onclick="slideTransition('https://www.deviantart.com/greenbandit2004', event)">greenbandit2004</a>.<br>
|
||||||
Please contact
|
Please contact
|
||||||
<a onclick="slideTransition('https://www.reddit.com/u/RandomPersonDotExe')">u/RandomPersonDotExe</a>
|
<a onclick="slideTransition('https://www.reddit.com/u/RandomPersonDotExe', event)">u/RandomPersonDotExe</a>
|
||||||
or Discord @bytedice for takedown requests.
|
or Discord @bytedice for takedown requests.
|
||||||
</h1><br>
|
</h1><br>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user