From 43a6a52eadf9386d71e9315e5e557c5f9d735233 Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 6 Nov 2017 22:21:11 -0500 Subject: [PATCH] hide loader only once the initial note is loaded --- public/javascripts/init.js | 31 +++++++++++++++++++------------ public/javascripts/note_editor.js | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/public/javascripts/init.js b/public/javascripts/init.js index cc74a72bf..a973ae93c 100644 --- a/public/javascripts/init.js +++ b/public/javascripts/init.js @@ -91,16 +91,23 @@ function isElectron() { return window && window.process && window.process.type; } -$(document).ready(() => { - $("#container").show(); +let appShown = false; - // Get a reference to the loader's div - const loaderDiv = document.getElementById("loader-wrapper"); - // When the transition ends remove loader's div from display - // so that we can access the map with gestures or clicks - loaderDiv.addEventListener("transitionend", function(){ - loaderDiv.style.display = "none"; - }, true); - // Kick off the CSS transition - loaderDiv.style.opacity = 0.0; -}); \ No newline at end of file +function showAppIfHidden() { + if (!appShown) { + appShown = true; + + $("#container").show(); + + // Get a reference to the loader's div + const loaderDiv = document.getElementById("loader-wrapper"); + // When the transition ends remove loader's div from display + // so that we can access the map with gestures or clicks + loaderDiv.addEventListener("transitionend", function(){ + loaderDiv.style.display = "none"; + }, true); + + // Kick off the CSS transition + loaderDiv.style.opacity = 0.0; + } +} \ No newline at end of file diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js index 20a2f054b..213a11e06 100644 --- a/public/javascripts/note_editor.js +++ b/public/javascripts/note_editor.js @@ -227,6 +227,8 @@ const noteEditor = (function() { noteChangeDisabled = false; setNoteBackgroundIfEncrypted(currentNote); + + showAppIfHidden(); } async function loadNote(noteId) {