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