203556 - bookmark toolbar folders should behave like menus, patch by basic <basic@mozillanews.org> r=ben@mozilla.org...

git-svn-id: svn://10.0.0.236/trunk@156663 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ben%bengoodger.com 2004-05-20 22:53:10 +00:00
parent 24728ec446
commit e92185dff0
3 changed files with 32 additions and 6 deletions

View File

@ -545,11 +545,6 @@ function delayedStartup()
shell.shouldCheckDefaultBrowser = checkEveryTime.value;
}
#endif
// Start update checker
// var updates = Components.classes["@mozilla.org/updates/update-service;1"]
// .getService(Components.interfaces.nsIUpdateService);
// updates.watchForUpdates();
}
function Shutdown()

View File

@ -237,7 +237,9 @@
</toolbaritem>
<toolbaritem id="personal-bookmarks" title="&bookmarksItem.title;" flex="1">
<stack id="bookmarks-stack" flex="1" style="min-width:0px; width:0px;">
<stack id="bookmarks-stack" flex="1" style="min-width:0px; width:0px;"
onpopupshowing="BookmarksToolbar.setOpenedMenu(event);"
onpopuphidden="BookmarksToolbar.unsetOpenedMenu(event);">
<hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" contextmenu="bookmarks-context-menu"
flex="1" style="min-width:0px; width:0px;margin-left: 3px;"
datasources="rdf:bookmarks rdf:files rdf:localsearch"

View File

@ -803,6 +803,35 @@ var BookmarksMenuDNDObserver = {
var BookmarksToolbar =
{
/////////////////////////////////////////////////////////////////////////////
// make bookmarks toolbar act like menus
openedMenuButton:null,
autoOpenMenu: function (aEvent)
{
var target = aEvent.target;
if (BookmarksToolbar.openedMenuButton != target &&
target.nodeName == "toolbarbutton" &&
target.type == "menu") {
BookmarksToolbar.openedMenuButton.open = false;
target.open = true;
}
},
setOpenedMenu: function (aEvent)
{
if (aEvent.target.parentNode.localName == 'toolbarbutton') {
if (!this.openedMenuButton)
aEvent.currentTarget.addEventListener("mouseover", this.autoOpenMenu, true);
this.openedMenuButton = aEvent.target.parentNode;
}
},
unsetOpenedMenu: function (aEvent)
{
if (aEvent.target.parentNode.localName == 'toolbarbutton') {
aEvent.currentTarget.removeEventListener("mouseover", this.autoOpenMenu, true);
this.openedMenuButton = null;
}
},
/////////////////////////////////////////////////////////////////////////////
// returns the node of the last visible bookmark on the toolbar -->
getLastVisibleBookmark: function ()