mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 616015 - Add a keyboard shortcut to reveal and hide the add-on bar (r=dao, a=blocker)
This commit is contained in:
parent
29b7e141af
commit
b8f7685eb8
@ -131,6 +131,7 @@
|
||||
<command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
|
||||
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
|
||||
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>
|
||||
<command id="Browser:ToggleAddonBar" oncommand="toggleAddonBar();"/>
|
||||
</commandset>
|
||||
|
||||
<commandset id="placesCommands">
|
||||
@ -374,6 +375,8 @@
|
||||
#expand <key id="key_selectTab8" oncommand="gBrowser.selectTabAtIndex(7, event);" key="8" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
|
||||
#expand <key id="key_selectLastTab" oncommand="gBrowser.selectTabAtIndex(-1, event);" key="9" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
|
||||
|
||||
<key id="key_toggleAddonBar" command="Browser:ToggleAddonBar" key="&toggleAddonBarCmd.key;" modifiers="accel"/>
|
||||
|
||||
</keyset>
|
||||
|
||||
# Used by baseMenuOverlay
|
||||
|
@ -4833,6 +4833,9 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
|
||||
menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true");
|
||||
if (popup.id != "appmenu_customizeMenu")
|
||||
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
|
||||
if (popup.id != "toolbar-context-menu")
|
||||
menuItem.setAttribute("key", toolbar.getAttribute("key"));
|
||||
|
||||
popup.insertBefore(menuItem, firstMenuItem);
|
||||
|
||||
menuItem.addEventListener("command", onViewToolbarCommand, false);
|
||||
@ -8403,6 +8406,11 @@ let AddonsMgrListener = {
|
||||
}
|
||||
};
|
||||
|
||||
function toggleAddonBar() {
|
||||
let addonBar = document.getElementById("addon-bar");
|
||||
setToolbarVisibility(addonBar, addonBar.collapsed);
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
|
||||
#ifdef XP_WIN
|
||||
// Only show resizers on Windows 2000 and XP
|
||||
|
@ -995,7 +995,8 @@
|
||||
mode="icons" iconsize="small" defaulticonsize="small"
|
||||
lockiconsize="true"
|
||||
defaultset="addonbar-closebutton,spring,status-bar"
|
||||
customizable="true">
|
||||
customizable="true"
|
||||
key="key_toggleAddonBar">
|
||||
<toolbarbutton id="addonbar-closebutton"
|
||||
tooltiptext="&addonBarCloseButton.tooltip;"
|
||||
oncommand="setToolbarVisibility(this.parentNode, false);"/>
|
||||
|
@ -238,6 +238,7 @@ _BROWSER_FILES = \
|
||||
app_subframe_bug575561.html \
|
||||
browser_contentAreaClick.js \
|
||||
browser_addon_bar_close_button.js \
|
||||
browser_addon_bar_shortcut.js \
|
||||
$(NULL)
|
||||
|
||||
# compartment-disabled
|
||||
|
50
browser/base/content/test/browser_addon_bar_shortcut.js
Normal file
50
browser/base/content/test/browser_addon_bar_shortcut.js
Normal file
@ -0,0 +1,50 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is browser add-on bar test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dietrich Ayala <dietrich@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
let addonbar = document.getElementById("addon-bar");
|
||||
ok(addonbar.collapsed, "addon bar is collapsed by default");
|
||||
|
||||
// show the add-on bar
|
||||
EventUtils.synthesizeKey("/", { accelKey: true }, window);
|
||||
ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
|
||||
|
||||
// hide the add-on bar
|
||||
EventUtils.synthesizeKey("/", { accelKey: true }, window);
|
||||
|
||||
// confirm addon bar is closed
|
||||
ok(addonbar.collapsed, "addon bar is collapsed after toggle");
|
||||
}
|
@ -550,3 +550,4 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
||||
<!ENTITY syncToolbarButton.label "Sync">
|
||||
|
||||
<!ENTITY addonBarCloseButton.tooltip "Close Add-on Bar">
|
||||
<!ENTITY toggleAddonBarCmd.key "/">
|
||||
|
Loading…
Reference in New Issue
Block a user