home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
-
- <bindings 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"
- xmlns:html="http://www.w3.org/1999/xhtml">
-
- <binding id="notification"
- extends="../dialog/dialog.xml#dialog"
- inheritstyle="false">
- <resources>
- <stylesheet src="notification.css"/>
- </resources>
-
- <implementation implements="nsIDOMEventListener">
- <field name="nodeDraggable">null</field>
-
- <field name="mAnimateWindowClose">true</field>
- <field name="mAnimateWindowOpacity">true</field>
-
- <constructor><![CDATA[
- ]]></constructor>
-
- <method name="init">
- <parameter name="aParameters"/>
- <body><![CDATA[
- if (aParameters) {
- if ("animateWindowClose" in aParameters)
- this.mAnimateWindowClose = aParameters.animateWindowClose;
-
- if ("animateWindowOpacity" in aParameters)
- this.mAnimateWindowOpacity = aParameters.animateWindowOpacity;
- }
-
- if (this.platform.os.name == "linux")
- this.mAnimateWindowOpacity = false;
- ]]></body>
- </method>
-
- <method name="close">
- <body><![CDATA[
- if (this.mAnimateWindowClose)
- this.move(-1);
- else
- window.close();
- ]]></body>
- </method>
-
- <method name="transition">
- <parameter name="stage"/>
- <body><![CDATA[
- let src = screen;
-
- window.moveTo(
- src.availLeft + src.availWidth - window.outerWidth,
- src.availTop + src.availHeight - stage * window.outerHeight
- );
-
- if (this.mAnimateWindowOpacity)
- this.style.opacity = stage;
- ]]></body>
- </method>
-
- <method name="move">
- <parameter name="direction"/>
- <body><![CDATA[
- direction = direction == undefined ? 1 : direction;
-
- var context = this,
- stage = direction > 0 ? 0 : 1,
- step = 0.1 * direction,
- delay = 10;
-
- stage += step;
- this.transition(stage);
-
- var interval = setInterval(function(me) {
- stage += step;
-
- if (stage > 0.99)
- clearInterval(interval);
-
- if (stage < 0.01)
- window.close();
-
- me.transition(stage);
- }, delay, this);
- ]]></body>
- </method>
-
- </implementation>
-
- <handlers>
- <handler event="command"><![CDATA[
- if (event.originalTarget.data) {
- var data = event.originalTarget.data;
- if (data.command)
- data.command.call(data.context || null);
- //this.close();
- }
- ]]></handler>
- </handlers>
- </binding>
- </bindings>