FIX: Do not resize images in Onebox while lazy loading.

Follow-up to 35d0fd0.
This commit is contained in:
Bianca Nenciu 2019-06-06 18:36:18 +03:00
parent 9acd851b9a
commit 35da531f1d

View File

@ -53,10 +53,21 @@ function show(image) {
copyImg.style.position = "absolute";
copyImg.style.top = `${image.offsetTop}px`;
copyImg.style.left = `${image.offsetLeft}px`;
copyImg.style.width = `${imageData.width}px`;
copyImg.style.height = `${imageData.height}px`;
copyImg.className = imageData.className;
let inOnebox = false;
for (let element = image; element; element = element.parentElement) {
if (element.classList.contains("onebox")) {
inOnebox = true;
break;
}
}
if (!inOnebox) {
copyImg.style.width = `${imageData.width}px`;
copyImg.style.height = `${imageData.height}px`;
}
image.parentNode.insertBefore(copyImg, image);
} else {
image.classList.remove("d-lazyload-hidden");