From af4bcb85fee9989968b1bbb4c5da12ee319988ac Mon Sep 17 00:00:00 2001 From: tom5079 Date: Thu, 20 Jan 2022 13:08:48 +0900 Subject: [PATCH] Added flip_lazy_images --- assets/js/dev/common.js | 12 ++++++++++++ hitomi-dev.html.ver | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/js/dev/common.js b/assets/js/dev/common.js index 99eae745..df33c2f3 100644 --- a/assets/js/dev/common.js +++ b/assets/js/dev/common.js @@ -129,6 +129,18 @@ function retry(fn, retries, err) { }); } +function flip_lazy_images() { + const sources = document.querySelectorAll('source.picturelazyload'); + sources.forEach(function(lazyEl) { + lazyEl.setAttribute("srcset", lazyEl.getAttribute("data-srcset")); + }); + + const imgs = document.querySelectorAll('img.lazyload'); + imgs.forEach(function(lazyEl) { + lazyEl.setAttribute("src", lazyEl.getAttribute("data-src")); + //lazyEl.setAttribute("srcset", lazyEl.getAttribute("data-srcset")); //can't do this because the webp shim can't handle it + }); +} $(document).ready(function() { $("#lang").mouseenter(function() { diff --git a/hitomi-dev.html.ver b/hitomi-dev.html.ver index c7f4d9de..1f06e5c5 100644 --- a/hitomi-dev.html.ver +++ b/hitomi-dev.html.ver @@ -1 +1 @@ -0.0.6-DEV01 +0.0.6-DEV02