Chris@6
|
1 var navTreeSubIndices = new Array();
|
Chris@6
|
2 var arrowDown = '▼';
|
Chris@6
|
3 var arrowRight = '►';
|
Chris@1
|
4
|
Chris@3
|
5 function getData(varName)
|
Chris@3
|
6 {
|
Chris@3
|
7 var i = varName.lastIndexOf('/');
|
Chris@3
|
8 var n = i>=0 ? varName.substring(i+1) : varName;
|
Chris@6
|
9 return eval(n.replace(/\-/g,'_'));
|
Chris@3
|
10 }
|
Chris@3
|
11
|
Chris@3
|
12 function stripPath(uri)
|
Chris@3
|
13 {
|
Chris@3
|
14 return uri.substring(uri.lastIndexOf('/')+1);
|
Chris@3
|
15 }
|
Chris@3
|
16
|
Chris@6
|
17 function stripPath2(uri)
|
Chris@6
|
18 {
|
Chris@6
|
19 var i = uri.lastIndexOf('/');
|
Chris@6
|
20 var s = uri.substring(i+1);
|
Chris@6
|
21 var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
|
Chris@6
|
22 return m ? uri.substring(i-6) : s;
|
Chris@6
|
23 }
|
Chris@6
|
24
|
Chris@6
|
25 function hashValue()
|
Chris@6
|
26 {
|
Chris@6
|
27 return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,'');
|
Chris@6
|
28 }
|
Chris@6
|
29
|
Chris@6
|
30 function hashUrl()
|
Chris@6
|
31 {
|
Chris@6
|
32 return '#'+hashValue();
|
Chris@6
|
33 }
|
Chris@6
|
34
|
Chris@6
|
35 function pathName()
|
Chris@6
|
36 {
|
Chris@6
|
37 return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, '');
|
Chris@6
|
38 }
|
Chris@6
|
39
|
Chris@6
|
40 function localStorageSupported()
|
Chris@6
|
41 {
|
Chris@6
|
42 try {
|
Chris@6
|
43 return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
|
Chris@6
|
44 }
|
Chris@6
|
45 catch(e) {
|
Chris@6
|
46 return false;
|
Chris@6
|
47 }
|
Chris@6
|
48 }
|
Chris@6
|
49
|
Chris@6
|
50
|
Chris@6
|
51 function storeLink(link)
|
Chris@6
|
52 {
|
Chris@6
|
53 if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
|
Chris@6
|
54 window.localStorage.setItem('navpath',link);
|
Chris@6
|
55 }
|
Chris@6
|
56 }
|
Chris@6
|
57
|
Chris@6
|
58 function deleteLink()
|
Chris@6
|
59 {
|
Chris@6
|
60 if (localStorageSupported()) {
|
Chris@6
|
61 window.localStorage.setItem('navpath','');
|
Chris@6
|
62 }
|
Chris@6
|
63 }
|
Chris@6
|
64
|
Chris@6
|
65 function cachedLink()
|
Chris@6
|
66 {
|
Chris@6
|
67 if (localStorageSupported()) {
|
Chris@6
|
68 return window.localStorage.getItem('navpath');
|
Chris@6
|
69 } else {
|
Chris@6
|
70 return '';
|
Chris@6
|
71 }
|
Chris@6
|
72 }
|
Chris@6
|
73
|
Chris@3
|
74 function getScript(scriptName,func,show)
|
Chris@3
|
75 {
|
Chris@6
|
76 var head = document.getElementsByTagName("head")[0];
|
Chris@3
|
77 var script = document.createElement('script');
|
Chris@3
|
78 script.id = scriptName;
|
Chris@3
|
79 script.type = 'text/javascript';
|
Chris@6
|
80 script.onload = func;
|
Chris@6
|
81 script.src = scriptName+'.js';
|
Chris@6
|
82 if ($.browser.msie && $.browser.version<=8) {
|
Chris@6
|
83 // script.onload does not work with older versions of IE
|
Chris@6
|
84 script.onreadystatechange = function() {
|
Chris@6
|
85 if (script.readyState=='complete' || script.readyState=='loaded') {
|
Chris@6
|
86 func(); if (show) showRoot();
|
Chris@6
|
87 }
|
Chris@3
|
88 }
|
Chris@6
|
89 }
|
Chris@3
|
90 head.appendChild(script);
|
Chris@3
|
91 }
|
Chris@3
|
92
|
Chris@1
|
93 function createIndent(o,domNode,node,level)
|
Chris@1
|
94 {
|
Chris@6
|
95 var level=-1;
|
Chris@6
|
96 var n = node;
|
Chris@6
|
97 while (n.parentNode) { level++; n=n.parentNode; }
|
Chris@6
|
98 if (node.childrenData) {
|
Chris@6
|
99 var imgNode = document.createElement("span");
|
Chris@6
|
100 imgNode.className = 'arrow';
|
Chris@6
|
101 imgNode.style.paddingLeft=(16*level).toString()+'px';
|
Chris@6
|
102 imgNode.innerHTML=arrowRight;
|
Chris@1
|
103 node.plus_img = imgNode;
|
Chris@1
|
104 node.expandToggle = document.createElement("a");
|
Chris@1
|
105 node.expandToggle.href = "javascript:void(0)";
|
Chris@3
|
106 node.expandToggle.onclick = function() {
|
Chris@3
|
107 if (node.expanded) {
|
Chris@1
|
108 $(node.getChildrenUL()).slideUp("fast");
|
Chris@6
|
109 node.plus_img.innerHTML=arrowRight;
|
Chris@1
|
110 node.expanded = false;
|
Chris@3
|
111 } else {
|
Chris@3
|
112 expandNode(o, node, false, false);
|
Chris@1
|
113 }
|
Chris@1
|
114 }
|
Chris@1
|
115 node.expandToggle.appendChild(imgNode);
|
Chris@1
|
116 domNode.appendChild(node.expandToggle);
|
Chris@3
|
117 } else {
|
Chris@6
|
118 var span = document.createElement("span");
|
Chris@6
|
119 span.className = 'arrow';
|
Chris@6
|
120 span.style.width = 16*(level+1)+'px';
|
Chris@6
|
121 span.innerHTML = ' ';
|
Chris@6
|
122 domNode.appendChild(span);
|
Chris@1
|
123 }
|
Chris@6
|
124 }
|
Chris@6
|
125
|
Chris@6
|
126 var animationInProgress = false;
|
Chris@6
|
127
|
Chris@6
|
128 function gotoAnchor(anchor,aname,updateLocation)
|
Chris@6
|
129 {
|
Chris@6
|
130 var pos, docContent = $('#doc-content');
|
Chris@6
|
131 var ancParent = $(anchor.parent());
|
Chris@6
|
132 if (ancParent.hasClass('memItemLeft') ||
|
Chris@6
|
133 ancParent.hasClass('fieldname') ||
|
Chris@6
|
134 ancParent.hasClass('fieldtype') ||
|
Chris@6
|
135 ancParent.is(':header'))
|
Chris@6
|
136 {
|
Chris@6
|
137 pos = ancParent.position().top;
|
Chris@6
|
138 } else if (anchor.position()) {
|
Chris@6
|
139 pos = anchor.position().top;
|
Chris@1
|
140 }
|
Chris@6
|
141 if (pos) {
|
Chris@6
|
142 var dist = Math.abs(Math.min(
|
Chris@6
|
143 pos-docContent.offset().top,
|
Chris@6
|
144 docContent[0].scrollHeight-
|
Chris@6
|
145 docContent.height()-docContent.scrollTop()));
|
Chris@6
|
146 animationInProgress=true;
|
Chris@6
|
147 docContent.animate({
|
Chris@6
|
148 scrollTop: pos + docContent.scrollTop() - docContent.offset().top
|
Chris@6
|
149 },Math.max(50,Math.min(500,dist)),function(){
|
Chris@6
|
150 if (updateLocation) window.location.href=aname;
|
Chris@6
|
151 animationInProgress=false;
|
Chris@6
|
152 });
|
Chris@6
|
153 }
|
Chris@1
|
154 }
|
Chris@1
|
155
|
Chris@1
|
156 function newNode(o, po, text, link, childrenData, lastNode)
|
Chris@1
|
157 {
|
Chris@1
|
158 var node = new Object();
|
Chris@1
|
159 node.children = Array();
|
Chris@1
|
160 node.childrenData = childrenData;
|
Chris@1
|
161 node.depth = po.depth + 1;
|
Chris@1
|
162 node.relpath = po.relpath;
|
Chris@1
|
163 node.isLast = lastNode;
|
Chris@1
|
164
|
Chris@1
|
165 node.li = document.createElement("li");
|
Chris@1
|
166 po.getChildrenUL().appendChild(node.li);
|
Chris@1
|
167 node.parentNode = po;
|
Chris@1
|
168
|
Chris@1
|
169 node.itemDiv = document.createElement("div");
|
Chris@1
|
170 node.itemDiv.className = "item";
|
Chris@1
|
171
|
Chris@1
|
172 node.labelSpan = document.createElement("span");
|
Chris@1
|
173 node.labelSpan.className = "label";
|
Chris@1
|
174
|
Chris@1
|
175 createIndent(o,node.itemDiv,node,0);
|
Chris@1
|
176 node.itemDiv.appendChild(node.labelSpan);
|
Chris@1
|
177 node.li.appendChild(node.itemDiv);
|
Chris@1
|
178
|
Chris@1
|
179 var a = document.createElement("a");
|
Chris@1
|
180 node.labelSpan.appendChild(a);
|
Chris@1
|
181 node.label = document.createTextNode(text);
|
Chris@3
|
182 node.expanded = false;
|
Chris@1
|
183 a.appendChild(node.label);
|
Chris@3
|
184 if (link) {
|
Chris@3
|
185 var url;
|
Chris@3
|
186 if (link.substring(0,1)=='^') {
|
Chris@3
|
187 url = link.substring(1);
|
Chris@3
|
188 link = url;
|
Chris@3
|
189 } else {
|
Chris@3
|
190 url = node.relpath+link;
|
Chris@3
|
191 }
|
Chris@3
|
192 a.className = stripPath(link.replace('#',':'));
|
Chris@3
|
193 if (link.indexOf('#')!=-1) {
|
Chris@3
|
194 var aname = '#'+link.split('#')[1];
|
Chris@6
|
195 var srcPage = stripPath(pathName());
|
Chris@3
|
196 var targetPage = stripPath(link.split('#')[0]);
|
Chris@6
|
197 a.href = srcPage!=targetPage ? url : "javascript:void(0)";
|
Chris@3
|
198 a.onclick = function(){
|
Chris@6
|
199 storeLink(link);
|
Chris@3
|
200 if (!$(a).parent().parent().hasClass('selected'))
|
Chris@3
|
201 {
|
Chris@3
|
202 $('.item').removeClass('selected');
|
Chris@3
|
203 $('.item').removeAttr('id');
|
Chris@3
|
204 $(a).parent().parent().addClass('selected');
|
Chris@3
|
205 $(a).parent().parent().attr('id','selected');
|
Chris@3
|
206 }
|
Chris@6
|
207 var anchor = $(aname);
|
Chris@6
|
208 gotoAnchor(anchor,aname,true);
|
Chris@3
|
209 };
|
Chris@3
|
210 } else {
|
Chris@3
|
211 a.href = url;
|
Chris@6
|
212 a.onclick = function() { storeLink(link); }
|
Chris@3
|
213 }
|
Chris@3
|
214 } else {
|
Chris@6
|
215 if (childrenData != null)
|
Chris@1
|
216 {
|
Chris@1
|
217 a.className = "nolink";
|
Chris@1
|
218 a.href = "javascript:void(0)";
|
Chris@1
|
219 a.onclick = node.expandToggle.onclick;
|
Chris@1
|
220 }
|
Chris@1
|
221 }
|
Chris@1
|
222
|
Chris@1
|
223 node.childrenUL = null;
|
Chris@3
|
224 node.getChildrenUL = function() {
|
Chris@3
|
225 if (!node.childrenUL) {
|
Chris@1
|
226 node.childrenUL = document.createElement("ul");
|
Chris@1
|
227 node.childrenUL.className = "children_ul";
|
Chris@1
|
228 node.childrenUL.style.display = "none";
|
Chris@1
|
229 node.li.appendChild(node.childrenUL);
|
Chris@1
|
230 }
|
Chris@1
|
231 return node.childrenUL;
|
Chris@1
|
232 };
|
Chris@1
|
233
|
Chris@1
|
234 return node;
|
Chris@1
|
235 }
|
Chris@1
|
236
|
Chris@1
|
237 function showRoot()
|
Chris@1
|
238 {
|
Chris@1
|
239 var headerHeight = $("#top").height();
|
Chris@1
|
240 var footerHeight = $("#nav-path").height();
|
Chris@1
|
241 var windowHeight = $(window).height() - headerHeight - footerHeight;
|
Chris@3
|
242 (function (){ // retry until we can scroll to the selected item
|
Chris@3
|
243 try {
|
Chris@6
|
244 var navtree=$('#nav-tree');
|
Chris@3
|
245 navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
|
Chris@3
|
246 } catch (err) {
|
Chris@3
|
247 setTimeout(arguments.callee, 0);
|
Chris@3
|
248 }
|
Chris@3
|
249 })();
|
Chris@1
|
250 }
|
Chris@1
|
251
|
Chris@3
|
252 function expandNode(o, node, imm, showRoot)
|
Chris@1
|
253 {
|
Chris@3
|
254 if (node.childrenData && !node.expanded) {
|
Chris@3
|
255 if (typeof(node.childrenData)==='string') {
|
Chris@3
|
256 var varName = node.childrenData;
|
Chris@3
|
257 getScript(node.relpath+varName,function(){
|
Chris@3
|
258 node.childrenData = getData(varName);
|
Chris@3
|
259 expandNode(o, node, imm, showRoot);
|
Chris@3
|
260 }, showRoot);
|
Chris@3
|
261 } else {
|
Chris@3
|
262 if (!node.childrenVisited) {
|
Chris@3
|
263 getNode(o, node);
|
Chris@6
|
264 } if (imm || ($.browser.msie && $.browser.version>8)) {
|
Chris@6
|
265 // somehow slideDown jumps to the start of tree for IE9 :-(
|
Chris@3
|
266 $(node.getChildrenUL()).show();
|
Chris@3
|
267 } else {
|
Chris@3
|
268 $(node.getChildrenUL()).slideDown("fast");
|
Chris@3
|
269 }
|
Chris@6
|
270 node.plus_img.innerHTML = arrowDown;
|
Chris@3
|
271 node.expanded = true;
|
Chris@1
|
272 }
|
Chris@3
|
273 }
|
Chris@3
|
274 }
|
Chris@3
|
275
|
Chris@6
|
276 function glowEffect(n,duration)
|
Chris@6
|
277 {
|
Chris@6
|
278 n.addClass('glow').delay(duration).queue(function(next){
|
Chris@6
|
279 $(this).removeClass('glow');next();
|
Chris@6
|
280 });
|
Chris@6
|
281 }
|
Chris@6
|
282
|
Chris@3
|
283 function highlightAnchor()
|
Chris@3
|
284 {
|
Chris@6
|
285 var aname = hashUrl();
|
Chris@6
|
286 var anchor = $(aname);
|
Chris@3
|
287 if (anchor.parent().attr('class')=='memItemLeft'){
|
Chris@6
|
288 var rows = $('.memberdecls tr[class$="'+hashValue()+'"]');
|
Chris@6
|
289 glowEffect(rows.children(),300); // member without details
|
Chris@6
|
290 } else if (anchor.parent().attr('class')=='fieldname'){
|
Chris@6
|
291 glowEffect(anchor.parent().parent(),1000); // enum value
|
Chris@6
|
292 } else if (anchor.parent().attr('class')=='fieldtype'){
|
Chris@6
|
293 glowEffect(anchor.parent().parent(),1000); // struct field
|
Chris@3
|
294 } else if (anchor.parent().is(":header")) {
|
Chris@6
|
295 glowEffect(anchor.parent(),1000); // section header
|
Chris@3
|
296 } else {
|
Chris@6
|
297 glowEffect(anchor.next(),1000); // normal member
|
Chris@3
|
298 }
|
Chris@6
|
299 gotoAnchor(anchor,aname,false);
|
Chris@3
|
300 }
|
Chris@3
|
301
|
Chris@6
|
302 function selectAndHighlight(hash,n)
|
Chris@3
|
303 {
|
Chris@6
|
304 var a;
|
Chris@6
|
305 if (hash) {
|
Chris@6
|
306 var link=stripPath(pathName())+':'+hash.substring(1);
|
Chris@6
|
307 a=$('.item a[class$="'+link+'"]');
|
Chris@6
|
308 }
|
Chris@6
|
309 if (a && a.length) {
|
Chris@6
|
310 a.parent().parent().addClass('selected');
|
Chris@6
|
311 a.parent().parent().attr('id','selected');
|
Chris@6
|
312 highlightAnchor();
|
Chris@6
|
313 } else if (n) {
|
Chris@6
|
314 $(n.itemDiv).addClass('selected');
|
Chris@6
|
315 $(n.itemDiv).attr('id','selected');
|
Chris@6
|
316 }
|
Chris@6
|
317 if ($('#nav-tree-contents .item:first').hasClass('selected')) {
|
Chris@6
|
318 $('#nav-sync').css('top','30px');
|
Chris@6
|
319 } else {
|
Chris@6
|
320 $('#nav-sync').css('top','5px');
|
Chris@6
|
321 }
|
Chris@6
|
322 showRoot();
|
Chris@6
|
323 }
|
Chris@6
|
324
|
Chris@6
|
325 function showNode(o, node, index, hash)
|
Chris@6
|
326 {
|
Chris@6
|
327 if (node && node.childrenData) {
|
Chris@3
|
328 if (typeof(node.childrenData)==='string') {
|
Chris@3
|
329 var varName = node.childrenData;
|
Chris@3
|
330 getScript(node.relpath+varName,function(){
|
Chris@3
|
331 node.childrenData = getData(varName);
|
Chris@6
|
332 showNode(o,node,index,hash);
|
Chris@3
|
333 },true);
|
Chris@3
|
334 } else {
|
Chris@3
|
335 if (!node.childrenVisited) {
|
Chris@3
|
336 getNode(o, node);
|
Chris@3
|
337 }
|
Chris@6
|
338 $(node.getChildrenUL()).css({'display':'block'});
|
Chris@6
|
339 node.plus_img.innerHTML = arrowDown;
|
Chris@3
|
340 node.expanded = true;
|
Chris@3
|
341 var n = node.children[o.breadcrumbs[index]];
|
Chris@3
|
342 if (index+1<o.breadcrumbs.length) {
|
Chris@6
|
343 showNode(o,n,index+1,hash);
|
Chris@3
|
344 } else {
|
Chris@3
|
345 if (typeof(n.childrenData)==='string') {
|
Chris@3
|
346 var varName = n.childrenData;
|
Chris@3
|
347 getScript(n.relpath+varName,function(){
|
Chris@3
|
348 n.childrenData = getData(varName);
|
Chris@3
|
349 node.expanded=false;
|
Chris@6
|
350 showNode(o,node,index,hash); // retry with child node expanded
|
Chris@3
|
351 },true);
|
Chris@3
|
352 } else {
|
Chris@6
|
353 var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
|
Chris@6
|
354 if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
|
Chris@3
|
355 expandNode(o, n, true, true);
|
Chris@3
|
356 }
|
Chris@6
|
357 selectAndHighlight(hash,n);
|
Chris@3
|
358 }
|
Chris@3
|
359 }
|
Chris@1
|
360 }
|
Chris@6
|
361 } else {
|
Chris@6
|
362 selectAndHighlight(hash);
|
Chris@1
|
363 }
|
Chris@1
|
364 }
|
Chris@1
|
365
|
Chris@6
|
366 function removeToInsertLater(element) {
|
Chris@6
|
367 var parentNode = element.parentNode;
|
Chris@6
|
368 var nextSibling = element.nextSibling;
|
Chris@6
|
369 parentNode.removeChild(element);
|
Chris@6
|
370 return function() {
|
Chris@6
|
371 if (nextSibling) {
|
Chris@6
|
372 parentNode.insertBefore(element, nextSibling);
|
Chris@6
|
373 } else {
|
Chris@6
|
374 parentNode.appendChild(element);
|
Chris@6
|
375 }
|
Chris@6
|
376 };
|
Chris@6
|
377 }
|
Chris@6
|
378
|
Chris@1
|
379 function getNode(o, po)
|
Chris@1
|
380 {
|
Chris@6
|
381 var insertFunction = removeToInsertLater(po.li);
|
Chris@1
|
382 po.childrenVisited = true;
|
Chris@1
|
383 var l = po.childrenData.length-1;
|
Chris@3
|
384 for (var i in po.childrenData) {
|
Chris@1
|
385 var nodeData = po.childrenData[i];
|
Chris@1
|
386 po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
|
Chris@3
|
387 i==l);
|
Chris@1
|
388 }
|
Chris@6
|
389 insertFunction();
|
Chris@6
|
390 }
|
Chris@6
|
391
|
Chris@6
|
392 function gotoNode(o,subIndex,root,hash,relpath)
|
Chris@6
|
393 {
|
Chris@6
|
394 var nti = navTreeSubIndices[subIndex][root+hash];
|
Chris@6
|
395 o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
|
Chris@6
|
396 if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
|
Chris@6
|
397 navTo(o,NAVTREE[0][1],"",relpath);
|
Chris@6
|
398 $('.item').removeClass('selected');
|
Chris@6
|
399 $('.item').removeAttr('id');
|
Chris@6
|
400 }
|
Chris@6
|
401 if (o.breadcrumbs) {
|
Chris@6
|
402 o.breadcrumbs.unshift(0); // add 0 for root node
|
Chris@6
|
403 showNode(o, o.node, 0, hash);
|
Chris@6
|
404 }
|
Chris@1
|
405 }
|
Chris@1
|
406
|
Chris@3
|
407 function navTo(o,root,hash,relpath)
|
Chris@1
|
408 {
|
Chris@6
|
409 var link = cachedLink();
|
Chris@6
|
410 if (link) {
|
Chris@6
|
411 var parts = link.split('#');
|
Chris@6
|
412 root = parts[0];
|
Chris@6
|
413 if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,'');
|
Chris@6
|
414 else hash='';
|
Chris@6
|
415 }
|
Chris@6
|
416 if (hash.match(/^#l\d+$/)) {
|
Chris@6
|
417 var anchor=$('a[name='+hash.substring(1)+']');
|
Chris@6
|
418 glowEffect(anchor.parent(),1000); // line number
|
Chris@6
|
419 hash=''; // strip line number anchors
|
Chris@6
|
420 }
|
Chris@6
|
421 var url=root+hash;
|
Chris@6
|
422 var i=-1;
|
Chris@6
|
423 while (NAVTREEINDEX[i+1]<=url) i++;
|
Chris@6
|
424 if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
|
Chris@6
|
425 if (navTreeSubIndices[i]) {
|
Chris@6
|
426 gotoNode(o,i,root,hash,relpath)
|
Chris@6
|
427 } else {
|
Chris@6
|
428 getScript(relpath+'navtreeindex'+i,function(){
|
Chris@6
|
429 navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
|
Chris@6
|
430 if (navTreeSubIndices[i]) {
|
Chris@6
|
431 gotoNode(o,i,root,hash,relpath);
|
Chris@6
|
432 }
|
Chris@6
|
433 },true);
|
Chris@6
|
434 }
|
Chris@6
|
435 }
|
Chris@6
|
436
|
Chris@6
|
437 function showSyncOff(n,relpath)
|
Chris@6
|
438 {
|
Chris@6
|
439 n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
|
Chris@6
|
440 }
|
Chris@6
|
441
|
Chris@6
|
442 function showSyncOn(n,relpath)
|
Chris@6
|
443 {
|
Chris@6
|
444 n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
|
Chris@6
|
445 }
|
Chris@6
|
446
|
Chris@6
|
447 function toggleSyncButton(relpath)
|
Chris@6
|
448 {
|
Chris@6
|
449 var navSync = $('#nav-sync');
|
Chris@6
|
450 if (navSync.hasClass('sync')) {
|
Chris@6
|
451 navSync.removeClass('sync');
|
Chris@6
|
452 showSyncOff(navSync,relpath);
|
Chris@6
|
453 storeLink(stripPath2(pathName())+hashUrl());
|
Chris@6
|
454 } else {
|
Chris@6
|
455 navSync.addClass('sync');
|
Chris@6
|
456 showSyncOn(navSync,relpath);
|
Chris@6
|
457 deleteLink();
|
Chris@6
|
458 }
|
Chris@1
|
459 }
|
Chris@1
|
460
|
Chris@1
|
461 function initNavTree(toroot,relpath)
|
Chris@1
|
462 {
|
Chris@1
|
463 var o = new Object();
|
Chris@1
|
464 o.toroot = toroot;
|
Chris@1
|
465 o.node = new Object();
|
Chris@1
|
466 o.node.li = document.getElementById("nav-tree-contents");
|
Chris@1
|
467 o.node.childrenData = NAVTREE;
|
Chris@1
|
468 o.node.children = new Array();
|
Chris@1
|
469 o.node.childrenUL = document.createElement("ul");
|
Chris@1
|
470 o.node.getChildrenUL = function() { return o.node.childrenUL; };
|
Chris@1
|
471 o.node.li.appendChild(o.node.childrenUL);
|
Chris@1
|
472 o.node.depth = 0;
|
Chris@1
|
473 o.node.relpath = relpath;
|
Chris@3
|
474 o.node.expanded = false;
|
Chris@3
|
475 o.node.isLast = true;
|
Chris@6
|
476 o.node.plus_img = document.createElement("span");
|
Chris@6
|
477 o.node.plus_img.className = 'arrow';
|
Chris@6
|
478 o.node.plus_img.innerHTML = arrowRight;
|
Chris@1
|
479
|
Chris@6
|
480 if (localStorageSupported()) {
|
Chris@6
|
481 var navSync = $('#nav-sync');
|
Chris@6
|
482 if (cachedLink()) {
|
Chris@6
|
483 showSyncOff(navSync,relpath);
|
Chris@6
|
484 navSync.removeClass('sync');
|
Chris@6
|
485 } else {
|
Chris@6
|
486 showSyncOn(navSync,relpath);
|
Chris@6
|
487 }
|
Chris@6
|
488 navSync.click(function(){ toggleSyncButton(relpath); });
|
Chris@6
|
489 }
|
Chris@6
|
490
|
Chris@6
|
491 $(window).load(function(){
|
Chris@6
|
492 navTo(o,toroot,hashUrl(),relpath);
|
Chris@6
|
493 showRoot();
|
Chris@6
|
494 });
|
Chris@1
|
495
|
Chris@3
|
496 $(window).bind('hashchange', function(){
|
Chris@3
|
497 if (window.location.hash && window.location.hash.length>1){
|
Chris@3
|
498 var a;
|
Chris@3
|
499 if ($(location).attr('hash')){
|
Chris@6
|
500 var clslink=stripPath(pathName())+':'+hashValue();
|
Chris@6
|
501 a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
|
Chris@3
|
502 }
|
Chris@3
|
503 if (a==null || !$(a).parent().parent().hasClass('selected')){
|
Chris@3
|
504 $('.item').removeClass('selected');
|
Chris@3
|
505 $('.item').removeAttr('id');
|
Chris@3
|
506 }
|
Chris@6
|
507 var link=stripPath2(pathName());
|
Chris@6
|
508 navTo(o,link,hashUrl(),relpath);
|
Chris@6
|
509 } else if (!animationInProgress) {
|
Chris@6
|
510 $('#doc-content').scrollTop(0);
|
Chris@6
|
511 $('.item').removeClass('selected');
|
Chris@6
|
512 $('.item').removeAttr('id');
|
Chris@6
|
513 navTo(o,toroot,hashUrl(),relpath);
|
Chris@3
|
514 }
|
Chris@3
|
515 })
|
Chris@1
|
516 }
|
Chris@1
|
517
|