summaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js22
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('.');