From 2062ebacefea154e1ac7cbff69ac9b38c0b37f55 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 9 May 2012 22:58:43 +0200 Subject: [PATCH] Gallery: Show thumbnails after document is ready --- apps/gallery/js/album_cover.js | 10 ++++------ apps/gallery/js/albums.js | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 61084c99b2..d1809462f2 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -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')); } diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index 1fb38a5546..35537aa54c 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -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 = ''; 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'