From 55fc3cb2c59748a7c316625e29aa5a8170bdf2ae Mon Sep 17 00:00:00 2001 From: Daniel Harte Date: Fri, 17 Jun 2016 06:44:55 +0000 Subject: [PATCH] gui: Load modals before calling initController() (fixes #3301) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3319 --- gui/default/syncthing/core/modalDirective.js | 3 +++ .../syncthing/core/syncthingController.js | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gui/default/syncthing/core/modalDirective.js b/gui/default/syncthing/core/modalDirective.js index e90f43f5..44171e11 100644 --- a/gui/default/syncthing/core/modalDirective.js +++ b/gui/default/syncthing/core/modalDirective.js @@ -67,6 +67,9 @@ angular.module('syncthing.core') } }); + + // inform syncthingContoller that a modal is ready + scope.$parent.modalLoaded(); } }; }); diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 71610756..e28259ac 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -221,9 +221,7 @@ angular.module('syncthing.core') document.cookie = "firstVisit=" + Date.now() + ";max-age=" + 30 * 24 * 3600; } else { if (+firstVisit < Date.now() - 4 * 3600 * 1000) { - setTimeout(function () { - $('#ur').modal(); - }, 2500); + $('#ur').modal(); } } } @@ -1623,6 +1621,14 @@ angular.module('syncthing.core') }); }; - // pseudo main. called on all definitions assigned - initController(); + $scope.modalLoaded = function () { + + // once all modal elements have been processed + if ($('modal').length === 0) { + + // pseudo main. called on all definitions assigned + initController(); + } + } + });