diff options
author | Brice Maron <brice@bmaron.net> | 2011-10-14 23:51:51 +0200 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2011-10-14 23:51:51 +0200 |
commit | 8d4039b678c2e35e3fd6834d56b8db6879beab89 (patch) | |
tree | 656fbea7b851a4fdfc9576b991246546dfeb8254 | |
parent | f29dc0c0fbc7dd360066e5f47ec3b87927381c1b (diff) | |
download | nextcloud-server-8d4039b678c2e35e3fd6834d56b8db6879beab89.tar.gz nextcloud-server-8d4039b678c2e35e3fd6834d56b8db6879beab89.zip |
Add loading message to image lightbox and tweak events
-rw-r--r-- | apps/files_imageviewer/css/lightbox.css | 11 | ||||
-rw-r--r-- | apps/files_imageviewer/js/lightbox.js | 17 | ||||
-rw-r--r-- | core/img/loading-dark.gif | bin | 0 -> 673 bytes |
3 files changed, 22 insertions, 6 deletions
diff --git a/apps/files_imageviewer/css/lightbox.css b/apps/files_imageviewer/css/lightbox.css index a6e844a2e28..d96dd051b1e 100644 --- a/apps/files_imageviewer/css/lightbox.css +++ b/apps/files_imageviewer/css/lightbox.css @@ -20,4 +20,13 @@ margin-left:auto; margin-right:auto; z-index:9999; -}
\ No newline at end of file +} + +#lightbox_loader{ + text-align:center; + position:fixed; + top: 40%; + left: 50%; + color:white; +} +#lightbox_loader img { margin-right: 1em;}
\ No newline at end of file diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index 847954d2f15..4f079b6d8af 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -2,11 +2,17 @@ var lightBoxShown=false; $(document).ready(function() { images={};//image cache - var overlay=$('<div id="lightbox_overlay"/>'); + loading_str = t('files_imageviewer','Loading'); + var overlay=$('<div id="lightbox_overlay"><div id="lightbox_loader"><img /></div></div>'); + overlay.find('#lightbox_loader img') + .attr('src',OC.imagePath('core', 'loading-dark.gif')) + .attr('alt',loading_str) + .after(loading_str); $( 'body' ).append(overlay); var container=$('<div id="lightbox"/>'); $( 'body' ).append(container); - $( 'body' ).click(hideLightbox); + $( '#lightbox_overlay' ).click(hideLightbox); + $( '#lightbox' ).click(hideLightbox); if(typeof FileActions!=='undefined'){ FileActions.register('image','View','',function(filename){ viewImage($('#dir').val(),filename); @@ -35,7 +41,8 @@ function viewImage(dir,file){ var img = new Image(); img.onload = function(){ images[location]=img; - showLightbox(container,img); + if($('#lightbox_overlay').is(':visible')) + showLightbox(container,img); } img.src = location; }else{ @@ -67,10 +74,10 @@ function showLightbox(container,img){ } function hideLightbox(event){ - if(lightBoxShown){ + if(event){ event.stopPropagation(); $('#lightbox_overlay').hide(); $('#lightbox').hide(); lightBoxShown=false; } -} +}
\ No newline at end of file diff --git a/core/img/loading-dark.gif b/core/img/loading-dark.gif Binary files differnew file mode 100644 index 00000000000..5fe86acabc4 --- /dev/null +++ b/core/img/loading-dark.gif |