mozilla

Compare Revisions

Using popup notifications

Change Revisions

Revision 71256:

Revision 71256 by Shaver on

Revision 71257:

Revision 71257 by karthikin on

Title:
Using popup notifications
Using popup notifications
Slug:
Using_popup_notifications
Using_popup_notifications
Tags:
Notifications
Notifications
Content:

Revision 71256
Revision 71257
tt118    <p>
119      <br>
120      Timeout Function for Notification Popup:
121    </p>
122    <p>
123      This the custom notification popup &amp; this script will b
 >e useful to dismiss or disappear the door-hanger popup in X perio
 >d.
124    </p>
125    <p>
126      <code>Components.utils.import('<a class=" external" href="r
 >esource://app/modules/PopupNotifications.jsm'" rel="freelink">res
 >ource://app/modules/PopupNotifications.jsm'</a>);<br>
127      var notify&nbsp; = new PopupNotifications(gBrowser,<br>
128      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
 >;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
 >p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
 >sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById("
 >notification-popup"),<br>
129      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
 >;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
 >p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
 >sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById("
 >notification-popup-box"));<br>
130      <br>
131      var notification =&nbsp; notify.show(<br>
132      gBrowser.selectedBrowser,&nbsp; /*browser*/<br>
133      "PDES-popup", /*id*/<br>
134      "Hi, there!, I'm gonna show you something today!!",/*messag
 >e*/<br>
135      null, /* anchor ID */<br>
136      /* mainAction */<br>
137      {<br>
138      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labe
 >l: "Click Here",<br>
139      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acce
 >ssKey: "D",<br>
140      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
141      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call
 >back: function() {<br>
142      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
 >;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 
 >you can call your function here!!!!<br>
143      <br>
144      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br
 >>
145      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>
146      null, /* secondaryActions*/<br>
147      <br>
148      { blablal:'options'}<br>
149      <br>
150      );<br>
151      <br>
152      setTimeout(function(){<br>
153      notification.remove();<br>
154      }, 900); //Time in seconds to disappear the door-hanger pop
 >up.</code>
155    </p>

Back to History