1 |
wakaba |
1.1 |
<?xml version="1.0"?>
|
2 |
|
|
<bindings xmlns="http://www.mozilla.org/xbl">
|
3 |
|
|
<binding id="expandable-li">
|
4 |
|
|
<implementation>
|
5 |
|
|
<constructor>
|
6 |
|
|
var ol = this.xoxoSubList;
|
7 |
|
|
if (ol) {
|
8 |
|
|
this.setAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
9 |
|
|
'xoxo:enabled', 'true');
|
10 |
|
|
if (ol.hasAttribute ('compact')) {
|
11 |
|
|
this.setAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
12 |
|
|
'xoxo:expanded', 'false');
|
13 |
|
|
} else {
|
14 |
|
|
this.setAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
15 |
|
|
'xoxo:expanded', 'true');
|
16 |
|
|
}
|
17 |
|
|
}
|
18 |
|
|
</constructor>
|
19 |
|
|
<property name="xoxoExpanded">
|
20 |
|
|
<getter>
|
21 |
|
|
var ol = this.xoxoSubList;
|
22 |
|
|
if (ol) {
|
23 |
|
|
if (ol.hasAttribute ('compact')) {
|
24 |
|
|
return false;
|
25 |
|
|
} else {
|
26 |
|
|
return true;
|
27 |
|
|
}
|
28 |
|
|
} else {
|
29 |
|
|
return true;
|
30 |
|
|
}
|
31 |
|
|
</getter>
|
32 |
|
|
<setter>
|
33 |
|
|
var ol = this.xoxoSubList;
|
34 |
|
|
if (ol) {
|
35 |
|
|
if (val) {
|
36 |
|
|
ol.removeAttribute ('compact');
|
37 |
|
|
this.setAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
38 |
|
|
'xoxo:expanded', 'true');
|
39 |
|
|
} else {
|
40 |
|
|
ol.setAttribute ('compact', 'compact');
|
41 |
|
|
this.setAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
42 |
|
|
'xoxo:expanded', 'false');
|
43 |
|
|
}
|
44 |
|
|
} else {
|
45 |
|
|
this.removeAttributeNS ('http://suika.fam.cx/www/style/html/xoxo#',
|
46 |
|
|
'xoxo:expanded');
|
47 |
|
|
}
|
48 |
|
|
</setter>
|
49 |
|
|
</property>
|
50 |
|
|
<property name="xoxoSubList" readonly="true">
|
51 |
|
|
<getter>
|
52 |
|
|
return this.getElementsByTagName ('ol')[0];
|
53 |
|
|
</getter>
|
54 |
|
|
</property>
|
55 |
|
|
</implementation>
|
56 |
|
|
<handlers>
|
57 |
|
|
<handler event="click"><![CDATA[
|
58 |
|
|
var target = event.target /* li */;
|
59 |
|
|
var ol = this.xoxoSubList;
|
60 |
|
|
if (ol) {
|
61 |
|
|
var dp = target.compareDocumentPosition (ol);
|
62 |
|
|
if (!(dp == 0 /* same node */) &&
|
63 |
|
|
!(dp & target.DOCUMENT_POSITION_CONTAINS)) {
|
64 |
|
|
/* ol.compact = !ol.compact; */
|
65 |
|
|
this.xoxoExpanded = !this.xoxoExpanded;
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
event.stopPropagation ();
|
69 |
|
|
]]></handler>
|
70 |
|
|
</handlers>
|
71 |
|
|
</binding>
|
72 |
|
|
</bindings>
|
73 |
|
|
<!-- ***** BEGIN LICENSE BLOCK *****
|
74 |
|
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
75 |
|
|
-
|
76 |
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
77 |
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
78 |
|
|
- the License. You may obtain a copy of the License at
|
79 |
|
|
- <http://www.mozilla.org/MPL/>
|
80 |
|
|
-
|
81 |
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
82 |
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
83 |
|
|
- for the specific language governing rights and limitations under the
|
84 |
|
|
- License.
|
85 |
|
|
-
|
86 |
|
|
- The Original Code is <http://suika.fam.cx/www/style/html/xoxo> code.
|
87 |
|
|
-
|
88 |
|
|
- The Initial Developer of the Original Code is Wakaba.
|
89 |
|
|
- Portions created by the Initial Developer are Copyright (C) 2005
|
90 |
|
|
- the Initial Developer. All Rights Reserved.
|
91 |
|
|
-
|
92 |
|
|
- Contributor(s):
|
93 |
|
|
- Wakaba <w@suika.fam.cx>
|
94 |
|
|
-
|
95 |
|
|
- Alternatively, the contents of this file may be used under the terms of
|
96 |
|
|
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
97 |
|
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
98 |
|
|
- in which case the provisions of the GPL or the LGPL are applicable instead
|
99 |
|
|
- of those above. If you wish to allow use of your version of this file only
|
100 |
|
|
- under the terms of either the GPL or the LGPL, and not to allow others to
|
101 |
|
|
- use your version of this file under the terms of the MPL, indicate your
|
102 |
|
|
- decision by deleting the provisions above and replace them with the notice
|
103 |
|
|
- and other provisions required by the LGPL or the GPL. If you do not delete
|
104 |
|
|
- the provisions above, a recipient may use your version of this file under
|
105 |
|
|
- the terms of any one of the MPL, the GPL or the LGPL.
|
106 |
|
|
-
|
107 |
|
|
- ***** END LICENSE BLOCK ***** -->
|