home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 80
/
MINAMI80.iso
/
Extra
/
DivXInstaller.exe
/
$PLUGINSDIR
/
GoogleToolbarFirefox.msi
/
xpi
/
chrome
/
google-toolbar.jar
/
content
/
toolbar.xml
< prev
next >
Wrap
Extensible Markup Language
|
2006-05-15
|
7KB
|
181 lines
<?xml version="1.0"?>
<bindings id="googleToolbarBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<!-- The google toolbar binding exists to ensure that the chevron menu
is always the last item in the toolbar. -->
<binding id="google-toolbar"
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
<content>
<children/>
<xul:toolbarbutton id="gtbChevron"
type="menu"
class="chevron"
mousethrough="never"
collapsed="true">
<xul:menupopup id="gtbChevronMenu"
onpopupshowing="if (event.target == this) GTB_Chevron_onShowMenu(event,this);"/>
</xul:toolbarbutton>
</content>
</binding>
<binding id="google-search-resize">
<content>
<xul:vbox inherits="tooltiptext"
class="google-search-resizer"/>
</content>
<implementation>
<field name="dragging"/>
<field name="lastX"/>
<!-- This method is called after the toolbar is customized.-->
<method name="handleCustomize">
<body><![CDATA[
// Update the splitter visiblities.
// Constants to track which side of the searchbox
// this splitter is on
var side = {"LEFT": 0, "RIGHT" : 1};
// Figure out which side the splitter is on by its ID
if (this.id == "gtbSearchBoxResizeLeft") {
splitterSide = side.LEFT;
}
else {
splitterSide = side.RIGHT;
}
// Go through the current toolbar and find out what the nearest
// resizeable element on the other side of the searchbox is.
// This item will be resized when the searchbox is resized, and
// if the element doesn't exist, the searchbox probably cannot be
// resized.
var isResizeable = {"urlbar-container" : 1,
"personal-bookmarks" : 1};
var currentItem = this.parentNode;
var itemToResize = null;
while (currentItem) {
if (isResizeable[currentItem.id]) {
itemToResize = currentItem;
break;
}
currentItem = splitterSide == side.LEFT ? currentItem.previousSibling
: currentItem.nextSibling;
}
// If there is no item to resize, the left resizer should always
// be off, and the right resizer should be off if it's not in the
// google toolbar.
if (itemToResize == null &&
(splitterSide == side.LEFT ||
(this.parentNode &&
this.parentNode.parentNode &&
this.parentNode.parentNode.id != "gtbToolbar"))) {
this.hidden = true;
}
else {
this.hidden = false;
}
]]></body>
</method>
<!-- This method is called when the mouse is unclicked, to stop
dragging if necessary. It's not implemented as a <handler>
because the mouse may go up outside of the splitter-->
<method name="globalMouseUp">
<parameter name="event"/>
<body><![CDATA[
if (this.dragging) {
// All done dragging.
this.dragging = false;
// Update any chevron menus that may need to be resized.
if(this.parentNode &&
this.parentNode.parentNode) {
if (this.parentNode.parentNode.id == "gtbToolbar") {
GTB_getToolbar().chevron.doResize();
}
else if (this.parentNode.parentNode.id == "PersonalToolbar") {
BookmarksToolbar.resizeFunc();
}
}
}
]]></body>
</method>
<!-- This method is called when the mouse is moved, to handle
dragging if necessary. It's nod implemented as a <handler>
in case the user drags the mouse outside of the splitter-->
<method name="globalMouseMove">
<parameter name="event"/>
<body><![CDATA[
// Only handle mouse move event if the user is currently dragging.
if (!this.dragging) {
return;
}
// Get the amount moved since the last event.
// if xDiff > 0, the mouse moved LEFT.
// if xDiff < 0, the mouse moved RIGHT.
var xDiff = this.lastX - event.screenX;
// Resize the search box based on whether the left or right
// slider was dragged and how far.
var computedStyle = document.defaultView.getComputedStyle(this.parentNode, '');
var computedWidth = parseInt(computedStyle["width"].replace('px', ''));
// Whether to add or subtract the X movement from the item
// depends on whether we're adjusting the right or left splitter
// and whether the item is the search box item or the stored item.
if (this.id == "gtbSearchBoxResizeLeft") {
computedWidth += xDiff;
}
else {
computedWidth -= xDiff;
}
// Don't go any wider than this.
if (computedWidth > 400) {
computedWidth = 400;
}
this.parentNode.setAttribute("width", computedWidth);
// Update the stored mouse X position
this.lastX = event.screenX;
]]></body>
</method>
<constructor>
<![CDATA[
this.dragging = false;
// Add events for mouse up and mouse out to the window.
// It's too easy to accidentally drag the mouse out of the
// slider area if these events are only handled for the slider.
var localThis = this;
var eventHandlerFunc = function handlerFunc(evt){ localThis.globalMouseUp(evt); }
window.addEventListener("mouseup", eventHandlerFunc, true);
var eventHandlerFunc2 = function handlerFunc2(evt){ localThis.globalMouseMove(evt); }
window.addEventListener("mousemove", eventHandlerFunc2, true);
]]>
</constructor>
</implementation>
<handlers>
<handler event="mousedown" button="0">
<![CDATA[
this.dragging = true;
this.lastX = event.screenX;
]]>
</handler>
</handlers>
</binding>
</bindings>