From 7fc696b30e36df1ff46fa8b4cdfb738a9304caf3 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Wed, 2 Dec 2020 09:23:13 +0000 Subject: [PATCH] Revert to one-by-one manual extraction of images Former-commit-id: b8eeb644ee12aabbf1a88f946d74289b0e2109ae [formerly 6dcc64c24ebb88f510793adc4f0f97cac9f055cf [formerly a4b9d32372716058a6ab4dc40f85d852c2515ce2]] Former-commit-id: 5963575cd7a5c2996b3399fa9338937d1a569ca6 Former-commit-id: f302d80e63ef5bc556b756dfb4ffdedb85dcdcab --- www/js/lib/images.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/www/js/lib/images.js b/www/js/lib/images.js index 223a1191..4cdf79ce 100644 --- a/www/js/lib/images.js +++ b/www/js/lib/images.js @@ -125,12 +125,18 @@ define(['uiUtil'], function (uiUtil) { e.preventDefault(); e.stopPropagation(); } - var visibleImages = queueImages('poll', 0, function() { extractImages(visibleImages); }).visible; - visibleImages.forEach(function (image) { - image.style.opacity = '0'; - if (image.dataset.kiwixheight) image.height = image.dataset.kiwixheight; - else image.removeAttribute('height'); - }); + // DEV: Algorithm below doesn't queue webp images correctly, so for now we will extract images + // only one-by-one on image click + // var visibleImages = queueImages('poll', 0, function() { extractImages(visibleImages); }).visible; + // visibleImages.forEach(function (image) { + // image.style.opacity = '0'; + // if (image.dataset.kiwixheight) image.height = image.dataset.kiwixheight; + // else image.removeAttribute('height'); + //}); + extractImages([thisImage]); + thisImage.style.opacity = '0'; + if (thisImage.dataset.kiwixheight) thisImage.height = thisImage.dataset.kiwixheight; + else thisImage.removeAttribute('height'); }); } }