Ver Fonte

make sure loadDeferredImages is true

Gildas há 5 anos atrás
pai
commit
bb7576c0ec

+ 7 - 1
extension/core/bg/business.js

@@ -236,7 +236,13 @@ singlefile.extension.core.bg.business = (() => {
 	function cancelTask(taskInfo) {
 		const tabId = taskInfo.tab.id;
 		taskInfo.cancelled = true;
-		singlefile.extension.core.bg.tabs.sendMessage(tabId, { method: "content.cancelSave", options: { loadDeferredImagesKeepZoomLevel: taskInfo.options.loadDeferredImagesKeepZoomLevel } });
+		singlefile.extension.core.bg.tabs.sendMessage(tabId, {
+			method: "content.cancelSave",
+			options: {
+				loadDeferredImages: taskInfo.options.loadDeferredImages,
+				loadDeferredImagesKeepZoomLevel: taskInfo.options.loadDeferredImagesKeepZoomLevel
+			}
+		});
 		if (taskInfo.cancel) {
 			taskInfo.cancel();
 		}

+ 6 - 2
extension/core/content/content-main.js

@@ -56,7 +56,9 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 					ui.onEndPage();
 					browser.runtime.sendMessage({ method: "ui.processCancelled" });
 				}
-				singlefile.lib.processors.lazy.content.loader.resetZoomLevel(message.options);
+				if (message.options.loadDeferredImages) {
+					singlefile.lib.processors.lazy.content.loader.resetZoomLevel(message.options);
+				}
 				return {};
 			}
 			if (message.method == "content.getSelectedLinks") {
@@ -143,7 +145,9 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 			if (!processor.cancelled) {
 				if (event.type == event.RESOURCES_INITIALIZED) {
 					maxIndex = event.detail.max;
-					singlefile.lib.processors.lazy.content.loader.resetZoomLevel(options);
+					if (options.loadDeferredImages) {
+						singlefile.lib.processors.lazy.content.loader.resetZoomLevel(options);
+					}
 				}
 				if (event.type == event.RESOURCES_INITIALIZED || event.type == event.RESOURCE_LOADED) {
 					if (event.type == event.RESOURCE_LOADED) {

+ 3 - 1
lib/single-file/index.js

@@ -68,7 +68,9 @@ this.singlefile = this.singlefile || {
 			options.insertCanonicalLink = true;
 			options.onprogress = event => {
 				if (event.type === event.RESOURCES_INITIALIZED) {
-					this.processors.lazy.content.loader.resetZoomLevel(options);
+					if (options.loadDeferredImages) {
+						this.processors.lazy.content.loader.resetZoomLevel(options);
+					}
 				}
 			};
 			const processor = new this.SingleFile(options);