69 easing: CY.Easing.easeOut |
69 easing: CY.Easing.easeOut |
70 }); |
70 }); |
71 gToc['animationShow'] = animationShow ; |
71 gToc['animationShow'] = animationShow ; |
72 animationShow.set('to', { opacity: 1}); |
72 animationShow.set('to', { opacity: 1}); |
73 gToc['animationShow-handle'] = animationShow.on('end', onTocShowAnimEnd, gToc); |
73 gToc['animationShow-handle'] = animationShow.on('end', onTocShowAnimEnd, gToc); |
74 if (typeof document.getElementsByClassName!='function') { |
74 getElementsByClassName('c-toc')[0].style.width = width + 'px'; |
75 document.querySelectorAll('.c-toc')[0].style.width = width + 'px'; |
|
76 } |
|
77 else { |
|
78 document.getElementsByClassName('c-toc')[0].style.width = width + 'px'; |
|
79 } |
|
80 } |
75 } |
81 |
76 |
82 toggleTocFn = function() { |
77 toggleTocFn = function() { |
83 if (isTocVisible()) |
78 if (isTocVisible()) |
84 hideToc(); |
79 hideToc(); |
134 return 3 - (a.compareDocumentPosition(b) & 6); |
129 return 3 - (a.compareDocumentPosition(b) & 6); |
135 }); |
130 }); |
136 } |
131 } |
137 return resultArray; |
132 return resultArray; |
138 } |
133 } |
|
134 |
|
135 /* |
|
136 Developed by Robert Nyman, http://www.robertnyman.com |
|
137 Code/licensing: http://code.google.com/p/getelementsbyclassname/ |
|
138 */ |
|
139 var getElementsByClassName = function (className, tag, elm){ |
|
140 if (document.getElementsByClassName) { |
|
141 getElementsByClassName = function (className, tag, elm) { |
|
142 elm = elm || document; |
|
143 var elements = elm.getElementsByClassName(className), |
|
144 nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null, |
|
145 returnElements = [], |
|
146 current; |
|
147 for(var i=0, il=elements.length; i<il; i+=1){ |
|
148 current = elements[i]; |
|
149 if(!nodeName || nodeName.test(current.nodeName)) { |
|
150 returnElements.push(current); |
|
151 } |
|
152 } |
|
153 return returnElements; |
|
154 }; |
|
155 } |
|
156 else if (document.evaluate) { |
|
157 getElementsByClassName = function (className, tag, elm) { |
|
158 tag = tag || "*"; |
|
159 elm = elm || document; |
|
160 var classes = className.split(" "), |
|
161 classesToCheck = "", |
|
162 xhtmlNamespace = "http://www.w3.org/1999/xhtml", |
|
163 namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null, |
|
164 returnElements = [], |
|
165 elements, |
|
166 node; |
|
167 for(var j=0, jl=classes.length; j<jl; j+=1){ |
|
168 classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]"; |
|
169 } |
|
170 try { |
|
171 elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null); |
|
172 } |
|
173 catch (e) { |
|
174 elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null); |
|
175 } |
|
176 while ((node = elements.iterateNext())) { |
|
177 returnElements.push(node); |
|
178 } |
|
179 return returnElements; |
|
180 }; |
|
181 } |
|
182 else { |
|
183 getElementsByClassName = function (className, tag, elm) { |
|
184 tag = tag || "*"; |
|
185 elm = elm || document; |
|
186 var classes = className.split(" "), |
|
187 classesToCheck = [], |
|
188 elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag), |
|
189 current, |
|
190 returnElements = [], |
|
191 match; |
|
192 for(var k=0, kl=classes.length; k<kl; k+=1){ |
|
193 classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)")); |
|
194 } |
|
195 for(var l=0, ll=elements.length; l<ll; l+=1){ |
|
196 current = elements[l]; |
|
197 match = false; |
|
198 for(var m=0, ml=classesToCheck.length; m<ml; m+=1){ |
|
199 match = classesToCheck[m].test(current.className); |
|
200 if (!match) { |
|
201 break; |
|
202 } |
|
203 } |
|
204 if (match) { |
|
205 returnElements.push(current); |
|
206 } |
|
207 } |
|
208 return returnElements; |
|
209 }; |
|
210 } |
|
211 return getElementsByClassName(className, tag, elm); |
|
212 }; |