lightbox.js 733 B

12345678910111213141516171819202122232425262728
  1. $(document).ready(function() {
  2. if(typeof FileActions!=='undefined'){
  3. FileActions.register('image','View','',function(filename){
  4. viewImage($('#dir').val(),filename);
  5. });
  6. FileActions.setDefault('image','View');
  7. }
  8. OC.search.customResults.Images=function(row,item){
  9. var image=item.link.substr(item.link.indexOf('file=')+5);
  10. var a=row.find('a');
  11. a.attr('href','#');
  12. a.click(function(){
  13. var file=image.split('/').pop();
  14. var dir=image.substr(0,image.length-file.length-1);
  15. viewImage(dir,file);
  16. });
  17. }
  18. });
  19. function viewImage(dir, file) {
  20. var location=OC.filePath('files','ajax','download.php')+'?files='+file+'&dir='+dir;
  21. $.fancybox({
  22. "href": location,
  23. "title": file,
  24. "titlePosition": "inside"
  25. });
  26. }