Open
Bug 1145519
Opened 11 years ago
Updated 11 years ago
toggleSidebar shortcut command is broken in SeaMonkey for Firefox-style sidebars
Categories
(SeaMonkey :: Sidebar, defect)
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: pjdkrunkt, Assigned: philip.chee)
Details
Attachments
(1 file)
|
5.32 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33
Build ID: 20150308222025
Steps to reproduce:
When building a basic Sidebar extension for SeaMonkey, or converting a Sidebar extension from Firefox to SeaMonkey, the toggleSidebar function fails with the following error:
Error: ReferenceError: toggleSidebar is not defined
Source File: chrome://navigator/content/navigator.xul
Line: 1
For my SeaFox extension, I created several keyboard shortcuts that opens the Sidebar to specific panels for the Bookmarks or History sidebars. The exact same method could be used for other sidebars. Here is the function I'm using in SeaFox, it will obviously need to be modified to work appropriately in SeaMonkey, but I think it's pretty self-explanatory:
toggleSidebar: function(aPanel)
{
var panelToOpen = 'urn:sidebar:panel:'+aPanel;
if (document.getElementById("sidebar-box").hasAttribute('collapsed') == true)
{
document.getElementById("sidebar-panels").setAttribute("last-selected-panel", panelToOpen);
SidebarShowHide(); // open sidebar
}
else if (document.getElementById("sidebar-panels").getAttribute("last-selected-panel") == panelToOpen)
SidebarShowHide(); // close sidebar
else
SidebarSelectPanel(document.getElementById(panelToOpen),false,false); // switch panels
},
| Assignee | ||
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 1•11 years ago
|
||
Original patch by patrickjdempsey
> - // Translation rules to translate between new broadcaster id and old RDF id.
> - const TRANSLATE = {viewBookmarksSidebar: "bookmarks",
> - viewHistorySidebar: "history",
> - viewSearchSidebar: "search",
> - viewAddressbookSidebar: "addressbook"};
I removed the hard coded constants and made the code check for a "panelId" attribute on the broadcasters.
Comment 2•11 years ago
|
||
Comment on attachment 8582442 [details] [diff] [review]
Patch v1 add missing toggleSidebar
>+function toggleSidebar(aPanel) {
[Not supporting the forceOpen parameter, or the option to not passg a panel which just toggles the sidebar?]
>+ var panelId = bc.getAttribute("panelId");
panelId looks out of place in this file; panel_id perhaps?
>+ if (document.getElementById("sidebar-box").hasAttribute('collapsed') == true) {
>+ document.getElementById("sidebar-panels").setAttribute("last-selected-panel", panelToOpen);
>+ SidebarShowHide(); // open sidebar
>+ }
>+ else if (document.getElementById("sidebar-panels").getAttribute("last-selected-panel") == panelToOpen) {
>+ SidebarShowHide(); // close sidebar
>+ }
>+ else {
>+ var panelElement = document.getElementById(panelToOpen);
>+ SidebarSelectPanel(panelElement, false, false); // switch panels
>+ }
>+}
No mention of SidebarExpandCollapse()?
You need to log in
before you can comment on or make changes to this bug.
Description
•