Commit 915f33e0 authored by ManuLEM's avatar ManuLEM Committed by Killian Kemps
Browse files

Load img in two stages

parent e85ae5f4
......@@ -1458,11 +1458,11 @@ img.emoji {
#largeImagePopup {
position: fixed;
z-index: -1;
-moz-transition: all ease-in 0.35s;
-webkit-transition: all ease-in 0.35s;
-ms-transition: all ease-in 0.35s;
-o-transition: all ease-in 0.35s;
transition: all ease-in 0.35s;
-moz-transition: all ease-in 0.2s;
-webkit-transition: all ease-in 0.2s;
-ms-transition: all ease-in 0.2s;
-o-transition: all ease-in 0.2s;
transition: all ease-in 0.2s;
opacity: 0;
top: 0;
bottom: 0;
......
......@@ -736,6 +736,8 @@ Message.prototype.processMedia = function(){
Message.prototype.enlargeImage = function(e){
var srcAttribute = e.target.src;
var src = srcAttribute.substring(0, srcAttribute.lastIndexOf(':'));
var popupImage = document.querySelector('#largeImagePopup img');
popupImage.setAttribute('src', srcAttribute);
var fullsize = e.target.attributes[1].value;
var height = parseInt(fullsize.substring(0, fullsize.lastIndexOf('/')));
......@@ -747,9 +749,12 @@ Message.prototype.enlargeImage = function(e){
}
var popup = document.getElementById('largeImagePopup');
var popupBack = document.querySelector('#largeImagePopup .back');
var popupImage = document.querySelector('#largeImagePopup img');
var popupCross = document.querySelector('#largeImagePopup .cross');
popupImage.setAttribute('src', src + ':large');
var downloadingImage = new Image();
downloadingImage.onload = function(){
popupImage.setAttribute('src', this.src);
};
downloadingImage.src = src + ':large';
var halfWidth = width / 2;
var left = 'calc(50% - ' + halfWidth + 'px)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment