|
|
@ -1,12 +1,13 @@ |
|
|
|
var lightBoxShown=false; |
|
|
|
var lightBoxShown=false; |
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function() { |
|
|
|
images={};//image cache
|
|
|
|
images={};//image cache
|
|
|
|
FileActions.register('image','View',function(filename){ |
|
|
|
|
|
|
|
var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); |
|
|
|
|
|
|
|
var overlay=$('<div id="lightbox_overlay"/>'); |
|
|
|
var overlay=$('<div id="lightbox_overlay"/>'); |
|
|
|
$( 'body' ).append(overlay); |
|
|
|
$( 'body' ).append(overlay); |
|
|
|
var container=$('<div id="lightbox"/>'); |
|
|
|
var container=$('<div id="lightbox"/>'); |
|
|
|
$( 'body' ).append(container); |
|
|
|
$( 'body' ).append(container); |
|
|
|
|
|
|
|
FileActions.register('image','View',function(filename){ |
|
|
|
|
|
|
|
var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); |
|
|
|
|
|
|
|
overlay.show(); |
|
|
|
if(!images[location]){ |
|
|
|
if(!images[location]){ |
|
|
|
var img = new Image(); |
|
|
|
var img = new Image(); |
|
|
|
img.onload = function(){ |
|
|
|
img.onload = function(){ |
|
|
@ -39,12 +40,16 @@ function showLightbox(container,img){ |
|
|
|
container.append(img); |
|
|
|
container.append(img); |
|
|
|
container.css('top',Math.round( ($( window ).height() - img.height)/2)); |
|
|
|
container.css('top',Math.round( ($( window ).height() - img.height)/2)); |
|
|
|
container.css('left',Math.round( ($( window ).width() - img.width)/2)); |
|
|
|
container.css('left',Math.round( ($( window ).width() - img.width)/2)); |
|
|
|
|
|
|
|
$('#lightbox').show(); |
|
|
|
|
|
|
|
setTimeout(function(){ |
|
|
|
lightBoxShown=true; |
|
|
|
lightBoxShown=true; |
|
|
|
|
|
|
|
},100); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function hideLightbox(){ |
|
|
|
function hideLightbox(){ |
|
|
|
if(lightBoxShown){ |
|
|
|
if(lightBoxShown){ |
|
|
|
$('#lightbox_overlay').remove(); |
|
|
|
$('#lightbox_overlay').hide(); |
|
|
|
$('#lightbox').remove(); |
|
|
|
$('#lightbox').hide(); |
|
|
|
|
|
|
|
lightBoxShown=false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |