mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 20:51:23 +01:00
fix not working startup of gallery, as mediaContent has to be an array without gaps from non-media content
This commit is contained in:
parent
6baaaa20eb
commit
4886634500
@ -83,6 +83,7 @@ function expose (widget)
|
||||
*
|
||||
* @param {et2_nextmatch} nm
|
||||
* @param {Object[]} images
|
||||
* @param {number} start_at
|
||||
* @returns {undefined}
|
||||
*/
|
||||
var read_from_nextmatch = function(nm, images, start_at)
|
||||
@ -106,10 +107,10 @@ function expose (widget)
|
||||
if(data && data.data && data.data.mime && mime_regex.test(data.data.mime))
|
||||
{
|
||||
var media = this.getMedia(data.data);
|
||||
images[i] = jQuery.extend({}, data.data, media[0]);
|
||||
}
|
||||
images.push(jQuery.extend({}, data.data, media[0]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a particular index/image in the gallery instead of just appending
|
||||
@ -148,7 +149,7 @@ function expose (widget)
|
||||
//
|
||||
// list
|
||||
gallery.list[index] = gallery.list[new_index];
|
||||
gallery.list.splice(new_index,1)
|
||||
gallery.list.splice(new_index,1);
|
||||
|
||||
// indicators & slides
|
||||
var dom_nodes = ['indicators','slides'];
|
||||
@ -316,21 +317,21 @@ function expose (widget)
|
||||
// current index and slide as arguments:
|
||||
onslide: function(index, slide) {
|
||||
// Call our onslide method, and include gallery as an attribute
|
||||
self.expose_onslide.apply(self, [this, index,slide])
|
||||
self.expose_onslide.apply(self, [this, index,slide]);
|
||||
},
|
||||
// Callback function executed after the slide change transition.
|
||||
// Is called with the gallery instance as "this" object and the
|
||||
// current index and slide as arguments:
|
||||
onslideend: function(index, slide) {
|
||||
// Call our onslide method, and include gallery as an attribute
|
||||
self.expose_onslideend.apply(self, [this, index,slide])
|
||||
self.expose_onslideend.apply(self, [this, index,slide]);
|
||||
},
|
||||
//// Callback function executed on slide content load.
|
||||
// Is called with the gallery instance as "this" object and the
|
||||
// slide index and slide element as arguments:
|
||||
onslidecomplete: function(index, slide) {
|
||||
// Call our onslide method, and include gallery as an attribute
|
||||
self.expose_onslidecomplete.apply(self, [this, index,slide])
|
||||
self.expose_onslidecomplete.apply(self, [this, index,slide]);
|
||||
},
|
||||
//// Callback function executed when the Gallery is about to be closed.
|
||||
// Is called with the gallery instance as "this" object:
|
||||
@ -387,10 +388,18 @@ function expose (widget)
|
||||
{
|
||||
// Get the row that was clicked, find its index in the list
|
||||
var current_entry = nm.controller.getRowByNode(event.target);
|
||||
current_index = current_entry.idx || 0;
|
||||
|
||||
// But before it goes, we'll pull everything we can
|
||||
read_from_nextmatch.call(this, nm, mediaContent);
|
||||
// find current_entry in array and set it's array-index
|
||||
for(var i; i < mediaContent.length; i++)
|
||||
{
|
||||
if ('filemanager::'+mediaContent[i].path == current_entry.uid)
|
||||
{
|
||||
current_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This will trigger nm to refresh and get just the ones we can handle
|
||||
// but it might take a while, so do it later - make sure our current
|
||||
@ -403,7 +412,7 @@ function expose (widget)
|
||||
{
|
||||
mediaContent = this.getMedia(_value);
|
||||
}
|
||||
this.expose_options.index = Math.min(current_index, mediaContent.length-1);
|
||||
this.expose_options.index = current_index;
|
||||
gallery = blueimp.Gallery(mediaContent, this.expose_options);
|
||||
},
|
||||
expose_onopen: function (event){},
|
||||
|
Loading…
Reference in New Issue
Block a user