fix loading of image viewer again

This commit is contained in:
Robin Appelman 2011-06-04 23:14:33 +02:00
parent 277e644558
commit bc0790381e
1 changed files with 32 additions and 31 deletions

View File

@ -1,6 +1,7 @@
if(typeof ileActions!=='undefined'){
var lightBoxShown=false;
$(document).ready(function() {
var lightBoxShown=false;
$(document).ready(function() {
if(typeof FileActions!=='undefined'){
images={};//image cache
var overlay=$('<div id="lightbox_overlay"/>');
$( 'body' ).append(overlay);
@ -22,9 +23,10 @@ if(typeof ileActions!=='undefined'){
});
$( 'body' ).click(hideLightbox);
FileActions.setDefault('image','View');
});
}
});
function showLightbox(container,img){
function showLightbox(container,img){
var maxWidth = $( window ).width() - 50;
var maxHeight = $( window ).height() - 50;
if( img.width > maxWidth || img.height > maxHeight ) { // One of these is larger than the window
@ -45,13 +47,12 @@ if(typeof ileActions!=='undefined'){
setTimeout(function(){
lightBoxShown=true;
},100);
}
}
function hideLightbox(){
function hideLightbox(){
if(lightBoxShown){
$('#lightbox_overlay').hide();
$('#lightbox').hide();
lightBoxShown=false;
}
}
}