2011-06-05 01:14:33 +04:00
|
|
|
$(document).ready(function() {
|
|
|
|
if(typeof FileActions!=='undefined'){
|
2011-07-28 06:29:04 +04:00
|
|
|
FileActions.register('image','View','',function(filename){
|
2011-07-31 04:35:54 +04:00
|
|
|
viewImage($('#dir').val(),filename);
|
2011-06-05 01:08:38 +04:00
|
|
|
});
|
|
|
|
FileActions.setDefault('image','View');
|
2011-06-05 01:14:33 +04:00
|
|
|
}
|
2011-07-31 04:35:54 +04:00
|
|
|
OC.search.customResults.Images=function(row,item){
|
|
|
|
var image=item.link.substr(item.link.indexOf('file=')+5);
|
|
|
|
var a=row.find('a');
|
|
|
|
a.attr('href','#');
|
|
|
|
a.click(function(){
|
|
|
|
var file=image.split('/').pop();
|
|
|
|
var dir=image.substr(0,image.length-file.length-1);
|
|
|
|
viewImage(dir,file);
|
|
|
|
});
|
|
|
|
}
|
2011-06-05 01:14:33 +04:00
|
|
|
});
|
2011-06-04 22:43:32 +04:00
|
|
|
|
2011-10-17 01:16:32 +04:00
|
|
|
function viewImage(dir, file) {
|
2012-04-15 18:26:08 +04:00
|
|
|
if(file.indexOf('.psd')){//can't view those
|
|
|
|
return;
|
|
|
|
}
|
2011-07-31 04:35:54 +04:00
|
|
|
var location=OC.filePath('files','ajax','download.php')+'?files='+file+'&dir='+dir;
|
2011-10-17 01:16:32 +04:00
|
|
|
$.fancybox({
|
|
|
|
"href": location,
|
|
|
|
"title": file,
|
|
|
|
"titlePosition": "inside"
|
|
|
|
});
|
2011-07-31 04:35:54 +04:00
|
|
|
}
|