Fix double transition of loader backdrop

This commit is contained in:
Wolfsblvt 2024-06-30 22:17:23 +02:00
parent 5c318cd3f3
commit 5a8973d12a

View File

@ -23,26 +23,23 @@ export function showLoader() {
} }
export async function hideLoader() { export async function hideLoader() {
// Yoink preloader entirely; it only exists to cover up unstyled content while loading JS
// If it's present, we remove it once and then it's gone.
yoinkPreloader();
if (!loaderPopup) { if (!loaderPopup) {
console.warn('There is no loader showing to hide'); console.warn('There is no loader showing to hide');
return Promise.resolve(); return Promise.resolve();
} }
return new Promise((resolve) => { return new Promise((resolve) => {
//Sets up a 2-step animation. Spinner blurs/fades out, and then the loader shadow does the same. //Sets up a 2-step animation. Spinner blurs/fades out, and then the loader shadow does the same (by utilizing the popup closing transition)
$('#load-spinner').on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () { $('#load-spinner').on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
$(`#${ELEMENT_ID}`) $(`#${ELEMENT_ID}`).remove();
//only fade out the spinner and replace with login screen loaderPopup.complete(POPUP_RESULT.AFFIRMATIVE).then(() => {
.animate({ opacity: 0 }, 300, function () { loaderPopup = null;
// Yoink preloader entirely; it only exists to cover up unstyled content while loading JS resolve();
// If it's present, we remove it once and then it's gone. });
yoinkPreloader();
$(`#${ELEMENT_ID}`).remove();
loaderPopup.complete(POPUP_RESULT.AFFIRMATIVE).then(() => {
loaderPopup = null;
resolve();
});
});
}); });
$('#load-spinner') $('#load-spinner')