Просмотр исходного кода

added "overlay a shadow" option

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

+ 6 - 1
extension/core/scripts/bg/config.js

@@ -52,6 +52,10 @@ singlefile.config = (() => {
 			config.removeImports = true;
 			localStorage.config = JSON.stringify(config);
 		}
+		if (config.shadowEnabled == undefined) {
+			config.shadowEnabled = true;
+			localStorage.config = JSON.stringify(config);
+		}		
 	}
 
 	return {
@@ -70,7 +74,8 @@ singlefile.config = (() => {
 				compressCSS: true,
 				lazyLoadImages: true,
 				appendSaveDate: true,
-				contextMenuEnabled: true
+				contextMenuEnabled: true,
+				shadowEnabled: true
 			};
 		},
 		reset() {

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

@@ -36,7 +36,9 @@
 			getOptions(message.options)
 				.then(options => SingleFile.initialize(options))
 				.then(process => {
-					singlefile.ui.init();
+					if (message.options.shadowEnabled) {
+						singlefile.ui.init();
+					}
 					return process();
 				})
 				.then(page => {
@@ -44,7 +46,9 @@
 					page.filename = page.title + (message.options.appendSaveDate ? " (" + date.toISOString().split("T")[0] + " " + date.toLocaleTimeString() + ")" : "") + ".html";
 					page.url = URL.createObjectURL(new Blob([page.content], { type: "text/html" }));
 					downloadPage(page);
-					singlefile.ui.end();
+					if (message.options.shadowEnabled) {
+						singlefile.ui.end();
+					}
 					processing = false;
 				})
 				.catch(error => {

+ 9 - 0
extension/ui/pages/help.html

@@ -49,6 +49,15 @@
 							<u>check</u> this option</p>
 					</li>
 
+					<li>
+						<span class="option">overlay a shadow on the page during processing</span>
+						<p>Check this option to overlay a shadow on the page when SingleFile is retrieving page resources. This reminds you that
+							you should not close the tab.
+						</p>
+						<p class="notice">It is recommended to
+							<u>check</u> this option</p>
+					</li>
+
 					<li>
 						<span class="option">append the save date to the filename</span>
 						<p>Check this option to append the save date of the webpage to the filename.

+ 4 - 0
extension/ui/pages/options.html

@@ -16,6 +16,10 @@
 				<label for="contextMenuEnabledInput">add entry in the context menu</label>
 				<input type="checkbox" id="contextMenuEnabledInput">
 			</div>
+			<div class="option">
+				<label for="shadowEnabledInput">overlay a shadow on the page during processing</label>
+				<input type="checkbox" id="shadowEnabledInput">
+			</div>
 			<h4>Filename</h4>
 			<div class="option">
 				<label for="appendSaveDateInput">append the save date to the filename</label>

+ 4 - 1
extension/ui/scripts/bg/options.js

@@ -36,6 +36,7 @@
 		const lazyLoadImagesInput = document.getElementById("lazyLoadImagesInput");
 		const contextMenuEnabledInput = document.getElementById("contextMenuEnabledInput");
 		const appendSaveDateInput = document.getElementById("appendSaveDateInput");
+		const shadowEnabledInput = document.getElementById("shadowEnabledInput");
 		document.getElementById("resetButton").addEventListener("click", () => {
 			bgPage.singlefile.config.reset();
 			refresh();
@@ -57,6 +58,7 @@
 			lazyLoadImagesInput.checked = config.lazyLoadImages;
 			contextMenuEnabledInput.checked = config.contextMenuEnabled;
 			appendSaveDateInput.checked = config.appendSaveDate;
+			shadowEnabledInput.checked = config.shadowEnabled;
 		}
 
 		function update() {
@@ -71,7 +73,8 @@
 				compressCSS: compressCSSInput.checked,
 				lazyLoadImages: lazyLoadImagesInput.checked,
 				contextMenuEnabled: contextMenuEnabledInput.checked,
-				appendSaveDate: appendSaveDateInput.checked
+				appendSaveDate: appendSaveDateInput.checked,
+				shadowEnabled: shadowEnabledInput.checked
 			});
 			bgPage.singlefile.ui.update();
 		}