diff options
author | Georg Ehrke <georg.stefan.germany@googlemail.com> | 2011-10-13 21:59:16 +0200 |
---|---|---|
committer | Georg Ehrke <georg.stefan.germany@googlemail.com> | 2011-10-13 21:59:16 +0200 |
commit | a01d10e57db1893939d0a7706fad239df537e24b (patch) | |
tree | 3649dab6d0006981225f88574b26447f9fbeac1f /files/js | |
parent | 4cbae823eb742fac80288c6c74acba26e0a9c5d6 (diff) | |
parent | db2fb38746bb9d89b402c3a768a247945d813989 (diff) | |
download | nextcloud-server-a01d10e57db1893939d0a7706fad239df537e24b.tar.gz nextcloud-server-a01d10e57db1893939d0a7706fad239df537e24b.zip |
Merge branch 'master' into calendar
Diffstat (limited to 'files/js')
-rw-r--r-- | files/js/filelist.js | 12 | ||||
-rw-r--r-- | files/js/files.js | 15 |
2 files changed, 17 insertions, 10 deletions
diff --git a/files/js/filelist.js b/files/js/filelist.js index 84762bb561d..e6da922700d 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -101,10 +101,14 @@ FileList={ $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ - $('tr[data-file="'+name+'"]').data('loading',false); - var mime=$('tr[data-file="'+name+'"]').data('mime'); - $('tr[data-file="'+name+'"] td.filename').attr('style','background-image:url('+getMimeIcon(mime)+')'); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + var tr=$('tr[data-file="'+name+'"]'); + tr.data('loading',false); + var mime=tr.data('mime'); + tr.attr('data-mime',mime); + getMimeIcon(mime,function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); + tr.find('td.filename').draggable(dragOptions); }, isLoading:function(name){ return $('tr[data-file="'+name+'"]').data('loading'); diff --git a/files/js/files.js b/files/js/files.js index 9342642b4ff..079646070d4 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -473,11 +473,14 @@ function relative_modified_date(timestamp) { else { return diffyears+' '+t('files','years ago'); } } -function getMimeIcon(mime){ - mime=mime.substr(0,mime.indexOf('/')); - var knownMimes=['image','audio']; - if(knownMimes.indexOf(mime)==-1){ - mime='file'; +function getMimeIcon(mime, ready){ + if(getMimeIcon.cache[mime]){ + ready(getMimeIcon.cache[mime]); + }else{ + $.get( OC.filePath('files','ajax','mimeicon.php')+'?mime='+mime, function(path){ + getMimeIcon.cache[mime]=path; + ready(getMimeIcon.cache[mime]); + }); } - return OC.imagePath('core','filetypes/'+mime); } +getMimeIcon.cache={}; |