diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-02 14:39:45 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-02 14:39:45 +0200 |
commit | 88c4ac9b98761a5d853b8dbbc6141e1af8d1d498 (patch) | |
tree | ef93fb11166d2f8075014421f8a3ed5a49322ca4 /apps/files/js/files.js | |
parent | 6572ca811fc56c71b4efc970668741630acbd63c (diff) | |
parent | 06870a6e390f68d741893b4454b8fe4063404ca8 (diff) | |
download | nextcloud-server-88c4ac9b98761a5d853b8dbbc6141e1af8d1d498.tar.gz nextcloud-server-88c4ac9b98761a5d853b8dbbc6141e1af8d1d498.zip |
Merge branch 'master' into encryption_improved_error_messages_4617
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('.'); |