Gildas 7 лет назад
Родитель
Сommit
5376ca8b4e

+ 7 - 3
extension/core/bg/config.js

@@ -49,7 +49,7 @@ singlefile.config = (() => {
 		autoSaveLoadOrUnload: true,
 		removeAlternativeFonts: true,
 		removeAlternativeMedias: true,
-		removeSrcSet: true,
+		removeAlternativeImages: true,
 		groupDuplicateImages: true
 	};
 
@@ -136,8 +136,12 @@ singlefile.config = (() => {
 		if (config.removeAlternativeMedias === undefined) {
 			config.removeAlternativeMedias = true;
 		}
-		if (config.removeSrcSet === undefined) {
-			config.removeSrcSet = true;
+		if (config.removeAlternativeImages === undefined) {
+			if (config.removeAlternativeImages === undefined) {
+				config.removeAlternativeImages = true;
+			} else {
+				config.removeAlternativeImages = config.removeAlternativeImages;
+			}
 		}
 		if (config.groupDuplicateImages === undefined) {
 			config.groupDuplicateImages = true;

+ 3 - 3
extension/ui/bg/options.js

@@ -88,7 +88,7 @@
 	const autoSaveUnloadInput = document.getElementById("autoSaveUnloadInput");
 	const autoSaveLoadOrUnloadInput = document.getElementById("autoSaveLoadOrUnloadInput");
 	const removeAlternativeFontsInput = document.getElementById("removeAlternativeFontsInput");
-	const removeSrcSetInput = document.getElementById("removeSrcSetInput");
+	const removeAlternativeImagesInput = document.getElementById("removeAlternativeImagesInput");
 	const removeAlternativeMediasInput = document.getElementById("removeAlternativeMediasInput");
 	const groupDuplicateImagesInput = document.getElementById("groupDuplicateImagesInput");
 	const expandAllButton = document.getElementById("expandAllButton");
@@ -196,7 +196,7 @@
 		autoSaveLoadInput.disabled = config.autoSaveLoadOrUnload;
 		autoSaveUnloadInput.disabled = config.autoSaveLoadOrUnload;
 		removeAlternativeFontsInput.checked = config.removeAlternativeFonts;
-		removeSrcSetInput.checked = config.removeSrcSet;
+		removeAlternativeImagesInput.checked = config.removeAlternativeImages;
 		groupDuplicateImagesInput.checked = config.groupDuplicateImages;
 		removeAlternativeMediasInput.checked = config.removeAlternativeMedias;
 	}
@@ -229,7 +229,7 @@
 			autoSaveUnload: autoSaveUnloadInput.checked,
 			autoSaveLoadOrUnload: autoSaveLoadOrUnloadInput.checked,
 			removeAlternativeFonts: removeAlternativeFontsInput.checked,
-			removeSrcSet: removeSrcSetInput.checked,
+			removeAlternativeImages: removeAlternativeImagesInput.checked,
 			removeAlternativeMedias: removeAlternativeMediasInput.checked,
 			groupDuplicateImages: groupDuplicateImagesInput.checked
 		});

+ 2 - 2
extension/ui/pages/options.html

@@ -65,8 +65,8 @@
 			<input type="checkbox" id="lazyLoadImagesInput">
 		</div>
 		<div class="option">
-			<label for="removeSrcSetInput" id="removeAlternativeImagesLabel"></label>
-			<input type="checkbox" id="removeSrcSetInput">
+			<label for="removeAlternativeImagesInput" id="removeAlternativeImagesLabel"></label>
+			<input type="checkbox" id="removeAlternativeImagesInput">
 		</div>
 	</details>
 	<details>

+ 2 - 2
lib/single-file/single-file-core.js

@@ -76,7 +76,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			{ action: "repairDocument" },
 			{ action: "replaceStyleContents" },
 			{ option: "removeVideoSrc", action: "insertVideoPosters" },
-			{ option: "removeSrcSet", action: "removeSrcSet" },
+			{ option: "removeAlternativeImages", action: "removeAlternativeImages" },
 			{ option: "removeFrames", action: "removeFrames" },
 			{ option: "removeImports", action: "removeImports" },
 			{ option: "removeScripts", action: "removeScripts" },
@@ -512,7 +512,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			DOM.minifyFonts(this.doc);
 		}
 
-		removeSrcSet() {
+		removeAlternativeImages() {
 			this.doc.querySelectorAll("picture, img[srcset]").forEach(element => {
 				const tagName = element.tagName.toLowerCase();
 				const dataAttributeName = DOM.responsiveImagesAttributeName(this.options.sessionId);