Fix lightbox album scope 2
This commit is contained in:
@@ -793,6 +793,9 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
|
||||
self.tmp('updatable', false);
|
||||
if(!bDiscrete) $('#loading').show();
|
||||
|
||||
var $Posts = $('<div>');
|
||||
var a$Medias = [];
|
||||
|
||||
self.get(
|
||||
'next_feed',
|
||||
function(asData) {
|
||||
@@ -807,14 +810,21 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
|
||||
}
|
||||
|
||||
//Add posts
|
||||
if(bFirstChunk === true) self.tmp('$PostList').empty();
|
||||
$.each(asData.feed, function(iKey, asPost){
|
||||
var $Post = getPost(asPost);
|
||||
self.tmp('$PostList').append($Post);
|
||||
if(asPost.type == 'media' && isLightboxOpen()) lightbox.addToAlbum($Post.find('.media-link'));
|
||||
$Posts.append($Post);
|
||||
if(asPost.type == 'media' && isLightboxOpen()) a$Medias.push($Post.find('.media-link'));
|
||||
});
|
||||
if(bFirstChunk === true) self.tmp('$PostList').empty();
|
||||
self.tmp('$PostList').append($Posts.children());
|
||||
self.tmp('$PostList').find('img').waitForImages(true).done(fCallback);
|
||||
|
||||
//Add media to lightbox
|
||||
$.each(a$Medias, function(iKey, $Media) {
|
||||
lightbox.addToAlbum($Media);
|
||||
});
|
||||
if(a$Medias.length > 0) lightbox.updateDetails();
|
||||
|
||||
self.tmp('updatable', true);
|
||||
}, {
|
||||
id_project: self.vars(['project', 'id']),
|
||||
|
||||
Reference in New Issue
Block a user