now, insertion on a folder doesn't append but inserts before it. Allow multiple selection of bookmarks and folders for the home pages. git-svn-id: svn://10.0.0.236/trunk@135268 18797224-902f-48f8-a5cc-f745e15eee43
768 lines
32 KiB
XML
768 lines
32 KiB
XML
<?xml version="1.0"?>
|
|
# -*- Mode: HTML; indent-tabs-mode: nil; -*-
|
|
# Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
#
|
|
# The contents of this file are subject to the Netscape Public License
|
|
# Version 1.1 (the "License"); you may not use this file except in
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
# http://www.mozilla.org/NPL/
|
|
#
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
# for the specific language governing rights and limitations under the
|
|
# License.
|
|
#
|
|
# The Original Code is mozilla.org code.
|
|
#
|
|
# The Initial Developer of the Original Code is
|
|
# Netscape Communications Corporation.
|
|
# Portions created by the Initial Developer are Copyright (C) 1998
|
|
# the Initial Developer. All Rights Reserved.
|
|
#
|
|
# Contributor(s):
|
|
# Pierre Chanial <chanial@noos.fr> (Original Author)
|
|
#
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
# use your version of this file under the terms of the NPL, indicate your
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
# the provisions above, a recipient may use your version of this file under
|
|
# the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
<!DOCTYPE window [
|
|
<!ENTITY % bookmarksDTD SYSTEM "chrome://browser/locale/bookmarks/bookmarks.dtd" >
|
|
%bookmarksDTD;
|
|
]>
|
|
|
|
<bindings xmlns="http://www.mozilla.org/xbl"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
xmlns:xbl="http://www.mozilla.org/xbl">
|
|
|
|
<binding id="bookmarks-toolbar-base">
|
|
</binding>
|
|
|
|
<binding id="bookmarks-toolbar">
|
|
|
|
<implementation implements="nsIRDFObserver">
|
|
|
|
<constructor><![CDATA[
|
|
var hbox = (document.getAnonymousNodes(this))[0].firstChild;
|
|
this.toolbar.controllers.appendController(this.commandController);
|
|
var theToolbar = this;
|
|
var resizeFunc = function(event) {
|
|
theToolbar._overflowTimerInEffect = false;
|
|
var buttons = (document.getAnonymousNodes(theToolbar))[0].firstChild;
|
|
var menu = buttons.nextSibling.childNodes[1];
|
|
var width = window.innerWidth;
|
|
menu.collapsed = true;
|
|
var overflowed = false;
|
|
|
|
for (var i=4; i<buttons.childNodes.length; i++) {
|
|
var button = buttons.childNodes[i];
|
|
button.collapsed = overflowed;
|
|
|
|
if (button.boxObject.x + button.boxObject.width > width) {
|
|
overflowed = true;
|
|
// This button doesn't fit. Show it in the menu. Hide it in the toolbar.
|
|
if (!button.collapsed)
|
|
button.collapsed = true;
|
|
if (menu.collapsed) {
|
|
menu.collapsed = false;
|
|
var overflowPadder = document.getElementById("overflow-padder");
|
|
overflowPadder.width = width - menu.boxObject.width - theToolbar.boxObject.x;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.resizeFunc = resizeFunc;
|
|
window.addEventListener("resize", resizeFunc, false);
|
|
hbox.database.AddObserver(this);
|
|
]]></constructor>
|
|
|
|
<destructor>
|
|
var hbox = (document.getAnonymousNodes(this))[0].firstChild;
|
|
this.toolbar.controllers.removeController(this.commandController);
|
|
hbox.database.RemoveObserver(this);
|
|
</destructor>
|
|
|
|
<property name="toolbar">
|
|
<getter><![CDATA[
|
|
return document.getAnonymousElementByAttribute(this, "anonid", "bookmarks-ptf");
|
|
]]></getter>
|
|
</property>
|
|
|
|
<field name="resizeFunc">null</field>
|
|
<field name="_selection"> null</field>
|
|
<field name="_target"> null</field>
|
|
<field name="_orientation">null</field>
|
|
|
|
<!--////////////////////////////////////////////////////////////////////////////
|
|
// Fill a context menu popup with menuitems that are appropriate for the current
|
|
// selection.-->
|
|
<method name="createBTContextMenu">
|
|
<parameter name="aEvent"/>
|
|
<body><![CDATA[
|
|
var hbox = (document.getAnonymousNodes(this))[0].firstChild;
|
|
hbox.focus() <!-- buttons in the pt have -moz-user-focus: ignore -->
|
|
this._selection = this.getBTSelection(document.popupNode);
|
|
this._orientation = this.getBTOrientation(aEvent, document.popupNode);
|
|
this._target = this.getBTTarget(document.popupNode, this._orientation);
|
|
BookmarksCommand.createContextMenu(aEvent, this._selection);
|
|
this.onCommandUpdate();
|
|
aEvent.target.addEventListener("mousemove", this.commandController.onMouseMove, false)
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--////////////////////////////////////////////////////////////////////////////
|
|
// Fill a context menu popup with menuitems that are appropriate for the current
|
|
// selection. -->
|
|
<method name="destroyBTContextMenu">
|
|
<parameter name="aEvent"/>
|
|
<body><![CDATA[
|
|
if (content)
|
|
content.focus()
|
|
personalToolbarDNDObserver.onDragRemoveFeedBack(document.popupNode); // needed on cancel
|
|
aEvent.target.removeEventListener("mousemove", this.commandController.onMouseMove, false)
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--////////////////////////////////////////////////////////////////////////////
|
|
// Fill in tooltips for the bookmark toolbar. -->
|
|
<method name="fillInBTTooltip">
|
|
<parameter name="aTipElement"/>
|
|
<body><![CDATA[
|
|
var title = aTipElement.label;
|
|
var url = aTipElement.statusText;
|
|
|
|
if (!title && !url) {
|
|
// bail out early if there is nothing to show
|
|
return false;
|
|
}
|
|
|
|
var tooltipTitle = document.getElementById("ptTitleText");
|
|
var tooltipUrl = document.getElementById("ptUrlText");
|
|
if (title && title != url) {
|
|
tooltipTitle.removeAttribute("hidden");
|
|
tooltipTitle.setAttribute("value", title);
|
|
} else {
|
|
tooltipTitle.setAttribute("hidden", "true");
|
|
}
|
|
if (url) {
|
|
tooltipUrl.removeAttribute("hidden");
|
|
tooltipUrl.setAttribute("value", url);
|
|
} else
|
|
tooltipUrl.setAttribute("hidden", "true");
|
|
|
|
return true; // show tooltip
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// returns the formatted selection from aNode -->
|
|
<method name="getBTSelection">
|
|
<parameter name="aNode"/>
|
|
<body><![CDATA[
|
|
var item;
|
|
switch (aNode.id) {
|
|
case "bookmarks-ptf":
|
|
item = "NC:PersonalToolbarFolder";
|
|
break;
|
|
case "bookmarks-menu":
|
|
item = "NC:BookmarksRoot";
|
|
break;
|
|
default:
|
|
item = aNode.id;
|
|
}
|
|
if (!this.isBTBookmark(item))
|
|
return {length:0};
|
|
var parent = this.getBTContainer(aNode);
|
|
var isExpanded = aNode.hasAttribute("open") && aNode.open;
|
|
var selection = {};
|
|
selection.item = [RDF.GetResource(item)];
|
|
selection.parent = [RDF.GetResource(parent)];
|
|
selection.isExpanded = [isExpanded];
|
|
selection.length = selection.item.length;
|
|
BookmarksUtils.checkSelection(selection);
|
|
return selection;
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// returns the insertion target from aNode -->
|
|
<method name="getBTTarget">
|
|
<parameter name="aNode"/>
|
|
<parameter name="aOrientation"/>
|
|
<body><![CDATA[
|
|
var item, parent, index;
|
|
switch (aNode.id) {
|
|
case "bookmarks-ptf":
|
|
parent = "NC:PersonalToolbarFolder";
|
|
item = this.getLastVisibleBookmark();
|
|
break;
|
|
case "bookmarks-menu":
|
|
parent = "NC:BookmarksRoot";
|
|
break;
|
|
default:
|
|
if (aNode.getAttribute("class") == "chevron") {
|
|
parent = "NC:PersonalToolbarFolder";
|
|
break;
|
|
}
|
|
if (aOrientation == BookmarksUtils.DROP_ON)
|
|
parent = aNode.id
|
|
else {
|
|
parent = this.getBTContainer(aNode);
|
|
item = aNode;
|
|
}
|
|
}
|
|
|
|
parent = RDF.GetResource(parent);
|
|
if (aOrientation == BookmarksUtils.DROP_ON)
|
|
return BookmarksUtils.getTargetFromFolder(parent);
|
|
|
|
item = RDF.GetResource(item.id);
|
|
RDFC.Init(BMDS, parent);
|
|
index = RDFC.IndexOf(item);
|
|
if (aOrientation == BookmarksUtils.DROP_AFTER)
|
|
++index;
|
|
|
|
return { parent: parent, index: index };
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// returns the parent resource of a node in the personal toolbar.
|
|
// This is determined by inspecting the source element and walking up the
|
|
// DOM tree to find the appropriate containing node. -->
|
|
<method name="getBTContainer">
|
|
<parameter name="aNode"/>
|
|
<body><![CDATA[
|
|
var parent;
|
|
var item = aNode.id;
|
|
if (!this.isBTBookmark(item))
|
|
return "NC:BookmarksRoot"
|
|
parent = aNode.parentNode.parentNode;
|
|
if (parent.getAttribute("class") == "chevron")
|
|
parent = parent.parentNode.parentNode;
|
|
if (parent.localName == "stack")
|
|
parent = parent.parentNode;
|
|
parent = parent.id;
|
|
switch (parent) {
|
|
case "bookmarks-toolbar":
|
|
parent = "NC:PersonalToolbarFolder"
|
|
break;
|
|
case "bookmarks-menu":
|
|
parent = "NC:BookmarksRoot";
|
|
break;
|
|
}
|
|
return parent;
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// Returns true if the node is a bookmark, a folder or a bookmark separator -->
|
|
<method name="isBTBookmark">
|
|
<parameter name="aURI"/>
|
|
<body><![CDATA[
|
|
if (!aURI)
|
|
return false;
|
|
var type = BookmarksUtils.resolveType(aURI);
|
|
return (type == "BookmarkSeparator" ||
|
|
type == "Bookmark" ||
|
|
type == "Folder" ||
|
|
type == "FolderGroup" ||
|
|
type == "PersonalToolbarFolder")
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// Returns true if the node is a container. -->
|
|
<method name="isBTContainer">
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
return aTarget.localName == "menu" || (aTarget.localName == "toolbarbutton" &&
|
|
(aTarget.getAttribute("container") == "true" || aTarget.getAttribute("group") == "true"));
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// Returns BookmarksUtils.DROP_BEFORE, DROP_ON or DROP_AFTER accordingly
|
|
// to the event coordinates. Skin authors could break us, we'll cross that
|
|
// bridge when they turn us 90degrees. -->
|
|
<method name="getBTOrientation">
|
|
<parameter name="aEvent"/>
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
var target
|
|
if (!aTarget)
|
|
target = aEvent.originalTarget;
|
|
else
|
|
target = aTarget;
|
|
if (target.localName == "menu" &&
|
|
target.parentNode.localName != "menupopup" ||
|
|
target.getAttribute("class") == "chevron")
|
|
return BookmarksUtils.DROP_ON;
|
|
if (target.localName == "hbox") {
|
|
return target.childNodes.length>4?
|
|
BookmarksUtils.DROP_AFTER:BookmarksUtils.DROP_ON;
|
|
}
|
|
|
|
var overButtonBoxObject = target.boxObject.QueryInterface(Components.interfaces.nsIBoxObject);
|
|
var overParentBoxObject = target.parentNode.boxObject.QueryInterface(Components.interfaces.nsIBoxObject);
|
|
|
|
var size, border;
|
|
var coordValue, clientCoordValue;
|
|
switch (target.localName) {
|
|
case "toolbarseparator":
|
|
case "toolbarbutton":
|
|
size = overButtonBoxObject.width;
|
|
coordValue = overButtonBoxObject.x;
|
|
clientCoordValue = aEvent.clientX;
|
|
break;
|
|
case "menuseparator":
|
|
case "menu":
|
|
case "menuitem":
|
|
size = overButtonBoxObject.height;
|
|
coordValue = overButtonBoxObject.y-overParentBoxObject.y;
|
|
clientCoordValue = aEvent.clientY;
|
|
break;
|
|
default: return BookmarksUtils.DROP_ON;
|
|
}
|
|
if (this.isBTContainer(target))
|
|
if (target.localName == "toolbarbutton") {
|
|
// the DROP_BEFORE area excludes the label
|
|
var iconNode = document.getAnonymousElementByAttribute(target, "class", "toolbarbutton-icon");
|
|
border = parseInt(document.defaultView.getComputedStyle(target,"").getPropertyValue("padding-left")) +
|
|
parseInt(document.defaultView.getComputedStyle(iconNode ,"").getPropertyValue("width"));
|
|
border = Math.min(size/5,Math.max(border,4));
|
|
} else
|
|
border = size/5;
|
|
else
|
|
border = size/2;
|
|
|
|
// in the first region?
|
|
if (clientCoordValue-coordValue < border)
|
|
return BookmarksUtils.DROP_BEFORE;
|
|
// in the last region?
|
|
if (clientCoordValue-coordValue >= size-border)
|
|
return BookmarksUtils.DROP_AFTER;
|
|
// must be in the middle somewhere
|
|
return BookmarksUtils.DROP_ON;
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// expand the folder targeted by the context menu. -->
|
|
<method name="expandBTFolder">
|
|
<body><![CDATA[
|
|
var target = document.popupNode.lastChild;
|
|
if (document.popupNode.open)
|
|
target.hidePopup();
|
|
else
|
|
target.showPopup(document.popupNode);
|
|
]]></body>
|
|
</method>
|
|
|
|
<method name="onCommandUpdate">
|
|
<body><![CDATA[
|
|
var selection = this._selection;
|
|
var target = this._target;
|
|
BookmarksController.onCommandUpdate(selection, target);
|
|
if (document.popupNode.id == "NC:PersonalToolbarFolder") {
|
|
// disabling 'copy' on the empty area of the personal toolbar
|
|
var commandNode = document.getElementById("cmd_bm_copy");
|
|
commandNode.setAttribute("disabled", "true");
|
|
}
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// returns false if...
|
|
// - the parent is the bookmark menu or the chevron
|
|
// - the menupopup contains ony one bookmark -->
|
|
<method name="validOpenInTabsMenuItem">
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
var rParent = RDF.GetResource(aTarget.parentNode.id)
|
|
var type = BookmarksUtils.resolveType(rParent);
|
|
if (type != "Folder" && type != "FolderGroup" &&
|
|
type != "PersonalToolbarFolder")
|
|
return false;
|
|
var count = 0;
|
|
if (!aTarget.hasChildNodes())
|
|
return false;
|
|
var curr = aTarget.firstChild;
|
|
do {
|
|
type = BookmarksUtils.resolveType(curr.id);
|
|
if (type == "Bookmark" && ++count == 2)
|
|
return true;
|
|
curr = curr.nextSibling;
|
|
} while (curr)
|
|
return false;
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// shows the 'Open in Tabs' menu item if validOpenInTabsMenuItem is true -->
|
|
<method name="showOpenInTabsMenuItem">
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
if (!this.validOpenInTabsMenuItem(aTarget) ||
|
|
aTarget.lastChild.id == "openintabs-menuitem")
|
|
return;
|
|
var element = document.createElementNS(XUL_NS, "menuseparator");
|
|
aTarget.appendChild(element);
|
|
element = document.createElementNS(XUL_NS, "menuitem");
|
|
element.setAttribute("id", "openintabs-menuitem")
|
|
element.setAttribute("label", BookmarksUtils.getLocaleString("cmd_bm_openfolder"));
|
|
//element.setAttribute("class", "groupmark-item menuitem-iconic bookmark-item");
|
|
element.setAttribute("accesskey", BookmarksUtils.getLocaleString("cmd_bm_openfolder_accesskey"));
|
|
element.setAttribute("oncommand", "BookmarksUtils.loadBookmarkBrowser(event, this.parentNode.parentNode, this.database); event.preventBubble();");
|
|
aTarget.appendChild(element);
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// hides the 'Open in Tabs' on popuphidden so that we won't duplicate it -->
|
|
<method name="hideOpenInTabsMenuItem">
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
if (!aTarget.hasChildNodes())
|
|
return;
|
|
if (aTarget.lastChild.id == "openintabs-menuitem") {
|
|
aTarget.removeChild(aTarget.lastChild);
|
|
aTarget.removeChild(aTarget.lastChild);
|
|
}
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// returns the node of the last visible bookmark on the toolbar -->
|
|
<method name="getLastVisibleBookmark">
|
|
<body><![CDATA[
|
|
var buttons = (document.getAnonymousNodes(this))[0].firstChild;
|
|
var button = buttons.childNodes[3].nextSibling;
|
|
if (!button)
|
|
return null; // empty bookmarks toolbar
|
|
do {
|
|
if (button.collapsed)
|
|
return button.previousSibling;
|
|
button = button.nextSibling;
|
|
} while (button)
|
|
return buttons.lastChild;
|
|
]]></body>
|
|
</method>
|
|
|
|
<method name="updateOverflowMenu">
|
|
<parameter name="menupopup"/>
|
|
<body><![CDATA[
|
|
var hbox = (document.getAnonymousNodes(this))[0].firstChild;
|
|
for (var i = 4; i < hbox.childNodes.length; i++) {
|
|
var button = hbox.childNodes[i];
|
|
var menu = menupopup.childNodes[i-4];
|
|
if (menu.collapsed == button.collapsed)
|
|
menu.collapsed = !menu.collapsed;
|
|
}
|
|
]]></body>
|
|
</method>
|
|
|
|
<!--Implement nsIRDFObserver so we can update our overflow state when items get added/removed from
|
|
the toolbar -->
|
|
<field name="_overflowTimerInEffect">false</field>
|
|
<method name="setOverflowTimeout">
|
|
<body><![CDATA[
|
|
if (this._overflowTimerInEffect)
|
|
return;
|
|
this._overflowTimerInEffect = true;
|
|
setTimeout("document.getElementById('bookmarks-toolbar').resizeFunc(null)", 0);
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="onAssert">
|
|
<parameter name="aDataSource"/>
|
|
<parameter name="aSource"/>
|
|
<parameter name="aProperty"/>
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
if (aSource.Value != "NC:PersonalToolbarFolder" || aProperty.Value == "http://home.netscape.com/WEB-rdf#LastModifiedDate")
|
|
return;
|
|
this.setOverflowTimeout();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="onUnassert">
|
|
<parameter name="aDataSource"/>
|
|
<parameter name="aSource"/>
|
|
<parameter name="aProperty"/>
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
if (aSource.Value != "NC:PersonalToolbarFolder" || aProperty.Value == "http://home.netscape.com/WEB-rdf#LastModifiedDate")
|
|
return;
|
|
this.setOverflowTimeout();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="onChange">
|
|
<parameter name="aDataSource"/>
|
|
<parameter name="aSource"/>
|
|
<parameter name="aProperty"/>
|
|
<parameter name="aOldTarget"/>
|
|
<parameter name="aNewTarget"/>
|
|
<body><![CDATA[
|
|
if (aSource.Value != "NC:PersonalToolbarFolder" || aProperty.Value == "http://home.netscape.com/WEB-rdf#LastModifiedDate")
|
|
return;
|
|
this.setOverflowTimeout();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="onMove">
|
|
<parameter name="aDataSource"/>
|
|
<parameter name="aOldSource"/>
|
|
<parameter name="aNewSource"/>
|
|
<parameter name="aProperty"/>
|
|
<parameter name="aTarget"/>
|
|
<body><![CDATA[
|
|
if (aSource.Value != "NC:PersonalToolbarFolder")
|
|
return;
|
|
this.setOverflowTimeout();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="beginUpdateBatch">
|
|
<parameter name="aDataSource"/>
|
|
<body><![CDATA[
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="endUpdateBatch">
|
|
<parameter name="aDataSource"/>
|
|
<body><![CDATA[
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<!--/////////////////////////////////////////////////////////////////////////////
|
|
// Command controller -->
|
|
<field name="commandController" readonly="true"><![CDATA[
|
|
({
|
|
mOuter: this,
|
|
|
|
supportsCommand: BookmarksController.supportsCommand,
|
|
|
|
isCommandEnabled: function (aCommand)
|
|
{
|
|
// warning: this is not the function called in BookmarksController.onCommandUpdate
|
|
var selection = this.mOuter._selection;
|
|
var target = this.mOuter._target;
|
|
return BookmarksController.isCommandEnabled(aCommand, selection, target);
|
|
},
|
|
|
|
doCommand: function (aCommand)
|
|
{
|
|
personalToolbarDNDObserver.onDragRemoveFeedBack(document.popupNode);
|
|
var selection = this.mOuter._selection;
|
|
var target = this.mOuter._target;
|
|
switch (aCommand) {
|
|
case "cmd_bm_expandfolder":
|
|
this.mOuter.expandBTFolder();
|
|
break;
|
|
default:
|
|
BookmarksController.doCommand(aCommand, selection, target);
|
|
}
|
|
},
|
|
|
|
onMouseMove: function (aEvent)
|
|
{
|
|
var command = aEvent.originalTarget.getAttribute("command");
|
|
var isDisabled = aEvent.originalTarget.getAttribute("disabled")
|
|
if (isDisabled != "true" && (command == "cmd_bm_newfolder" || command == "cmd_bm_paste")) {
|
|
personalToolbarDNDObserver.onDragSetFeedBack(document.popupNode, this.parentNode.parentNode.parentNode._orientation);
|
|
} else {
|
|
personalToolbarDNDObserver.onDragRemoveFeedBack(document.popupNode);
|
|
}
|
|
}
|
|
|
|
})
|
|
]]></field>
|
|
|
|
</implementation>
|
|
|
|
<content>
|
|
<xul:stack flex="1" style="min-width:0px; width:0px;">
|
|
<xul:hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" anonid="bookmarks-ptf" contextmenu="_child"
|
|
flex="1" style="min-width:0px; width:0px;margin-left: 3px;"
|
|
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
|
ref="NC:PersonalToolbarFolder" flags="dont-test-empty"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
|
onpopupshowing="this.parentNode.parentNode.showOpenInTabsMenuItem(event.originalTarget)"
|
|
onpopuphidden="this.parentNode.parentNode.hideOpenInTabsMenuItem(event.originalTarget)"
|
|
oncommand="BookmarksUtils.loadBookmarkBrowser(event, event.originalTarget, this.database)"
|
|
onclick="BookmarksUtils.loadBookmarkBrowserMiddleClick(event, this.database)"
|
|
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarDNDObserver)"
|
|
ondragdrop="nsDragAndDrop.drop(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragenter="nsDragAndDrop.dragEnter(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragexit="nsDragAndDrop.dragExit(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragover="nsDragAndDrop.dragOver(event, personalToolbarDNDObserver); event.preventBubble()">
|
|
|
|
<!-- context menu -->
|
|
<xul:menupopup onpopupshowing="this.parentNode.parentNode.parentNode.createBTContextMenu(event);"
|
|
onpopuphidden ="this.parentNode.parentNode.parentNode.destroyBTContextMenu(event);"/>
|
|
|
|
<xul:tooltip id="ptTooltip" noautohide="true"
|
|
onpopupshowing="return this.parentNode.parentNode.parentNode.fillInBTTooltip(document.tooltipNode)">
|
|
<xul:vbox id="ptTooltipTextBox" flex="1">
|
|
<xul:label id="ptTitleText" />
|
|
<xul:label id="ptUrlText" />
|
|
</xul:vbox>
|
|
</xul:tooltip>
|
|
|
|
<xul:template xmlns:nc="http://home.netscape.com/NC-rdf#">
|
|
|
|
<xul:rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
|
<xul:toolbarseparator uri="rdf:*"
|
|
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
|
|
</xul:rule>
|
|
|
|
<!-- yes, the type attribute is necessary otherwise all leaves are
|
|
treated as containers for some reason -->
|
|
<xul:rule parent="hbox" iscontainer="true" isempty="true"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
|
<xul:toolbarbutton type="menu" editable="true" class="bookmark-item"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
|
uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name">
|
|
<xul:menupopup>
|
|
<xul:menuitem label="&emptyItem.label;" disabled="true"/>
|
|
</xul:menupopup>
|
|
</xul:toolbarbutton>
|
|
</xul:rule>
|
|
|
|
<xul:rule parent="hbox" iscontainer="true">
|
|
<xul:toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
|
<xul:menupopup/>
|
|
</xul:toolbarbutton>
|
|
</xul:rule>
|
|
|
|
<xul:rule parent="hbox">
|
|
<xul:toolbarbutton class="bookmark-item" uri="rdf:*" editable="true"
|
|
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
|
|
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
|
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
|
|
tooltip="ptTooltip"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
|
</xul:rule>
|
|
|
|
<xul:rule iscontainer="true" isempty="true" rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
|
<xul:menupopup>
|
|
<xul:menu class="menu-iconic bookmark-item" uri="rdf:*"
|
|
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
|
<xul:menupopup>
|
|
<xul:menuitem label="&emptyItem.label;" disabled="true"/>
|
|
</xul:menupopup>
|
|
</xul:menu>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
|
|
<xul:rule iscontainer="true">
|
|
<xul:menupopup>
|
|
<xul:menu class="menu-iconic bookmark-item" uri="rdf:*"
|
|
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
|
<xul:menupopup/>
|
|
</xul:menu>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
|
|
<xul:rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
|
<xul:menupopup>
|
|
<xul:menuseparator uri="rdf:*"
|
|
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
|
|
<xul:rule>
|
|
<xul:menupopup>
|
|
<xul:menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
|
image="rdf:http://home.netscape.com/NC-rdf#Icon"/>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
|
|
</xul:template>
|
|
</xul:hbox>
|
|
<xul:hbox class="bookmarks-toolbar-overflow-items" mousethrough="always">
|
|
<xul:hbox mousethrough="always" id="overflow-padder"/>
|
|
<xul:toolbarbutton mousethrough="never" collapsed="true" type="menu" class="chevron"
|
|
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
|
ref="NC:PersonalToolbarFolder" flags="dont-test-empty"
|
|
onpopupshowing="this.parentNode.parentNode.parentNode.showOpenInTabsMenuItem(event.originalTarget)"
|
|
onpopuphidden="this.parentNode.parentNode.parentNode.hideOpenInTabsMenuItem(event.originalTarget)"
|
|
oncommand="BookmarksUtils.loadBookmarkBrowser(event, event.originalTarget, this.database)"
|
|
onclick="BookmarksUtils.loadBookmarkBrowserMiddleClick(event, this.database)"
|
|
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarDNDObserver)"
|
|
ondragdrop="nsDragAndDrop.drop(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragenter="nsDragAndDrop.dragEnter(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragexit="nsDragAndDrop.dragExit(event, personalToolbarDNDObserver); event.preventBubble()"
|
|
ondragover="nsDragAndDrop.dragOver(event, personalToolbarDNDObserver); event.preventBubble()">
|
|
<xul:template xmlns:nc="http://home.netscape.com/NC-rdf#">
|
|
<xul:rule iscontainer="true" isempty="true"
|
|
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
|
<xul:menupopup>
|
|
<xul:menu class="menu-iconic bookmark-item" uri="rdf:*"
|
|
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
|
<xul:menupopup>
|
|
<xul:menuitem label="&emptyItem.label;" disabled="true"/>
|
|
</xul:menupopup>
|
|
</xul:menu>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
<xul:rule iscontainer="true">
|
|
<xul:menupopup>
|
|
<xul:menu class="menu-iconic bookmark-item" uri="rdf:*"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
|
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
|
<xul:menupopup />
|
|
</xul:menu>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
<xul:rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
|
<xul:menupopup>
|
|
<xul:menuseparator uri="rdf:*" />
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
<xul:rule>
|
|
<xul:menupopup>
|
|
<xul:menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
|
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
|
status="rdf:http://home.netscape.com/WEB-rdf#status"/>
|
|
</xul:menupopup>
|
|
</xul:rule>
|
|
</xul:template>
|
|
<xul:menupopup onpopupshowing="if (event.target != this) return;
|
|
this.parentNode.parentNode.parentNode.parentNode.updateOverflowMenu(this);"/>
|
|
</xul:toolbarbutton>
|
|
</xul:hbox>
|
|
<xul:toolbarbutton class="bookmark-item bookmarks-toolbar-customize" mousethrough="never"
|
|
label="Bookmarks Toolbar Items"/>
|
|
</xul:stack>
|
|
</content>
|
|
</binding>
|
|
|
|
</bindings>
|