Sidebar keyboard accessibility - Alt+PgUp/Alt+PgDn to switch sidebar tabs. r=sgehani, sr=jag

This commit is contained in:
aaronl%netscape.com 2001-12-15 00:36:51 +00:00
Родитель c55960067b
Коммит 427b96a1d6
2 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -76,6 +76,8 @@
<key id="key_fullScreen" keycode="VK_F11" command="View:FullScreen"/>
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
<key id="key_viewInfo" key="&pageInfoCmd.commandkey;" command="View:PageInfo" modifiers="accel"/>
<key id="key_viewNextSidebarPanel" keycode="VK_PAGE_DOWN" oncommand="SidebarGetRelativePanel(1);" modifiers="alt" />
<key id="key_viewPrevSidebarPanel" keycode="VK_PAGE_UP" oncommand="SidebarGetRelativePanel(-1);" modifiers="alt" />
<!-- Search Menu -->
<key id="key_find" key="&findOnCmd.commandkey;" command="Browser:Find" modifiers="accel"/>

Просмотреть файл

@ -121,6 +121,19 @@ function (index)
return this.get_panel_from_header_node(this.node.childNodes.item(index));
}
sbPanelList.prototype.find_first =
function (panels)
{
debug("pick_default_panel: length=" + this.node.childNodes.length);
for (var ii = 2; ii < this.node.childNodes.length; ii += 2) {
var panel = this.get_panel_from_header_index(ii);
if (!panel.is_excluded()) {
return panel;
}
}
return null;
}
sbPanelList.prototype.find_last =
function (panels)
{
@ -789,6 +802,40 @@ function SidebarGetLastSelectedPanel()
sidebarObj.panels.node.getAttribute('last-selected-panel'));
}
function SidebarGetRelativePanel(direction)
{
// direction == 1 to view next panel, -1 to view prev panel
if (sidebar_is_hidden())
SidebarShowHide();
if (sidebar_is_collapsed())
SidebarExpandCollapse();
var currentPanel = sidebarObj.panels.get_panel_from_id(SidebarGetLastSelectedPanel());
if (!currentPanel) {
sidebarObj.panels.select_default_panel();
return;
}
var newPanel = currentPanel;
do {
var newPanelIndex = newPanel.index + (direction * 2);
if (newPanelIndex < 2 || newPanelIndex >= sidebarObj.panels.node.childNodes.length)
newPanel = (direction == 1)? sidebarObj.panels.find_first(): sidebarObj.panels.find_last();
else
newPanel = sidebarObj.panels.get_panel_from_header_index(newPanelIndex);
if (!newPanel)
break;
if (!newPanel.is_excluded()) {
SidebarSelectPanel(newPanel.header, true, true); // found a panel that's not excluded to select -- do it
break;
}
} while (newPanel != currentPanel); // keep looking for a panel, but don't loop infinitely
}
function SidebarStopPanelLoad(header) {
var panel = sidebarObj.panels.get_panel_from_header_node(header);
panel.stop_load();