From 754f5f248a52a9fbbdce34e9c452d7058996a6b9 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 20 May 2021 22:25:46 +0100 Subject: [PATCH] Fix occasional splash screen bugs on firefox --- src/main.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main.ts b/src/main.ts index ed10357..d18dc70 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,12 +31,19 @@ const splash = document.getElementById('splash'), splashRetry = document.getElementById('splash__error-retry'), 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() { if(!splash) { return; } - splash.ontransitionend = null; splash.hidden = false; requestAnimationFrame(function() { @@ -49,14 +56,12 @@ window.hideSplash = function() { return; } - splash.ontransitionend = function(e) { - if(e.target === splash) { - splash.hidden = true; - } - }; - requestAnimationFrame(function() { splash.style.opacity = '0'; + + if(window.getComputedStyle(splash).opacity === '0') { + splash.hidden = true; + } }); };