diff options
author | Olivier Paroz <github@oparoz.com> | 2015-07-05 20:49:50 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-07-05 20:49:50 +0300 |
commit | 5ac3ed9f15bb1486be3906db70f35c66c541d2a8 (patch) | |
tree | 39f0ce4eb65a9a1a8e11f61b9683e49fd30416e7 /js/galleryfileaction.js | |
parent | 808f5b214b802ddad5a28b246145c8d85a85bd53 (diff) |
Fix slideshow template loading race condition
* Load the slideshow only when needed on the Files app
* Load the slideshow at init time in the Gallery app
Diffstat (limited to 'js/galleryfileaction.js')
-rw-r--r-- | js/galleryfileaction.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/js/galleryfileaction.js b/js/galleryfileaction.js index 53423cdd..9fb5a3ad 100644 --- a/js/galleryfileaction.js +++ b/js/galleryfileaction.js @@ -1,5 +1,5 @@ /* global oc_requesttoken, FileList, SlideShow */ -(function (OC ,OCA, $, oc_requesttoken) { +(function (OC, OCA, $, oc_requesttoken) { "use strict"; var galleryFileAction = { config: null, @@ -108,10 +108,17 @@ } if ($.isEmptyObject(galleryFileAction.slideShow)) { - galleryFileAction.slideShow = new SlideShow($('#slideshow')); - galleryFileAction.slideShow.init(false, null); + galleryFileAction.slideShow = new SlideShow(); + $.when(galleryFileAction.slideShow.init(false, null)) + .then(function () { + galleryFileAction._startSlideshow(images, start); + }); + } else { + galleryFileAction._startSlideshow(images, start); } + }, + _startSlideshow: function (images, start) { galleryFileAction.slideShow.setImages(images); var scrollTop = galleryFileAction.scrollContainer.scrollTop(); @@ -141,7 +148,7 @@ }; window.galleryFileAction = galleryFileAction; -}(OC ,OCA, jQuery, oc_requesttoken)); +}(OC, OCA, jQuery, oc_requesttoken)); $(document).ready(function () { "use strict"; |