Gallery: Show thumbnails after document is ready

This commit is contained in:
Bart Visscher 2012-05-09 22:58:43 +02:00
parent 798e6aa40b
commit 2062ebacef
2 changed files with 6 additions and 8 deletions

View File

@ -86,18 +86,16 @@ function albumClickHandler(r) {
Albums.recursive = false;
Albums.token = '';
}
var targetDiv = document.getElementById('gallery_list');
if (targetDiv) {
$(targetDiv).html('');
$(document).ready(function(){
var targetDiv = $('#gallery_list');
targetDiv.html('');
Albums.display(targetDiv);
//$('#gallery_list').sortable({revert:true});
$('.album').each(function(i, el) {
$(el).click(albumClick.bind(null,$(el).attr('title')));
//$(el).draggable({connectToSortable: '#gallery_list', handle: '.dummy'});
});
} else {
OC.dialogs.alert(t('gallery', 'Error: no such layer `gallery_list`'), t('gallery', 'Internal error'));
}
});
} else {
OC.dialogs.alert(t('gallery', 'Error: ') + r.cause, t('gallery', 'Internal error'));
}

View File

@ -77,11 +77,11 @@ Albums={
if (x < 0 || isNaN(x)) x=0;
$(this).css('background-position', -x+'px 0');
});
$(element).append(local);
element.append(local);
}
var photoDisplayTemplate = '<div class="gallery_box"><div class="dummy"></div><div><a rel="images" href="'+OC.linkTo('files','download.php')+'?file=URLPATH"><img src="'+OC.filePath('gallery','ajax','thumbnail.php')+'?img=IMGPATH"></a></div></div>';
for (var i in Albums.photos) {
$(element).append(photoDisplayTemplate.replace("IMGPATH", escape(Albums.photos[i])).replace("URLPATH", escape(Albums.photos[i])));
element.append(photoDisplayTemplate.replace("IMGPATH", escape(Albums.photos[i])).replace("URLPATH", escape(Albums.photos[i])));
}
$("a[rel=images]").fancybox({
'titlePosition': 'inside'