mirror of
https://github.com/sigmasternchen/mobmash.click
synced 2025-03-14 23:59:01 +00:00
33 lines
No EOL
794 B
JavaScript
33 lines
No EOL
794 B
JavaScript
var spinnerActive = false;
|
|
|
|
const triggerAnimation = () => {
|
|
setTimeout(() => {
|
|
document.getElementsByClassName("middle")[0].classList.add("loading");
|
|
}, 1);
|
|
}
|
|
|
|
const endAnimation = () => {
|
|
document.getElementsByClassName("middle")[0].classList.remove("loading");
|
|
}
|
|
|
|
window.startSpinner = () => {
|
|
if (spinnerActive) {
|
|
return
|
|
}
|
|
spinnerActive = true;
|
|
document.getElementsByClassName("middle")[0].classList.add("loading");
|
|
}
|
|
|
|
window.stopSpinner = () => {
|
|
spinnerActive = false;
|
|
}
|
|
|
|
window.addEventListener("load", () => {
|
|
document.querySelector(".middle .spinner img")
|
|
?.addEventListener("animationend", () => {
|
|
endAnimation();
|
|
if (spinnerActive) {
|
|
triggerAnimation();
|
|
}
|
|
});
|
|
}); |