Forráskód Böngészése

disable auto-close on Firefox for Android
(see https://github.com/gildas-lormeau/SingleFile/issues/1679)

Gildas 1 éve
szülő
commit
b324cafc08

+ 5 - 1
src/core/bg/config.js

@@ -33,7 +33,9 @@ const REGEXP_RULE_PREFIX = "regexp:";
 const PROFILE_NAME_PREFIX = "profile_";
 
 const IS_NOT_SAFARI = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent) || /Vivaldi/.test(navigator.userAgent) || /OPR/.test(navigator.userAgent);
-const BACKGROUND_SAVE_SUPPORTED = !(/Mobile.*Firefox/.test(navigator.userAgent) || /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/Vivaldi/.test(navigator.userAgent) && !/OPR/.test(navigator.userAgent));
+const IS_MOBILE_FIREFOX = /Mobile.*Firefox/.test(navigator.userAgent);
+const BACKGROUND_SAVE_SUPPORTED = !(IS_MOBILE_FIREFOX || /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/Vivaldi/.test(navigator.userAgent) && !/OPR/.test(navigator.userAgent));
+const AUTOCLOSE_SUPPORTED = !IS_MOBILE_FIREFOX;
 const BADGE_COLOR_SUPPORTED = IS_NOT_SAFARI;
 const AUTO_SAVE_SUPPORTED = IS_NOT_SAFARI;
 const SELECTABLE_TABS_SUPPORTED = IS_NOT_SAFARI;
@@ -233,6 +235,7 @@ export {
 	DISABLED_PROFILE_NAME,
 	CURRENT_PROFILE_NAME,
 	BACKGROUND_SAVE_SUPPORTED,
+	AUTOCLOSE_SUPPORTED,
 	BADGE_COLOR_SUPPORTED,
 	AUTO_SAVE_SUPPORTED,
 	SELECTABLE_TABS_SUPPORTED,
@@ -387,6 +390,7 @@ async function onMessage(message) {
 			DEFAULT_PROFILE_NAME,
 			CURRENT_PROFILE_NAME,
 			BACKGROUND_SAVE_SUPPORTED,
+			AUTOCLOSE_SUPPORTED,
 			BADGE_COLOR_SUPPORTED,
 			AUTO_SAVE_SUPPORTED,
 			SELECTABLE_TABS_SUPPORTED,

+ 5 - 0
src/ui/bg/ui-help.js

@@ -24,6 +24,7 @@
 /* global browser, document */
 
 let BACKGROUND_SAVE_SUPPORTED,
+	AUTOCLOSE_SUPPORTED,
 	AUTO_SAVE_SUPPORTED,
 	AUTO_OPEN_EDITOR_SUPPORTED,
 	INFOBAR_SUPPORTED,
@@ -37,6 +38,7 @@ let BACKGROUND_SAVE_SUPPORTED,
 browser.runtime.sendMessage({ method: "config.getConstants" }).then(data => {
 	({
 		BACKGROUND_SAVE_SUPPORTED,
+		AUTOCLOSE_SUPPORTED,
 		AUTO_SAVE_SUPPORTED,
 		AUTO_OPEN_EDITOR_SUPPORTED,
 		INFOBAR_SUPPORTED,
@@ -58,6 +60,9 @@ function init() {
 		document.getElementById("autoSaveMenu").hidden = true;
 		document.getElementById("autoSaveHint").hidden = true;
 	}
+	if (!AUTOCLOSE_SUPPORTED) {
+		document.getElementById("autoCloseOption").hidden = true;
+	}
 	if (!BACKGROUND_SAVE_SUPPORTED) {
 		document.getElementById("backgroundSaveOption").hidden = true;
 		document.getElementById("confirmFilenameOption").hidden = true;

+ 5 - 0
src/ui/bg/ui-options.js

@@ -30,6 +30,7 @@ let DEFAULT_PROFILE_NAME,
 	DISABLED_PROFILE_NAME,
 	CURRENT_PROFILE_NAME,
 	BACKGROUND_SAVE_SUPPORTED,
+	AUTOCLOSE_SUPPORTED,
 	AUTO_SAVE_SUPPORTED,
 	AUTO_OPEN_EDITOR_SUPPORTED,
 	INFOBAR_SUPPORTED,
@@ -45,6 +46,7 @@ browser.runtime.sendMessage({ method: "config.getConstants" }).then(data => {
 		DISABLED_PROFILE_NAME,
 		CURRENT_PROFILE_NAME,
 		BACKGROUND_SAVE_SUPPORTED,
+		AUTOCLOSE_SUPPORTED,
 		AUTO_SAVE_SUPPORTED,
 		AUTO_OPEN_EDITOR_SUPPORTED,
 		INFOBAR_SUPPORTED,
@@ -835,6 +837,9 @@ function init() {
 		document.getElementById("showAutoSaveProfileOption").hidden = true;
 		rulesContainerElement.classList.add("compact");
 	}
+	if (!AUTOCLOSE_SUPPORTED) {
+		document.getElementById("autoCloseOption").hidden = true;
+	}
 	if (!BACKGROUND_SAVE_SUPPORTED) {
 		document.getElementById("backgroundSaveOptions").hidden = true;
 		document.getElementById("confirmFilenameOption").hidden = true;

+ 2 - 1
src/ui/pages/help.html

@@ -124,7 +124,8 @@
 						<p>Check this option to display the saved page in a new tab. This option can be useful, for
 							example, in order to check the page is properly saved.</p>
 					</li>
-					<li data-options-label="autoCloseLabel"> <span class="option">Option: auto-close the tab after the
+					<li data-options-label="autoCloseLabel" id="autoCloseOption"> <span class="option">Option:
+							auto-close the tab after the
 							page is saved</span>
 						<p>Check this option to automatically close the tab after saving the page displayed inside. </p>
 					</li>

+ 1 - 1
src/ui/pages/options.html

@@ -40,7 +40,7 @@
 				<label for="openSavedPageInput" id="openSavedPageLabel"></label>
 				<input type="checkbox" id="openSavedPageInput">
 			</div>
-			<div class="option">
+			<div class="option" id="autoCloseOption">
 				<label for="autoCloseInput" id="autoCloseLabel"></label>
 				<input type="checkbox" id="autoCloseInput">
 			</div>