From b6e57989dc9a3a26a832666cba17037eb222c7e7 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 14 Aug 2018 03:01:36 +0200 Subject: [PATCH] Call asynchronous JS after complete page load --- view/js/acl.js | 5 +---- view/js/main.js | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/view/js/acl.js b/view/js/acl.js index 257e2c158..1f6d25d5a 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -42,9 +42,6 @@ function ACL(backend_url, preset, automention, is_mobile){ /* add/remove mentions */ this.element = $("#profile-jot-text"); this.htmlelm = this.element.get()[0]; - - /* startup! */ - this.get(0,100); } ACL.prototype.remove_mention = function(id) { @@ -344,7 +341,7 @@ ACL.prototype.populate = function(data){ /** * @brief Deselect previous selected contact. - * + * * @param {int} id The contact ID. * @returns {void} */ diff --git a/view/js/main.js b/view/js/main.js index 88cfe89ee..325102333 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -302,7 +302,12 @@ $(function() { $('#nav-notifications-menu').perfectScrollbar('update'); }); - NavUpdate(); + // Asynchronous calls are deferred until the very end of the page load to ease on slower connections + window.addEventListener("load", function(){ + NavUpdate(); + acl.get(0, 100); + }); + // Allow folks to stop the ajax page updates with the pause/break key $(document).keydown(function(event) { if (event.keyCode == '8') {