From 6c65336591861331f2504327116445b03590f7c1 Mon Sep 17 00:00:00 2001 From: toptaran Date: Wed, 13 Sep 2023 14:01:31 +0300 Subject: [PATCH] Fix: fixLazyLoadImageSource when image source in data-src attribute (#1) Fix: fixLazyLoadImageSource when image source in data-src attribute --- package.json | 3 ++- plugin/js/ImageCollector.js | 9 ++++++--- readme.md | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4b3b2a6f..82b467fd 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,8 @@ { "name": "Dimava"}, { "name": "Leone Jacob Sunil (ImLJS)"}, { "name": "Yoanhg421"}, - { "name": "xRahul"} + { "name": "xRahul"}, + { "name": "Oleksii Taranenko"} ], "license": "GPL-3.0-only", "bugs": { diff --git a/plugin/js/ImageCollector.js b/plugin/js/ImageCollector.js index 92000ce7..d2d86b46 100644 --- a/plugin/js/ImageCollector.js +++ b/plugin/js/ImageCollector.js @@ -270,9 +270,12 @@ class ImageCollector { } } - let lazySrc = img.getAttribute("data-lazy-src"); - if (lazySrc != null) { - img.src = lazySrc; + for(let attrib of ["data-lazy-src", "data-src"]) { + let lazySrc = img.getAttribute(attrib); + if (lazySrc != null) { + img.src = lazySrc; + break; + } } return img.src; } diff --git a/readme.md b/readme.md index 0d546612..b616e1ea 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,7 @@ Credits * Yoanhg421 * Leone Jacob Sunil (ImLJS) * xRahul +* Oleksii Taranenko ## How to use with Baka-Tsuki: * Browse to a Baka-Tsuki web page that has the full text of a story. @@ -166,4 +167,4 @@ WebToEpub uses the following libraries: > * Find `security.fileuri.strict_origin_policy` parameter > * Set it to false > * Load `unitTest/Tests.html` -> * (Remember to reset `security.fileuri.strict_origin_policy` to true when done. \ No newline at end of file +> * (Remember to reset `security.fileuri.strict_origin_policy` to true when done.