2006-04-20 00:50:25 +04:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
2006-12-02 04:16:33 +03:00
|
|
|
<!DOCTYPE bindings [
|
|
|
|
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
|
|
|
|
%notificationDTD;
|
|
|
|
]>
|
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
<bindings id="notificationBindings"
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<binding id="notificationbox">
|
|
|
|
<content>
|
2006-05-25 22:55:34 +04:00
|
|
|
<xul:stack xbl:inherits="hidden=notificationshidden">
|
2006-04-20 00:50:25 +04:00
|
|
|
<xul:spacer/>
|
|
|
|
<children includes="notification"/>
|
|
|
|
</xul:stack>
|
|
|
|
<children/>
|
|
|
|
</content>
|
|
|
|
|
|
|
|
<implementation>
|
|
|
|
<field name="PRIORITY_INFO_LOW" readonly="true">1</field>
|
|
|
|
<field name="PRIORITY_INFO_MEDIUM" readonly="true">2</field>
|
|
|
|
<field name="PRIORITY_INFO_HIGH" readonly="true">3</field>
|
|
|
|
<field name="PRIORITY_WARNING_LOW" readonly="true">4</field>
|
|
|
|
<field name="PRIORITY_WARNING_MEDIUM" readonly="true">5</field>
|
|
|
|
<field name="PRIORITY_WARNING_HIGH" readonly="true">6</field>
|
|
|
|
<field name="PRIORITY_CRITICAL_LOW" readonly="true">7</field>
|
|
|
|
<field name="PRIORITY_CRITICAL_MEDIUM" readonly="true">8</field>
|
|
|
|
<field name="PRIORITY_CRITICAL_HIGH" readonly="true">9</field>
|
|
|
|
<field name="PRIORITY_CRITICAL_BLOCK" readonly="true">10</field>
|
|
|
|
|
|
|
|
<field name="currentNotification">null</field>
|
|
|
|
<field name="slideSteps">4</field>
|
|
|
|
|
|
|
|
<field name="_timer">null</field>
|
2006-09-09 00:57:51 +04:00
|
|
|
<field name="_closedNotification">null</field>
|
2006-07-27 19:54:28 +04:00
|
|
|
<field name="_blockingCanvas">null</field>
|
2006-04-20 00:50:25 +04:00
|
|
|
|
|
|
|
<property name="notificationsHidden"
|
|
|
|
onget="return this.getAttribute('notificationshidden') == 'true';">
|
|
|
|
<setter>
|
|
|
|
if (val)
|
|
|
|
this.setAttribute('notificationshidden', true);
|
|
|
|
else this.removeAttribute('notificationshidden');
|
2007-05-23 16:30:21 +04:00
|
|
|
return val;
|
2006-04-20 00:50:25 +04:00
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
2008-10-09 13:35:01 +04:00
|
|
|
<property name="allNotifications" readonly="true">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
var closedNotification = this._closedNotification;
|
|
|
|
var notifications = this.getElementsByTagName('notification');
|
|
|
|
return Array.filter(notifications, function(n) n != closedNotification);
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
2006-04-20 00:50:25 +04:00
|
|
|
|
|
|
|
<method name="getNotificationWithValue">
|
|
|
|
<parameter name="aValue"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var notifications = this.allNotifications;
|
|
|
|
for (var n = notifications.length - 1; n >= 0; n--) {
|
2009-11-25 08:00:49 +03:00
|
|
|
if (aValue == notifications[n].getAttribute("value"))
|
2006-04-20 00:50:25 +04:00
|
|
|
return notifications[n];
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="appendNotification">
|
|
|
|
<parameter name="aLabel"/>
|
|
|
|
<parameter name="aValue"/>
|
|
|
|
<parameter name="aImage"/>
|
|
|
|
<parameter name="aPriority"/>
|
|
|
|
<parameter name="aButtons"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (aPriority < this.PRIORITY_INFO_LOW ||
|
|
|
|
aPriority > this.PRIORITY_CRITICAL_BLOCK)
|
|
|
|
throw "Invalid notification priority " + aPriority;
|
|
|
|
|
|
|
|
// check for where the notification should be inserted according to
|
|
|
|
// priority. If two are equal, the existing one appears on top.
|
|
|
|
var notifications = this.allNotifications;
|
|
|
|
var insertPos = null;
|
2006-08-04 18:35:37 +04:00
|
|
|
for (var n = notifications.length - 1; n >= 0; n--) {
|
2006-04-20 00:50:25 +04:00
|
|
|
if (notifications[n].priority < aPriority)
|
|
|
|
break;
|
|
|
|
insertPos = notifications[n];
|
|
|
|
}
|
|
|
|
|
|
|
|
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
|
|
|
var newitem = document.createElementNS(XULNS, "notification");
|
|
|
|
newitem.setAttribute("label", aLabel);
|
|
|
|
newitem.setAttribute("value", aValue);
|
2008-04-30 01:29:30 +04:00
|
|
|
if (aImage)
|
2009-06-28 16:52:31 +04:00
|
|
|
newitem.setAttribute("image", aImage);
|
2006-09-14 01:26:41 +04:00
|
|
|
if (!insertPos) {
|
|
|
|
newitem.style.position = "fixed";
|
|
|
|
newitem.style.top = "100%";
|
|
|
|
}
|
2006-04-20 00:50:25 +04:00
|
|
|
this.insertBefore(newitem, insertPos);
|
|
|
|
|
|
|
|
if (aButtons) {
|
|
|
|
for (var b = 0; b < aButtons.length; b++) {
|
|
|
|
var button = aButtons[b];
|
|
|
|
var buttonElem = document.createElementNS(XULNS, "button");
|
|
|
|
buttonElem.setAttribute("label", button.label);
|
|
|
|
buttonElem.setAttribute("accesskey", button.accessKey);
|
|
|
|
|
|
|
|
newitem.appendChild(buttonElem);
|
|
|
|
buttonElem.buttonInfo = button;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
newitem.priority = aPriority;
|
|
|
|
if (aPriority >= this.PRIORITY_CRITICAL_LOW)
|
|
|
|
newitem.type = "critical";
|
|
|
|
else if (aPriority <= this.PRIORITY_INFO_HIGH)
|
|
|
|
newitem.type = "info";
|
|
|
|
else
|
|
|
|
newitem.type = "warning";
|
|
|
|
|
2006-08-09 00:16:49 +04:00
|
|
|
if (!insertPos)
|
|
|
|
this._showNotification(newitem, true);
|
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
// Fire event for accessibility APIs
|
|
|
|
var event = document.createEvent("Events");
|
|
|
|
event.initEvent("AlertActive", true, true);
|
2006-08-09 00:16:49 +04:00
|
|
|
newitem.dispatchEvent(event);
|
2006-04-20 00:50:25 +04:00
|
|
|
|
|
|
|
return newitem;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="removeNotification">
|
|
|
|
<parameter name="aItem"/>
|
2010-02-10 04:05:31 +03:00
|
|
|
<parameter name="aSkipAnimation"/>
|
2006-04-20 00:50:25 +04:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (aItem == this.currentNotification)
|
2010-02-10 04:05:31 +03:00
|
|
|
this.removeCurrentNotification(aSkipAnimation);
|
2008-10-09 13:35:01 +04:00
|
|
|
else if (aItem != this._closedNotification)
|
2006-04-20 00:50:25 +04:00
|
|
|
this.removeChild(aItem);
|
|
|
|
return aItem;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="removeCurrentNotification">
|
2010-02-10 04:05:31 +03:00
|
|
|
<parameter name="aSkipAnimation"/>
|
2006-04-20 00:50:25 +04:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-02-10 04:05:31 +03:00
|
|
|
this._showNotification(this.currentNotification, false, aSkipAnimation);
|
2006-04-20 00:50:25 +04:00
|
|
|
return null;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="removeAllNotifications">
|
|
|
|
<parameter name="aImmediate"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var notifications = this.allNotifications;
|
|
|
|
for (var n = notifications.length - 1; n >= 0; n--) {
|
|
|
|
if (aImmediate)
|
|
|
|
this.removeChild(notifications[n]);
|
|
|
|
else
|
|
|
|
this.removeNotification(notifications[n]);
|
|
|
|
}
|
|
|
|
this.currentNotification = null;
|
2008-10-09 13:35:01 +04:00
|
|
|
|
|
|
|
if (aImmediate && this._timer) {
|
|
|
|
// Must clear up any currently animating notification
|
|
|
|
clearInterval(this._timer);
|
|
|
|
if (this._closedNotification) {
|
|
|
|
this.removeChild(this._closedNotification);
|
|
|
|
this._closedNotification = null;
|
|
|
|
}
|
|
|
|
}
|
2006-04-20 00:50:25 +04:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2008-01-29 15:24:59 +03:00
|
|
|
<method name="removeTransientNotifications">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var notifications = this.allNotifications;
|
|
|
|
for (var n = notifications.length - 1; n >= 0; n--) {
|
|
|
|
var notification = notifications[n];
|
|
|
|
if (notification.persistence)
|
|
|
|
notification.persistence--;
|
|
|
|
else if (Date.now() > notification.timeout)
|
|
|
|
this.removeNotification(notification);
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
<method name="_showNotification">
|
|
|
|
<parameter name="aNotification"/>
|
|
|
|
<parameter name="aSlideIn"/>
|
2010-02-10 04:05:31 +03:00
|
|
|
<parameter name="aSkipAnimation"/>
|
2006-04-20 00:50:25 +04:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2006-09-09 00:57:51 +04:00
|
|
|
if (this._timer) {
|
|
|
|
clearInterval(this._timer);
|
|
|
|
if (this.currentNotification) {
|
|
|
|
this.currentNotification.style.marginTop = "0px";
|
|
|
|
this.currentNotification.style.opacity = 1;
|
|
|
|
}
|
2008-10-09 13:35:01 +04:00
|
|
|
if (this._closedNotification) {
|
|
|
|
this.removeChild(this._closedNotification);
|
|
|
|
this._closedNotification = null;
|
|
|
|
}
|
2006-09-09 00:57:51 +04:00
|
|
|
this._setBlockingState(this.currentNotification);
|
|
|
|
}
|
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
var height = aNotification.boxObject.height;
|
2010-02-10 04:05:31 +03:00
|
|
|
var skipAnimation = aSkipAnimation || (height == 0);
|
2006-04-20 00:50:25 +04:00
|
|
|
var change = height / this.slideSteps;
|
2008-06-16 05:38:49 +04:00
|
|
|
var margin;
|
2006-04-20 00:50:25 +04:00
|
|
|
if (aSlideIn) {
|
2006-09-14 01:26:41 +04:00
|
|
|
if (this.currentNotification &&
|
|
|
|
this.currentNotification.boxObject.height > height)
|
|
|
|
height = this.currentNotification.boxObject.height;
|
|
|
|
|
2006-09-09 00:57:51 +04:00
|
|
|
this.currentNotification = aNotification;
|
2006-09-14 01:26:41 +04:00
|
|
|
aNotification.style.removeProperty("position");
|
|
|
|
aNotification.style.removeProperty("top");
|
2009-11-25 08:00:49 +03:00
|
|
|
|
|
|
|
if (skipAnimation) {
|
|
|
|
this._setBlockingState(this.currentNotification);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-09-14 01:26:41 +04:00
|
|
|
aNotification.style.marginTop = -height + "px";
|
|
|
|
aNotification.style.opacity = 0;
|
2008-06-16 05:38:49 +04:00
|
|
|
margin = -height;
|
2006-04-20 00:50:25 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
change = -change;
|
2006-09-09 00:57:51 +04:00
|
|
|
this._closedNotification = aNotification;
|
|
|
|
var notifications = this.allNotifications;
|
2008-10-09 13:35:01 +04:00
|
|
|
var idx = notifications.length - 1;
|
2009-11-25 08:00:49 +03:00
|
|
|
this.currentNotification = (idx >= 0) ? notifications[idx] : null;
|
|
|
|
|
|
|
|
if (skipAnimation) {
|
|
|
|
this.removeChild(this._closedNotification);
|
|
|
|
this._closedNotification = null;
|
|
|
|
this._setBlockingState(this.currentNotification);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-16 05:38:49 +04:00
|
|
|
var style = window.getComputedStyle(aNotification, null);
|
|
|
|
margin = style.getPropertyCSSValue("margin-top").
|
|
|
|
getFloatValue(CSSPrimitiveValue.CSS_PX);
|
2006-04-20 00:50:25 +04:00
|
|
|
}
|
2006-08-04 18:35:37 +04:00
|
|
|
var opacitychange = change / height;
|
2008-06-16 05:38:49 +04:00
|
|
|
const FRAME_LENGTH = 50;
|
2006-04-20 00:50:25 +04:00
|
|
|
|
2008-10-09 13:35:01 +04:00
|
|
|
function slide(self, args, off) {
|
|
|
|
// If the notificationbox is disconnected then stop the timer
|
|
|
|
if (self.ownerDocument.compareDocumentPosition(self) &
|
|
|
|
Node.DOCUMENT_POSITION_DISCONNECTED) {
|
|
|
|
clearInterval(args.timer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-16 05:38:49 +04:00
|
|
|
var framesToHandle = 1;
|
2006-04-20 00:50:25 +04:00
|
|
|
|
2008-06-16 05:38:49 +04:00
|
|
|
// Skip frames if we aren't getting the desired frame rate.
|
|
|
|
if (off > 0)
|
|
|
|
framesToHandle += Math.round(off / FRAME_LENGTH);
|
|
|
|
|
|
|
|
margin += framesToHandle * change;
|
2006-04-20 00:50:25 +04:00
|
|
|
|
2008-06-16 05:38:49 +04:00
|
|
|
if (change > 0 && margin >= 0) {
|
2006-04-20 00:50:25 +04:00
|
|
|
aNotification.style.marginTop = "0px";
|
|
|
|
aNotification.style.opacity = 1;
|
|
|
|
}
|
2008-06-16 05:38:49 +04:00
|
|
|
else if (change < 0 && margin <= -height) {
|
2006-04-20 00:50:25 +04:00
|
|
|
aNotification.style.marginTop = -height + "px";
|
|
|
|
}
|
|
|
|
else {
|
2008-06-16 05:38:49 +04:00
|
|
|
aNotification.style.marginTop = margin.toFixed(4) + "px";
|
2006-04-20 00:50:25 +04:00
|
|
|
if (opacitychange)
|
|
|
|
aNotification.style.opacity =
|
2008-06-16 05:38:49 +04:00
|
|
|
Number(aNotification.style.opacity) + framesToHandle * opacitychange;
|
|
|
|
return;
|
2006-04-20 00:50:25 +04:00
|
|
|
}
|
|
|
|
|
2008-06-16 05:38:49 +04:00
|
|
|
clearInterval(self._timer);
|
|
|
|
self._timer = null;
|
2008-10-09 13:35:01 +04:00
|
|
|
if (self._closedNotification) {
|
|
|
|
self.removeChild(self._closedNotification);
|
|
|
|
self._closedNotification = null;
|
|
|
|
}
|
2008-06-16 05:38:49 +04:00
|
|
|
self._setBlockingState(self.currentNotification);
|
2006-04-20 00:50:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-09 13:35:01 +04:00
|
|
|
var args = {};
|
|
|
|
this._timer = setInterval(slide, FRAME_LENGTH, this, args);
|
|
|
|
args.timer = this._timer;
|
2006-04-20 00:50:25 +04:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2006-07-27 19:54:28 +04:00
|
|
|
<method name="_setBlockingState">
|
|
|
|
<parameter name="aNotification"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var isblock = aNotification &&
|
|
|
|
aNotification.priority == this.PRIORITY_CRITICAL_BLOCK;
|
|
|
|
var canvas = this._blockingCanvas;
|
|
|
|
if (isblock) {
|
|
|
|
if (!canvas)
|
|
|
|
canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
|
|
|
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
|
|
|
var content = this.firstChild;
|
|
|
|
if (!content ||
|
|
|
|
content.namespaceURI != XULNS ||
|
|
|
|
content.localName != "browser")
|
|
|
|
return;
|
|
|
|
|
|
|
|
var width = content.boxObject.width;
|
|
|
|
var height = content.boxObject.height;
|
|
|
|
content.collapsed = true;
|
|
|
|
|
|
|
|
canvas.setAttribute("width", width);
|
|
|
|
canvas.setAttribute("height", height);
|
|
|
|
canvas.setAttribute("flex", "1");
|
|
|
|
|
|
|
|
this.appendChild(canvas);
|
|
|
|
this._blockingCanvas = canvas;
|
|
|
|
|
|
|
|
var bgcolor = "white";
|
|
|
|
try {
|
|
|
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"].
|
|
|
|
getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
bgcolor = prefService.getCharPref("browser.display.background_color");
|
|
|
|
|
|
|
|
var win = content.contentWindow;
|
|
|
|
var context = canvas.getContext("2d");
|
|
|
|
context.globalAlpha = 0.5;
|
|
|
|
context.drawWindow(win, win.scrollX, win.scrollY,
|
|
|
|
width, height, bgcolor);
|
|
|
|
}
|
|
|
|
catch(ex) { };
|
|
|
|
}
|
|
|
|
else if (canvas) {
|
|
|
|
canvas.parentNode.removeChild(canvas);
|
|
|
|
this._blockingCanvas = null;
|
|
|
|
var content = this.firstChild;
|
|
|
|
if (content)
|
|
|
|
content.collapsed = false;
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
</implementation>
|
|
|
|
</binding>
|
2006-08-04 18:35:37 +04:00
|
|
|
|
2006-04-20 00:50:25 +04:00
|
|
|
<binding id="notification">
|
|
|
|
<content>
|
|
|
|
<xul:hbox class="notification-inner outset" flex="1" xbl:inherits="type">
|
|
|
|
<xul:hbox anonid="details" align="center" flex="1"
|
|
|
|
oncommand="this.parentNode.parentNode._doButtonCommand(event);">
|
|
|
|
<xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image"/>
|
|
|
|
<xul:description anonid="messageText" class="messageText" flex="1" xbl:inherits="xbl:text=label"/>
|
|
|
|
<xul:spacer flex="1"/>
|
|
|
|
<children/>
|
|
|
|
</xul:hbox>
|
|
|
|
<xul:toolbarbutton ondblclick="event.stopPropagation();"
|
2006-09-13 02:27:24 +04:00
|
|
|
class="messageCloseButton tabbable"
|
2006-04-20 00:50:25 +04:00
|
|
|
xbl:inherits="hidden=hideclose"
|
2006-12-02 04:16:33 +03:00
|
|
|
tooltiptext="&closeNotification.tooltip;"
|
2006-04-20 00:50:25 +04:00
|
|
|
oncommand="document.getBindingParent(this).close();"/>
|
|
|
|
</xul:hbox>
|
|
|
|
</content>
|
|
|
|
<resources>
|
|
|
|
<stylesheet src="chrome://global/skin/notification.css"/>
|
|
|
|
</resources>
|
|
|
|
<implementation implements="nsIAccessibleProvider">
|
2006-07-24 20:12:08 +04:00
|
|
|
<property name="accessibleType" readonly="true">
|
2006-04-20 00:50:25 +04:00
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
2006-07-24 20:12:08 +04:00
|
|
|
return Components.interfaces.nsIAccessibleProvider.XULAlert;
|
2006-04-20 00:50:25 +04:00
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
2007-05-23 16:30:21 +04:00
|
|
|
<property name="label" onset="this.setAttribute('label', val); return val;"
|
2006-04-20 00:50:25 +04:00
|
|
|
onget="return this.getAttribute('label');"/>
|
2007-05-23 16:30:21 +04:00
|
|
|
<property name="value" onset="this.setAttribute('value', val); return val;"
|
2006-04-20 00:50:25 +04:00
|
|
|
onget="return this.getAttribute('value');"/>
|
2007-05-23 16:30:21 +04:00
|
|
|
<property name="image" onset="this.setAttribute('image', val); return val;"
|
2006-04-20 00:50:25 +04:00
|
|
|
onget="return this.getAttribute('image');"/>
|
2007-05-23 16:30:21 +04:00
|
|
|
<property name="type" onset="this.setAttribute('type', val); return val;"
|
|
|
|
onget="return this.getAttribute('type');"/>
|
|
|
|
<property name="priority" onget="return parseInt(this.getAttribute('priority')) || 0;"
|
2006-04-20 00:50:25 +04:00
|
|
|
onset="this.setAttribute('priority', val); return val;"/>
|
2008-02-27 02:45:02 +03:00
|
|
|
<property name="persistence" onget="return parseInt(this.getAttribute('persistence')) || 0;"
|
2008-01-29 15:24:59 +03:00
|
|
|
onset="this.setAttribute('persistence', val); return val;"/>
|
|
|
|
<field name="timeout">0</field>
|
2006-04-20 00:50:25 +04:00
|
|
|
|
|
|
|
<property name="control" readonly="true">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
var parent = this.parentNode;
|
|
|
|
while (parent) {
|
|
|
|
if (parent.localName == "notificationbox")
|
|
|
|
return parent;
|
|
|
|
parent = parent.parentNode;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<method name="close">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var control = this.control;
|
|
|
|
if (control)
|
|
|
|
control.removeNotification(this);
|
|
|
|
else
|
|
|
|
this.hidden = true;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="_doButtonCommand">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!("buttonInfo" in aEvent.target))
|
|
|
|
return;
|
|
|
|
|
|
|
|
var button = aEvent.target.buttonInfo;
|
|
|
|
if (button.popup) {
|
2007-12-04 02:20:29 +03:00
|
|
|
document.popupNode = aEvent.target;
|
2006-04-20 00:50:25 +04:00
|
|
|
document.getElementById(button.popup).
|
|
|
|
showPopup(aEvent.originalTarget, -1, -1, "popup", "bottomleft", "topleft");
|
|
|
|
aEvent.stopPropagation();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var callback = button.callback;
|
|
|
|
if (callback) {
|
|
|
|
var result = callback(this, button);
|
|
|
|
if (!result)
|
|
|
|
this.close();
|
|
|
|
aEvent.stopPropagation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
2010-04-09 21:45:25 +04:00
|
|
|
|
|
|
|
<binding id="popup-notification">
|
2010-06-24 08:55:03 +04:00
|
|
|
<content align="start">
|
2010-04-09 21:45:25 +04:00
|
|
|
<xul:image class="popup-notification-icon"
|
|
|
|
xbl:inherits="popupid=id"/>
|
|
|
|
<xul:vbox>
|
|
|
|
<xul:description class="popup-notification-description"
|
|
|
|
xbl:inherits="value=label"/>
|
|
|
|
<xul:spacer flex="1"/>
|
|
|
|
<xul:hbox pack="end">
|
|
|
|
<xul:button anonid="button"
|
|
|
|
class="popup-notification-menubutton"
|
|
|
|
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey,type=buttontype">
|
|
|
|
<xul:menupopup anonid="menupopup"
|
|
|
|
xbl:inherits="oncommand=menucommand">
|
|
|
|
<children/>
|
|
|
|
</xul:menupopup>
|
|
|
|
</xul:button>
|
|
|
|
</xul:hbox>
|
|
|
|
</xul:vbox>
|
|
|
|
</content>
|
|
|
|
<implementation>
|
|
|
|
<field name="button" readonly="true">
|
|
|
|
document.getAnonymousElementByAttribute(this, "anonid", "button");
|
|
|
|
</field>
|
|
|
|
<field name="menupopup" readonly="true">
|
|
|
|
document.getAnonymousElementByAttribute(this, "anonid", "menupopup");
|
|
|
|
</field>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
2006-04-20 00:50:25 +04:00
|
|
|
</bindings>
|