Fix occasional splash screen bugs on firefox

This commit is contained in:
James Lyne 2021-05-20 22:25:46 +01:00
parent e6f0a0e80d
commit 754f5f248a

View File

@ -31,12 +31,19 @@ const splash = document.getElementById('splash'),
splashRetry = document.getElementById('splash__error-retry'), splashRetry = document.getElementById('splash__error-retry'),
svgs = import.meta.globEager('/assets/icons/*.svg'); svgs = import.meta.globEager('/assets/icons/*.svg');
if(splash) {
splash.ontransitionend = function(e) {
if(e.target === splash && splash.style.opacity === '0') {
splash.hidden = true;
}
};
}
window.showSplash = function() { window.showSplash = function() {
if(!splash) { if(!splash) {
return; return;
} }
splash.ontransitionend = null;
splash.hidden = false; splash.hidden = false;
requestAnimationFrame(function() { requestAnimationFrame(function() {
@ -49,14 +56,12 @@ window.hideSplash = function() {
return; return;
} }
splash.ontransitionend = function(e) {
if(e.target === splash) {
splash.hidden = true;
}
};
requestAnimationFrame(function() { requestAnimationFrame(function() {
splash.style.opacity = '0'; splash.style.opacity = '0';
if(window.getComputedStyle(splash).opacity === '0') {
splash.hidden = true;
}
}); });
}; };