summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-22 12:08:05 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-22 12:08:05 +0200
commit3bb7cf939ec56f97a5fb01c16282ed7d831e338f (patch)
treee0f500078a73a7a25dd1e1912695dcec4518920b
parentcadd71ec8a02fc5619a9347109f9e588e13b3e3b (diff)
downloadnextcloud-server-3bb7cf939ec56f97a5fb01c16282ed7d831e338f.tar.gz
nextcloud-server-3bb7cf939ec56f97a5fb01c16282ed7d831e338f.zip
Fixed ugly white space while loading file thumbnail
Preview images are now pre-loaded before being set on the file element. This fixes #5135 and prevents a white space to be displayed while the thumbnails is being loaded.
-rw-r--r--apps/files/js/files.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index c3a8d81b50d..ec2dc7c62ea 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -663,8 +663,16 @@ function lazyLoadPreview(path, mime, ready, width, height) {
$.get(previewURL, function() {
previewURL = previewURL.replace('(', '%28');
previewURL = previewURL.replace(')', '%29');
- //set preview thumbnail URL
- ready(previewURL + '&reload=true');
+ previewURL += '&reload=true';
+
+ // preload image to prevent delay
+ // this will make the browser cache the image
+ var img = new Image();
+ img.onload = function(){
+ //set preview thumbnail URL
+ ready(previewURL);
+ }
+ img.src = previewURL;
});
});
}