Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update index.template.html loading screen delay (#184)
Leendert de Borstcd4dc918cb1a
diff --git a/src/AliasVault.Client/wwwroot/index.template.html b/src/AliasVault.Client/wwwroot/index.template.htmlindex 5ab34962f..8eea190e3 100644--- a/src/AliasVault.Client/wwwroot/index.template.html+++ b/src/AliasVault.Client/wwwroot/index.template.html@@ -77,30 +77,32 @@const randomIndex = Math.floor(Math.random() * securityQuotes.length);quoteElement.textContent = `"${securityQuotes[randomIndex]}"`;- window.addEventListener('load', function() {+ function manageLoadingScreen() {const startTime = new Date().getTime();const minDisplayTime = 1000;+ const checkInterval = 500;- function hideLoadingScreen() {- document.getElementById('loading-screen').style.display = 'none';- document.getElementById('app').style.removeProperty('visibility');- }+ const appElement = document.getElementById('app');+ const loadingScreen = document.getElementById('loading-screen');- function checkElapsedTime() {- const currentTime = new Date().getTime();- const elapsedTime = currentTime - startTime;+ appElement.style.visibility = 'hidden';+ loadingScreen.style.display = 'flex';- if (elapsedTime >= minDisplayTime) {- hideLoadingScreen();- } else {- setTimeout(hideLoadingScreen, minDisplayTime - elapsedTime);+ const checkContentAndTime = () => {+ const elapsedTime = new Date().getTime() - startTime;+ const hasContent = appElement.innerHTML.trim() !== '';++ if ((elapsedTime >= minDisplayTime && hasContent)) {+ loadingScreen.style.display = 'none';+ appElement.style.removeProperty('visibility');+ clearInterval(intervalId);}- }+ };++ const intervalId = setInterval(checkContentAndTime, checkInterval);+ }- document.getElementById('app').style.visibility = 'hidden';- document.getElementById('loading-screen').style.display = 'flex';- checkElapsedTime();- });+ window.addEventListener('load', manageLoadingScreen);</script><script src="lib/qrcode.min.js?v=@CacheBuster"></script><script src="js/crypto.js?v=@CacheBuster"></script>