2023-10-31 21:16:33 +01:00
|
|
|
const ELEMENT_ID = 'loader';
|
|
|
|
|
|
|
|
export function showLoader() {
|
|
|
|
const container = $('<div></div>').attr('id', ELEMENT_ID);
|
2023-12-02 20:11:06 +01:00
|
|
|
const loader = $('<div></div>').attr('id', 'load-spinner').addClass('fa-solid fa-gear fa-spin fa-3x');
|
2023-10-31 21:16:33 +01:00
|
|
|
container.append(loader);
|
|
|
|
$('body').append(container);
|
2024-04-07 17:18:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function hideLoader() {
|
2023-11-01 04:40:21 +01:00
|
|
|
//Sets up a 2-step animation. Spinner blurs/fades out, and then the loader shadow does the same.
|
2023-12-02 19:04:51 +01:00
|
|
|
$('#load-spinner').on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
|
2023-11-01 04:40:21 +01:00
|
|
|
$(`#${ELEMENT_ID}`)
|
2024-04-07 17:18:21 +02:00
|
|
|
//only fade out the spinner and replace with login screen
|
2023-11-01 04:40:21 +01:00
|
|
|
.animate({ opacity: 0 }, 300, function () {
|
2023-12-02 20:11:06 +01:00
|
|
|
$(`#${ELEMENT_ID}`).remove();
|
|
|
|
});
|
|
|
|
});
|
2023-11-01 04:40:21 +01:00
|
|
|
|
2023-12-02 19:04:51 +01:00
|
|
|
$('#load-spinner')
|
2023-11-01 04:40:21 +01:00
|
|
|
.css({
|
|
|
|
'filter': 'blur(15px)',
|
|
|
|
'opacity': '0',
|
2023-12-02 20:11:06 +01:00
|
|
|
});
|
2023-12-03 13:23:20 +01:00
|
|
|
}
|