|
1 <?xml version="1.0"?> |
|
2 |
|
3 <bindings xmlns="http://www.mozilla.org/xbl" |
|
4 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
5 <binding id="appbarBinding"> |
|
6 <content> |
|
7 <xul:toolbar anonid="toolbar"><children/></xul:toolbar> |
|
8 </content> |
|
9 |
|
10 <implementation implements="nsIDOMEventListener"> |
|
11 <field name="sticky">false</field> |
|
12 <field name="_toolbar" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "toolbar");</field> |
|
13 |
|
14 <property name="isShowing" readonly="true"> |
|
15 <getter> |
|
16 <![CDATA[ |
|
17 return this.getAttribute("visible") == "true"; |
|
18 ]]> |
|
19 </getter> |
|
20 </property> |
|
21 |
|
22 <method name="_fire"> |
|
23 <parameter name="aName"/> |
|
24 <body> |
|
25 <![CDATA[ |
|
26 let event = document.createEvent("Events"); |
|
27 event.initEvent(aName, true, false); |
|
28 this.dispatchEvent(event); |
|
29 ]]> |
|
30 </body> |
|
31 </method> |
|
32 |
|
33 <method name="dismiss"> |
|
34 <body> |
|
35 <![CDATA[ |
|
36 if (!this.isShowing) |
|
37 return; |
|
38 |
|
39 let self = this; |
|
40 this.setAttribute("hiding", "true"); |
|
41 this.addEventListener("transitionend", function appbar_transitionend() { |
|
42 self.removeEventListener("transitionend", appbar_transitionend, false); |
|
43 self.removeAttribute("hiding"); |
|
44 }, false); |
|
45 |
|
46 this._fire("MozAppbarDismissing"); |
|
47 this.removeAttribute("visible"); |
|
48 ]]> |
|
49 </body> |
|
50 </method> |
|
51 |
|
52 <method name="show"> |
|
53 <body> |
|
54 <![CDATA[ |
|
55 if (this.isShowing) |
|
56 return; |
|
57 |
|
58 this._fire("MozAppbarShowing"); |
|
59 this.setAttribute("visible", "true"); |
|
60 ]]> |
|
61 </body> |
|
62 </method> |
|
63 |
|
64 <method name="toggle"> |
|
65 <body> |
|
66 <![CDATA[ |
|
67 if (this.getAttribute("visible") === "true") { |
|
68 this.dismiss(); |
|
69 } else { |
|
70 this.show(); |
|
71 } |
|
72 ]]> |
|
73 </body> |
|
74 </method> |
|
75 </implementation> |
|
76 </binding> |
|
77 </bindings> |