summaryrefslogtreecommitdiffstats
path: root/apps/files_imageviewer/js/lightbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_imageviewer/js/lightbox.js')
-rw-r--r--apps/files_imageviewer/js/lightbox.js17
1 files changed, 12 insertions, 5 deletions
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