Bug 188910 - focus is in the searchbox of the bookmarks/history sidebar when opening a new window; should only be there when opening the sidebar, patch by Steffen Wilberg (steffen.wilberg@web.de), r=mconnor@myrealbox.com

This commit is contained in:
mconnor%myrealbox.com 2004-05-23 02:13:17 +00:00
Родитель 6dd42ba115
Коммит 2889fa079d
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -2745,8 +2745,25 @@ function toggleSidebar(aCommandID, forceOpen) {
sidebarBox.setAttribute("src", url);
sidebarBox.setAttribute("sidebarcommand", elt.id);
sidebarTitle.setAttribute("value", title);
if (aCommandID != "viewWebPanelsSidebar") { // no searchbox there
// if the sidebar we want is already constructed, focus the searchbox
if ((aCommandID == "viewBookmarksSidebar" && sidebar.contentDocument.getElementById("bookmarksPanel"))
|| (aCommandID == "viewHistorySidebar" && sidebar.contentDocument.getElementById("history-panel")))
sidebar.contentDocument.getElementById("search-box").focus();
// otherwiese, attach an onload handler
else
sidebar.addEventListener("load", asyncFocusSearchBox, true);
}
}
function asyncFocusSearchBox(event)
{
var sidebar = document.getElementById("sidebar");
var searchBox = sidebar.contentDocument.getElementById("search-box");
searchBox.focus();
sidebar.removeEventListener("load", asyncFocusSearchBox, true);
}
function openPreferences()
{
openDialog("chrome://browser/content/pref/pref.xul","PrefWindow",