diff options
author | kondou <kondou@ts.unde.re> | 2013-09-11 16:35:55 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-09-11 16:35:55 +0200 |
commit | 2ae3ab98d847cbf795ee038b468376d53b069e0a (patch) | |
tree | 16d5e8a7b7db91c8f01cf5f48b6f27bfd014f905 /apps/files/js/files.js | |
parent | f6faec0e0bfddb14cc17f4a7f60900438215dd35 (diff) | |
parent | 62eeac33900bdb13b823049d8cc63f44e0bca24f (diff) | |
download | nextcloud-server-2ae3ab98d847cbf795ee038b468376d53b069e0a.tar.gz nextcloud-server-2ae3ab98d847cbf795ee038b468376d53b069e0a.zip |
Merge branch 'master' into split_personal-user_passwordchange
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 87311237e36..d729077ea72 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -454,8 +454,9 @@ var createDragShadow = function(event){ if (elem.type === 'dir') { newtr.find('td.filename').attr('style','background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')'); } else { - getMimeIcon(elem.mime,function(path){ - newtr.find('td.filename').attr('style','background-image:url('+path+')'); + var path = getPathForPreview(elem.name); + lazyLoadPreview(path, elem.mime, function(previewpath){ + newtr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); } }); @@ -631,6 +632,23 @@ function getMimeIcon(mime, ready){ } getMimeIcon.cache={}; +function getPathForPreview(name) { + var path = $('#dir').val() + '/' + name; + return path; +} + +function lazyLoadPreview(path, mime, ready) { + getMimeIcon(mime,ready); + var x = $('#filestable').data('preview-x'); + var y = $('#filestable').data('preview-y'); + var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y}); + $.get(previewURL, function() { + previewURL = previewURL.replace('(','%28'); + previewURL = previewURL.replace(')','%29'); + ready(previewURL + '&reload=true'); + }); +} + function getUniqueName(name){ if($('tr').filterAttr('data-file',name).length>0){ var parts=name.split('.'); |