1 | // ---------------------------------------------------------------------------- |
---|
2 | // XSLT REC Compliant Version of IE5 Default Stylesheet |
---|
3 | // |
---|
4 | // Original version by Jonathan Marsh ([email protected]) |
---|
5 | // http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl |
---|
6 | // |
---|
7 | // Conversion to XSLT 1.0 REC Syntax by Steve Muench (smuench@xxxxxxxxxx) |
---|
8 | // |
---|
9 | // 8 August 2005 Gary Masters |
---|
10 | // Conversion to support both Mozilla and MSIE behaviors. |
---|
11 | // For example, search for nodes rather than assuming where they exist. |
---|
12 | // Use getElementById. |
---|
13 | // Split javascript out into separate file. |
---|
14 | // ---------------------------------------------------------------------------- |
---|
15 | |
---|
16 | //<!--<![CDATA[ ]]> |
---|
17 | function f(e){ |
---|
18 | // if this element is an inline comment, and contains more than a single |
---|
19 | // line, turn it into a block comment. |
---|
20 | if (e.className=="ci") { |
---|
21 | for( var i = 0; i < e.childNodes.length; i++ ) { |
---|
22 | if (e.childNodes[i].nodeName.toLowerCase()=='pre') { |
---|
23 | if (e.childNodes[i].childNodes[0].nodeValue.indexOf('\n') > 0 || // For Mozilla |
---|
24 | e.childNodes[i].childNodes[0].nodeValue.indexOf('\r') > 0 ) { // For MSIE |
---|
25 | fix(e,"cb"); |
---|
26 | } |
---|
27 | } |
---|
28 | } |
---|
29 | } |
---|
30 | // if this element is an inline cdata, and contains more than a single |
---|
31 | // line, turn it into a block cdata. |
---|
32 | if (e.className=="di") { |
---|
33 | for( var i = 0; i < e.childNodes.length; i++ ) { |
---|
34 | if (e.childNodes[i].nodeName.toLowerCase()=='pre') { |
---|
35 | if (e.childNodes[i].childNodes[0].nodeValue.indexOf('\n') > 0 || // For Mozilla |
---|
36 | e.childNodes[i].childNodes[0].nodeValue.indexOf('\r') > 0 ) { // For MSIE |
---|
37 | fix(e,"db"); |
---|
38 | } |
---|
39 | } |
---|
40 | } |
---|
41 | } |
---|
42 | // remove the id since we only used it for cleanup |
---|
43 | e.id=""; |
---|
44 | } |
---|
45 | |
---|
46 | // Fix up the element as a "block" display and enable expand/collapse on it |
---|
47 | function fix(e,cl){ |
---|
48 | var j,k; |
---|
49 | // change the class name and display value |
---|
50 | e.className=cl; |
---|
51 | e.style.display="block"; |
---|
52 | // mark the comment or cdata display as a expandable container |
---|
53 | if (e.parentNode) { |
---|
54 | j=e.parentNode.childNodes[0]; // For Mozilla |
---|
55 | } else if (e.parentElement) { |
---|
56 | j=e.parentElement.childNodes[0]; // For MSIE |
---|
57 | } else return; |
---|
58 | j.className="c"; |
---|
59 | // find the +/- symbol and make it visible - the dummy link enables tabbing |
---|
60 | for( var i = 0; i < j.childNodes.length; i++ ) { |
---|
61 | if (j.childNodes[i].nodeName.toLowerCase()=="a") { |
---|
62 | k=j.childNodes[i]; |
---|
63 | k.style.visibility="visible"; |
---|
64 | k.href="#"; |
---|
65 | } |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | // Change the +/- symbol and hide the children. |
---|
70 | // This function works on "element" displays |
---|
71 | function ch(e) { |
---|
72 | var i,mark,div; |
---|
73 | // find the node containing the +/- symbol |
---|
74 | for( var i = 0; i < e.childNodes.length; i++ ) { |
---|
75 | if( e.childNodes[i].nodeName.toLowerCase() == 'div' && e.childNodes[i].className.toLowerCase() == 'c') { |
---|
76 | div=e.childNodes[i]; |
---|
77 | } |
---|
78 | } |
---|
79 | for( var i = 0; i < div.childNodes.length; i++ ) { |
---|
80 | // Ignore anchors without a class because they represent anchors for type names. |
---|
81 | if( div.childNodes[i].nodeName.toLowerCase() == 'a' && div.childNodes[i].className ) { |
---|
82 | mark=div.childNodes[i]; |
---|
83 | } |
---|
84 | } |
---|
85 | // if it is already collapsed, expand it by showing the children |
---|
86 | if (mark.childNodes[0].nodeValue=="+") { |
---|
87 | mark.childNodes[0].nodeValue="-"; |
---|
88 | for (var i=1;i<e.childNodes.length;i++) { |
---|
89 | if ( e.childNodes[i].nodeType != 3 && e.childNodes[i].className.toLowerCase() != 'c') { |
---|
90 | e.childNodes[i].style.display="block"; |
---|
91 | } |
---|
92 | } |
---|
93 | } |
---|
94 | // if it is expanded, collapse it by hiding the children |
---|
95 | else if (mark.childNodes[0].nodeValue=="-") { |
---|
96 | mark.childNodes[0].nodeValue="+"; |
---|
97 | for (var i=1;i<e.childNodes.length;i++) { |
---|
98 | if ( e.childNodes[i].nodeType != 3 && e.childNodes[i].className.toLowerCase() != 'c') { |
---|
99 | e.childNodes[i].style.display="none"; |
---|
100 | } |
---|
101 | } |
---|
102 | } |
---|
103 | } |
---|
104 | |
---|
105 | // Change the +/- symbol and hide the children. |
---|
106 | // This function works on "comment" and "cdata" displays |
---|
107 | function ch2(e) { |
---|
108 | var mark,contents; |
---|
109 | // find the +/- symbol, and the "PRE" element that contains the content |
---|
110 | for( var i = 0; i < e.childNodes.length; i++ ) { |
---|
111 | if( e.childNodes[i].nodeType != 3 && e.childNodes[i].className.toLowerCase() == 'c') { |
---|
112 | div=e.childNodes[i]; |
---|
113 | } |
---|
114 | } |
---|
115 | for( var i = 0; i < div.childNodes.length; i++ ) { |
---|
116 | if( div.childNodes[i].nodeName.toLowerCase() == 'a' ) { |
---|
117 | mark=div.childNodes[i]; |
---|
118 | } |
---|
119 | } |
---|
120 | contents=e.childNodes[1]; |
---|
121 | // if it is already collapsed, expand it by showing the children |
---|
122 | if (mark.childNodes[0].nodeValue=="+") { |
---|
123 | mark.childNodes[0].nodeValue="-"; |
---|
124 | // restore the correct "block"/"inline" display type to the PRE |
---|
125 | if (contents.className=="db"||contents.className=="cb") { |
---|
126 | contents.style.display="block"; |
---|
127 | } |
---|
128 | else { |
---|
129 | contents.style.display="inline"; |
---|
130 | } |
---|
131 | } |
---|
132 | // if it is expanded, collapse it by hiding the children |
---|
133 | else if (mark.childNodes[0].nodeValue=="-") { |
---|
134 | mark.childNodes[0].nodeValue="+"; |
---|
135 | contents.style.display="none"; |
---|
136 | } |
---|
137 | } |
---|
138 | |
---|
139 | // Handle a mouse click |
---|
140 | function cl(e) { |
---|
141 | if (e) { |
---|
142 | // for Mozilla |
---|
143 | e = e.target; |
---|
144 | } else { |
---|
145 | // for IE |
---|
146 | e=window.event.srcElement; |
---|
147 | } |
---|
148 | // make sure we are handling clicks upon expandable container elements |
---|
149 | if (e.className!="c") { |
---|
150 | if (e.parentNode) { |
---|
151 | e=e.parentNode; // for Mozilla |
---|
152 | } else if (e.parentElement) { |
---|
153 | e=e.parentElement; // for IE |
---|
154 | } else return; |
---|
155 | if (e.className!="c") { |
---|
156 | return; |
---|
157 | } |
---|
158 | } |
---|
159 | if (e.parentNode) { |
---|
160 | e=e.parentNode; // for Mozilla |
---|
161 | } else if (e.parentElement) { |
---|
162 | e=e.parentElement; // for IE |
---|
163 | } else return; |
---|
164 | // call the correct function to change the collapse/expand state and display |
---|
165 | if (e.className=="e") { |
---|
166 | ch(e); |
---|
167 | } |
---|
168 | if (e.className=="k") { |
---|
169 | ch2(e); |
---|
170 | } |
---|
171 | } |
---|
172 | |
---|
173 | // Dummy function for expand/collapse link navigation - trap onclick events instead |
---|
174 | function ex(){} |
---|
175 | |
---|
176 | // Erase bogus link info from the status window |
---|
177 | function h(){window.status=" ";} |
---|
178 | |
---|
179 | // Set the onclick handler |
---|
180 | document.onclick=cl; |
---|
181 | //--> |
---|