From 856af7f9f48639b20b48332d8d21aeddc2dd96be Mon Sep 17 00:00:00 2001 From: adamp01 Date: Wed, 6 Apr 2022 16:49:32 +0100 Subject: [PATCH] [WFX-375] Remove blank space before private tab menuitems. --- .../extensibles/content/ExtensiblesElements.jsm | 12 ++++++------ .../extensions/extensibles/content/PrivateTab.jsm | 9 ++++----- .../extensibles/locales/en-US/extensibles.ftl | 6 +++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/browser/extensions/extensibles/content/ExtensiblesElements.jsm b/browser/extensions/extensibles/content/ExtensiblesElements.jsm index 462851cff995f..28cea4e4cceb1 100644 --- a/browser/extensions/extensibles/content/ExtensiblesElements.jsm +++ b/browser/extensions/extensibles/content/ExtensiblesElements.jsm @@ -9,7 +9,7 @@ const ExtensiblesElements = { id: "openAllPrivate", "data-l10n-id": "open-all-private", accesskey: "v", - class: "menuitem-iconic privatetab-icon", + class: "privatetab-icon", oncommand: "openAllPrivate(event);", }, adjacentTo: "placesContext_openBookmarkContainer:tabs", @@ -21,7 +21,7 @@ const ExtensiblesElements = { id: "openAllLinksPrivate", "data-l10n-id": "open-all-links-private", accesskey: "v", - class: "menuitem-iconic privatetab-icon", + class: "privatetab-icon", oncommand: "openAllPrivate(event);", }, adjacentTo: "placesContext_openLinks:tabs", @@ -33,7 +33,7 @@ const ExtensiblesElements = { id: "openPrivate", "data-l10n-id": "open-private-tab", accesskey: "v", - class: "menuitem-iconic privatetab-icon", + class: "privatetab-icon", oncommand: "openPrivateTab(event);", }, adjacentTo: "placesContext_open:newtab", @@ -54,7 +54,6 @@ const ExtensiblesElements = { "data-l10n-id": "new-private-tab", accesskey: "v", acceltext: "Ctrl+Alt+P", // TODO: change to key getter - class: "menuitem-iconic privatetab-icon", oncommand: "browserOpenTabPrivate(window)", }, adjacentTo: "menu_newNavigatorTab", @@ -66,7 +65,7 @@ const ExtensiblesElements = { id: "openLinkInPrivateTab", "data-l10n-id": "open-link-private", accesskey: "v", - class: "menuitem-iconic privatetab-icon", + class: "privatetab-icon", hidden: true, }, adjacentTo: "context-openlinkintab", @@ -77,7 +76,8 @@ const ExtensiblesElements = { attrs: { id: "toggleTabPrivateState", "data-l10n-id": "private-tab", - class: "menuitem-iconic privatetab-icon", + "data-l10n-args": JSON.stringify({ isPrivate: "false" }), + class: "privatetab-icon", accesskey: "v", acceltext: "Ctrl+Alt+T", // TODO: change to key getter oncommand: "togglePrivate(window, TabContextMenu.contextTab)", diff --git a/browser/extensions/extensibles/content/PrivateTab.jsm b/browser/extensions/extensibles/content/PrivateTab.jsm index f899f2067abca..689e992e45704 100644 --- a/browser/extensions/extensibles/content/PrivateTab.jsm +++ b/browser/extensions/extensibles/content/PrivateTab.jsm @@ -284,13 +284,12 @@ const PrivateTab = { return; } let { document, PrivateTab } = win; + const isPrivate = + win.TabContextMenu.contextTab.userContextId === + PrivateTab.container.userContextId; document .getElementById("toggleTabPrivateState") - .setAttribute( - "checked", - win.TabContextMenu.contextTab.userContextId == - PrivateTab.container.userContextId - ); + .setAttribute("data-l10n-args", JSON.stringify({ isPrivate })); }, openLink(aEvent) { diff --git a/browser/extensions/extensibles/locales/en-US/extensibles.ftl b/browser/extensions/extensibles/locales/en-US/extensibles.ftl index bd3879c14f4ca..4f7d92bf0c359 100644 --- a/browser/extensions/extensibles/locales/en-US/extensibles.ftl +++ b/browser/extensions/extensibles/locales/en-US/extensibles.ftl @@ -16,7 +16,11 @@ open-link-private = .label = Open Link in New Private Tab private-tab = - .label = Private Tab + .label = + { $isPrivate -> + [true] Exit Private Tab + *[false] Make Private Tab + } status-bar = .label = Status Bar