1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:52:26 +01:00

fix :sidebar refocussing error

This commit is contained in:
Doug Kearns
2008-10-17 12:12:53 +00:00
parent 0b749e4e73
commit 1e1a945f37
2 changed files with 11 additions and 12 deletions

View File

@@ -1063,13 +1063,10 @@ function Completion() //{{{
sidebar: function sidebar(filter) sidebar: function sidebar(filter)
{ {
var menu = document.getElementById("viewSidebarMenu"); let menu = document.getElementById("viewSidebarMenu");
var nodes = []; let panels = Array.map(menu.childNodes, function (n) [n.label, ""]);
for (let i = 0; i < menu.childNodes.length; i++) return [0, this.filter(panels, filter)];
nodes.push([menu.childNodes[i].label, ""]);
return [0, this.filter(nodes, filter)];
}, },
stylesheet: function stylesheet(filter) stylesheet: function stylesheet(filter)

View File

@@ -322,22 +322,24 @@ const config = { //{{{
{ {
args = args.string; args = args.string;
// do nothing if the requested sidebar is already open // focus if the requested sidebar is already open
if (document.getElementById("sidebar-title").value == args) if (document.getElementById("sidebar-title").value == args)
{ {
document.getElementById("sidebar-box").contentWindow.focus(); document.getElementById("sidebar-box").focus();
return; return;
} }
var menu = document.getElementById("viewSidebarMenu"); let menu = document.getElementById("viewSidebarMenu");
for (let i = 0; i < menu.childNodes.length; i++)
for (let [,panel] in Iterator(menu.childNodes))
{ {
if (menu.childNodes[i].label == args) if (panel.label == args)
{ {
menu.childNodes[i].doCommand(); panel.doCommand();
return; return;
} }
} }
liberator.echoerr("No sidebar " + args + " found"); liberator.echoerr("No sidebar " + args + " found");
}, },
{ {