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.
remotes/origin/stable6
Vincent Petry 13 years ago
parent cadd71ec8a
commit 3bb7cf939e
  1. 12
      apps/files/js/files.js

@ -663,8 +663,16 @@ function lazyLoadPreview(path, mime, ready, width, height) {
$.get(previewURL, function() { $.get(previewURL, function() {
previewURL = previewURL.replace('(', '%28'); previewURL = previewURL.replace('(', '%28');
previewURL = previewURL.replace(')', '%29'); previewURL = previewURL.replace(')', '%29');
//set preview thumbnail URL previewURL += '&reload=true';
ready(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;
}); });
}); });
} }

Loading…
Cancel
Save