OlgaTPark/tenfourfox#14 — M1144749, M1344211, M1441788 — Add a keyboard shortcut for Reader Mode

This commit includes the following Mozilla changes:   
 - Bug 1144749 - Add keyboard shortcut to open ReaderView.
 - Bug 1344211 - Reader view shortcut should be shown in 'View' menu.
 - Bug 1441788 - Expose Reader View shortcut in the address bar button's tooltip.

Please note that Windows users will also need https://bugzilla.mozilla.org/show_bug.cgi?id=1438308 (affects localizations) which isn't included here.

References:
https://bugzilla.mozilla.org/show_bug.cgi?id=1144749
https://hg.mozilla.org/mozilla-central/rev/c2849a432eee
https://bugzilla.mozilla.org/show_bug.cgi?id=1344211
https://hg.mozilla.org/mozilla-central/rev/9c177d80ee84
https://bugzilla.mozilla.org/show_bug.cgi?id=1441788
https://hg.mozilla.org/mozilla-central/rev/5ed5cde4cb2c
This commit is contained in:
OlgaTPark 2020-10-07 02:55:36 +02:00 committed by Cameron Kaiser
parent dd9a07bbe8
commit 61f16fc359
7 changed files with 14 additions and 3 deletions

View File

@ -323,6 +323,7 @@
#endif
<menuitem id="menu_readerModeItem"
observes="View:ReaderView"
key="key_toggleReaderMode"
hidden="true"/>
<menuitem id="menu_showAllTabs"
hidden="true"

View File

@ -367,6 +367,7 @@
<key id="key_fullScreen_old" key="&fullScreenCmd.macCommandKey;" command="View:FullScreen" modifiers="accel,shift"/>
<key keycode="VK_F11" command="View:FullScreen"/>
#endif
<key id="key_toggleReaderMode" key="&toggleReaderMode.key;" command="View:ReaderView" modifiers="accel,alt" disabled="true"/>
<key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/>
<key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/>
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>

View File

@ -5414,6 +5414,7 @@ const nodeToTooltipMap = {
"tabs-newtab-button": "newTabButton.tooltip",
"fullscreen-button": "fullscreenButton.tooltip",
"downloads-button": "downloads.tooltip",
"reader-mode-button": "reader-mode-button.tooltip",
};
const nodeToShortcutMap = {
"bookmarks-menu-button": "manBookmarkKb",
@ -5421,7 +5422,8 @@ const nodeToShortcutMap = {
"new-tab-button": "key_newNavigatorTab",
"tabs-newtab-button": "key_newNavigatorTab",
"fullscreen-button": "key_fullScreen",
"downloads-button": "key_openDownloads"
"downloads-button": "key_openDownloads",
"reader-mode-button": "key_toggleReaderMode",
};
//if (AppConstants.platform == "macosx") {

View File

@ -733,6 +733,7 @@
onclick="gPopupBlockerObserver.onReportButtonClick(event);"/>
<image id="reader-mode-button"
class="urlbar-icon"
tooltip="dynamic-shortcut-tooltip"
hidden="true"
onclick="ReaderParent.buttonClick(event);"/>
</hbox>

View File

@ -105,6 +105,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY fullScreenCmd.macCommandKey "f">
<!ENTITY showAllTabsCmd.label "Show All Tabs">
<!ENTITY showAllTabsCmd.accesskey "A">
<!ENTITY toggleReaderMode.key "R">
<!ENTITY fxaSignIn.label "Sign in to &syncBrand.shortName.label;">
<!ENTITY fxaSignedIn.tooltip "Open &syncBrand.shortName.label; preferences">

View File

@ -291,6 +291,10 @@ tabHistory.goForward=Go forward to this page
# URL Bar
pasteAndGo.label=Paste & Go
# LOCALIZATION NOTE (reader-mode-button.tooltip):
# %S is the keyboard shortcut for entering/exiting reader view
reader-mode-button.tooltip=Toggle reader view (%S)
# Block autorefresh
refreshBlocked.goButton=Allow
refreshBlocked.goButton.accesskey=A

View File

@ -139,22 +139,23 @@ var ReaderParent = {
let button = win.document.getElementById("reader-mode-button");
let command = win.document.getElementById("View:ReaderView");
let key = win.document.getElementById("key_toggleReaderMode");
if (browser.currentURI.spec.startsWith("about:reader")) {
button.setAttribute("readeractive", true);
button.hidden = false;
let closeText = gStringBundle.GetStringFromName("readerView.close");
button.setAttribute("tooltiptext", closeText);
command.setAttribute("label", closeText);
command.setAttribute("hidden", false);
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.close.accesskey"));
key.setAttribute("disabled", false);
} else {
button.removeAttribute("readeractive");
button.hidden = !browser.isArticle;
let enterText = gStringBundle.GetStringFromName("readerView.enter");
button.setAttribute("tooltiptext", enterText);
command.setAttribute("label", enterText);
command.setAttribute("hidden", !browser.isArticle);
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.enter.accesskey"));
key.setAttribute("disabled", !browser.isArticle);
}
let currentUriHost = browser.currentURI && browser.currentURI.asciiHost;