|
|
@@ -82,6 +82,9 @@ const SingleFileCore = (() => {
|
|
|
if (!this.options.jsEnabled || (this.options.saveRawPage && this.options.removeScripts)) {
|
|
|
this.processor.insertNoscriptContents();
|
|
|
}
|
|
|
+ if (this.options.lazyLoadImages) {
|
|
|
+ this.processor.lazyLoadImages();
|
|
|
+ }
|
|
|
if (this.options.removeFrames) {
|
|
|
this.processor.removeFrames();
|
|
|
}
|
|
|
@@ -267,6 +270,14 @@ const SingleFileCore = (() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ lazyLoadImages() {
|
|
|
+ this.doc.querySelectorAll("img[data-src]").forEach(imgElement => {
|
|
|
+ if (imgElement.dataset.src && imgElement.src != imgElement.dataset.src) {
|
|
|
+ imgElement.src = imgElement.dataset.src;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
removeDiscardedResources() {
|
|
|
this.doc.querySelectorAll("applet, meta[http-equiv=refresh], object:not([type=\"image/svg+xml\"]):not([type=\"image/svg-xml\"]), embed:not([src*=\".svg\"]), link[rel*=preload], link[rel*=prefetch]").forEach(element => element.remove());
|
|
|
this.doc.querySelectorAll("[onload]").forEach(element => element.removeAttribute("onload"));
|
|
|
@@ -451,6 +462,7 @@ const SingleFileCore = (() => {
|
|
|
saveRawPage: this.options.saveRawPage,
|
|
|
compressHTML: this.options.compressHTML,
|
|
|
compressCSS: this.options.compressCSS,
|
|
|
+ lazyLoadImages: this.options.lazyLoadImages,
|
|
|
framesData: this.options.framesData
|
|
|
};
|
|
|
if (frameData.content) {
|