diff options
author | Olivier Paroz <github@oparoz.com> | 2015-09-12 14:24:29 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-09-12 14:24:29 +0300 |
commit | a355c6d3700c45cf0d318dd604746b535d0424c2 (patch) | |
tree | a5b8cc956cfa3cf380b2279f24f4b39deb4e8a13 /js/galleryfileaction.js | |
parent | 9c6fb8e893fc585e183161c21ee13db0b5725165 (diff) |
Make background toggle button optional
Fixes #226
Diffstat (limited to 'js/galleryfileaction.js')
-rw-r--r-- | js/galleryfileaction.js | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/js/galleryfileaction.js b/js/galleryfileaction.js index 8b140961..b08b9b62 100644 --- a/js/galleryfileaction.js +++ b/js/galleryfileaction.js @@ -2,7 +2,7 @@ (function ($, OC, OCA, oc_requesttoken) { "use strict"; var galleryFileAction = { - config: null, + features: [], mediaTypes: {}, scrollContainer: null, slideShow: null, @@ -52,6 +52,25 @@ }, /** + * Prepares the features array + * + * @param configFeatures + * @returns {Array} + */ + buildFeaturesList: function (configFeatures) { + var features = []; + var feature = null; + if (!$.isEmptyObject(configFeatures)) { + for (var i = 0, keys = Object.keys(configFeatures); i < keys.length; i++) { + feature = keys[i]; + features.push(feature); + } + } + + window.galleryFileAction.features = features; + }, + + /** * Builds an array containing all the images we can show in the slideshow * * @param {string} filename @@ -114,10 +133,13 @@ if ($.isEmptyObject(galleryFileAction.slideShow)) { galleryFileAction.slideShow = new SlideShow(); - $.when(galleryFileAction.slideShow.init(false, null)) - .then(function () { - galleryFileAction._startSlideshow(images, start); - }); + $.when(galleryFileAction.slideShow.init( + false, + null, + window.galleryFileAction.features + )).then(function () { + galleryFileAction._startSlideshow(images, start); + }); } else { galleryFileAction._startSlideshow(images, start); } @@ -177,9 +199,7 @@ $(document).ready(function () { // The list of media files is retrieved when the user clicks on a row var url = window.galleryFileAction.buildGalleryUrl('config', '', {extramediatypes: 1}); $.getJSON(url).then(function (config) { - if (!$.isEmptyObject(config.features)) { - window.galleryFileAction.config = config.features; - } + window.galleryFileAction.buildFeaturesList(config.features); window.galleryFileAction.register(config.mediatypes); }); }); |