aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-08-31 03:41:29 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-08-31 03:41:29 -0700
commit92e90c8eb995c886b3e9cd77c14e3f0b25b95cd7 (patch)
treeed757086fcf6d761a615eb7bbbf24ebc06407310 /apps/files/js/files.js
parent0f5df181a3b1f88075193fca0bed88f289314c8e (diff)
parent668c4c2652ef4619a132d609461423aafaef424e (diff)
downloadnextcloud-server-92e90c8eb995c886b3e9cd77c14e3f0b25b95cd7.tar.gz
nextcloud-server-92e90c8eb995c886b3e9cd77c14e3f0b25b95cd7.zip
Merge pull request #4022 from owncloud/oc_preview
\OC\Preview
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('.');