|
@@ -441,6 +441,24 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
imgElement.setAttribute("src", imgData.src);
|
|
imgElement.setAttribute("src", imgData.src);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ if (this.options.lazyLoadImages) {
|
|
|
|
|
+ this.doc.querySelectorAll("img[data-srcset]").forEach(imgElement => {
|
|
|
|
|
+ const imgData = this.options.imageData[Number(imgElement.getAttribute(dataAttributeName))];
|
|
|
|
|
+ if (!imgData.srcset && imgElement.getAttribute("data-srcset")) {
|
|
|
|
|
+ imgElement.setAttribute("srcset", imgElement.dataset.srcset);
|
|
|
|
|
+ imgElement.removeAttribute("data-srcset");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.doc.querySelectorAll("img[data-src]").forEach(imgElement => {
|
|
|
|
|
+ const imgData = this.options.imageData[Number(imgElement.getAttribute(dataAttributeName))];
|
|
|
|
|
+ if ((!imgData.src || imgData.empty) && !imgData.srcset && imgElement.getAttribute("data-src")) {
|
|
|
|
|
+ imgData.src = imgElement.dataset.src;
|
|
|
|
|
+ imgData.empty = false;
|
|
|
|
|
+ imgElement.setAttribute("src", imgElement.dataset.src);
|
|
|
|
|
+ imgElement.removeAttribute("data-src");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|