Selaa lähdekoodia

prevent displaying profiles menu entry if only the default exists

Gildas 7 vuotta sitten
vanhempi
sitoutus
92a2724988
1 muutettua tiedostoa jossa 14 lisäystä ja 12 poistoa
  1. 14 12
      extension/ui/bg/ui-menu.js

+ 14 - 12
extension/ui/bg/ui-menu.js

@@ -104,21 +104,23 @@ singlefile.ui.menu = (() => {
 					type: "separator"
 				});
 			}
-			browser.menus.create({
-				id: MENU_ID_SELECT_PROFILE,
-				title: browser.i18n.getMessage("menuSelectProfile"),
-				contexts: defaultContexts,
-			});
-			Object.keys(config.profiles).forEach((profileName, profileIndex) => {
+			if (config.profiles.length > 1) {
 				browser.menus.create({
-					id: MENU_ID_SELECT_PROFILE_PREFIX + profileIndex,
-					type: "radio",
+					id: MENU_ID_SELECT_PROFILE,
+					title: browser.i18n.getMessage("menuSelectProfile"),
 					contexts: defaultContexts,
-					title: profileName,
-					checked: tabsData.profileName ? tabsData.profileName == profileName : profileName == singlefile.config.DEFAULT_PROFILE_NAME,
-					parentId: MENU_ID_SELECT_PROFILE
 				});
-			});
+				Object.keys(config.profiles).forEach((profileName, profileIndex) => {
+					browser.menus.create({
+						id: MENU_ID_SELECT_PROFILE_PREFIX + profileIndex,
+						type: "radio",
+						contexts: defaultContexts,
+						title: profileName,
+						checked: tabsData.profileName ? tabsData.profileName == profileName : profileName == singlefile.config.DEFAULT_PROFILE_NAME,
+						parentId: MENU_ID_SELECT_PROFILE
+					});
+				});
+			}
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE,
 				contexts: defaultContexts,