Jelajahi Sumber

hide more options

Gildas 3 tahun lalu
induk
melakukan
8a3cf3e0e1
2 mengubah file dengan 17 tambahan dan 4 penghapusan
  1. 13 0
      src/ui/bg/ui-options.js
  2. 4 4
      src/ui/pages/options.html

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

@@ -28,6 +28,9 @@ const HELP_PAGE_PATH = "/src/ui/pages/help.html";
 let DEFAULT_PROFILE_NAME, DISABLED_PROFILE_NAME, CURRENT_PROFILE_NAME;
 const AUTO_SAVE_SUPPORTED = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent);
 const BACKGROUND_SAVE_SUPPORTED = !(/Mobile.*Firefox/.test(navigator.userAgent) || /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent));
+const OPEN_SAVED_PAGE_SUPPORT = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent);
+const INFOBAR_SUPPORT = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent);
+const BOOKMARKS_API_SUPPORTED = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent);
 
 browser.runtime.sendMessage({ method: "config.getConstants" }).then(data => ({ DEFAULT_PROFILE_NAME, DISABLED_PROFILE_NAME, CURRENT_PROFILE_NAME } = data));
 const removeHiddenElementsLabel = document.getElementById("removeHiddenElementsLabel");
@@ -666,6 +669,16 @@ if (!BACKGROUND_SAVE_SUPPORTED) {
 	document.getElementById("confirmFilenameOption").hidden = true;
 	document.getElementById("filenameConflictAction").hidden = true;
 }
+if (!BOOKMARKS_API_SUPPORTED) {
+	document.getElementById("bookmarksOptions").hidden = true;
+}
+if (!OPEN_SAVED_PAGE_SUPPORT) {
+	document.getElementById("openSavedPageOption").hidden = true;
+	document.getElementById("autoOpenEditorOption").hidden = true;
+}
+if (!INFOBAR_SUPPORT) {
+	document.getElementById("displayInfobar").hidden = true;
+}
 
 getHelpContents();
 

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

@@ -36,7 +36,7 @@
 				<label for="shadowEnabledInput" id="shadowEnabledLabel"></label>
 				<input type="checkbox" id="shadowEnabledInput">
 			</div>
-			<div class="option">
+			<div class="option" id="displayInfobarOption">
 				<label for="displayInfobarInput" id="displayInfobarLabel"></label>
 				<input type="checkbox" id="displayInfobarInput">
 			</div>
@@ -48,7 +48,7 @@
 				<label for="confirmInfobarInput" id="confirmInfobarLabel"></label>
 				<input type="checkbox" id="confirmInfobarInput">
 			</div>
-			<div class="option">
+			<div class="option" id="openSavedPageOption">
 				<label for="openSavedPageInput" id="openSavedPageLabel"></label>
 				<input type="checkbox" id="openSavedPageInput">
 			</div>
@@ -340,12 +340,12 @@
 				<label for="openEditorInput" id="openEditorLabel"></label>
 				<input type="checkbox" id="openEditorInput">
 			</div>
-			<div class="option">
+			<div class="option" id="autoOpenEditorOption">
 				<label for="autoOpenEditorInput" id="autoOpenEditorLabel"></label>
 				<input type="checkbox" id="autoOpenEditorInput">
 			</div>
 		</details>
-		<details>
+		<details id="bookmarksOptions">
 			<summary id="bookmarksLabel"></summary>
 			<div class="option">
 				<label for="saveCreatedBookmarksInput" id="saveCreatedBookmarksLabel"></label>