1 "var navTreeSubIndices = new Array();\n"
3 "function getData(varName)\n"
5 " var i = varName.lastIndexOf('/');\n"
6 " var n = i>=0 ? varName.substring(i+1) : varName;\n"
7 " return eval(n.replace(/\\-/g,'_'));\n"
10 "function stripPath(uri)\n"
12 " return uri.substring(uri.lastIndexOf('/')+1);\n"
15 "function stripPath2(uri)\n"
17 " var i = uri.lastIndexOf('/');\n"
18 " var s = uri.substring(i+1);\n"
19 " var m = uri.substring(0,i+1).match(/\\/d\\w\\/d\\w\\w\\/$/);\n"
20 " return m ? uri.substring(i-6) : s;\n"
23 "function localStorageSupported()\n"
26 " return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;\n"
34 "function storeLink(link)\n"
36 " if (!$(\"#nav-sync\").hasClass('sync') && localStorageSupported()) {\n"
37 " window.localStorage.setItem('navpath',link);\n"
41 "function deleteLink()\n"
43 " if (localStorageSupported()) {\n"
44 " window.localStorage.setItem('navpath','');\n"
48 "function cachedLink()\n"
50 " if (localStorageSupported()) {\n"
51 " return window.localStorage.getItem('navpath');\n"
57 "function getScript(scriptName,func,show)\n"
59 " var head = document.getElementsByTagName(\"head\")[0]; \n"
60 " var script = document.createElement('script');\n"
61 " script.id = scriptName;\n"
62 " script.type = 'text/javascript';\n"
63 " script.onload = func; \n"
64 " script.src = scriptName+'.js'; \n"
65 " if ($.browser.msie && $.browser.version<=8) { \n"
66 " // script.onload does work with older versions of IE\n"
67 " script.onreadystatechange = function() {\n"
68 " if (script.readyState=='complete' || script.readyState=='loaded') { \n"
69 " func(); if (show) showRoot(); \n"
73 " head.appendChild(script); \n"
76 "function createIndent(o,domNode,node,level)\n"
78 " if (node.parentNode && node.parentNode.parentNode) {\n"
79 " createIndent(o,domNode,node.parentNode,level+1);\n"
81 " var imgNode = document.createElement(\"img\");\n"
82 " imgNode.width = 16;\n"
83 " imgNode.height = 22;\n"
84 " if (level==0 && node.childrenData) {\n"
85 " node.plus_img = imgNode;\n"
86 " node.expandToggle = document.createElement(\"a\");\n"
87 " node.expandToggle.href = \"javascript:void(0)\";\n"
88 " node.expandToggle.onclick = function() {\n"
89 " if (node.expanded) {\n"
90 " $(node.getChildrenUL()).slideUp(\"fast\");\n"
91 " if (node.isLast) {\n"
92 " node.plus_img.src = node.relpath+\"ftv2plastnode.png\";\n"
94 " node.plus_img.src = node.relpath+\"ftv2pnode.png\";\n"
96 " node.expanded = false;\n"
98 " expandNode(o, node, false, false);\n"
101 " node.expandToggle.appendChild(imgNode);\n"
102 " domNode.appendChild(node.expandToggle);\n"
104 " domNode.appendChild(imgNode);\n"
107 " if (node.isLast) {\n"
108 " if (node.childrenData) {\n"
109 " imgNode.src = node.relpath+\"ftv2plastnode.png\";\n"
111 " imgNode.src = node.relpath+\"ftv2lastnode.png\";\n"
112 " domNode.appendChild(imgNode);\n"
115 " if (node.childrenData) {\n"
116 " imgNode.src = node.relpath+\"ftv2pnode.png\";\n"
118 " imgNode.src = node.relpath+\"ftv2node.png\";\n"
119 " domNode.appendChild(imgNode);\n"
123 " if (node.isLast) {\n"
124 " imgNode.src = node.relpath+\"ftv2blank.png\";\n"
126 " imgNode.src = node.relpath+\"ftv2vertline.png\";\n"
129 " imgNode.border = \"0\";\n"
132 "function newNode(o, po, text, link, childrenData, lastNode)\n"
134 " var node = new Object();\n"
135 " node.children = Array();\n"
136 " node.childrenData = childrenData;\n"
137 " node.depth = po.depth + 1;\n"
138 " node.relpath = po.relpath;\n"
139 " node.isLast = lastNode;\n"
141 " node.li = document.createElement(\"li\");\n"
142 " po.getChildrenUL().appendChild(node.li);\n"
143 " node.parentNode = po;\n"
145 " node.itemDiv = document.createElement(\"div\");\n"
146 " node.itemDiv.className = \"item\";\n"
148 " node.labelSpan = document.createElement(\"span\");\n"
149 " node.labelSpan.className = \"label\";\n"
151 " createIndent(o,node.itemDiv,node,0);\n"
152 " node.itemDiv.appendChild(node.labelSpan);\n"
153 " node.li.appendChild(node.itemDiv);\n"
155 " var a = document.createElement(\"a\");\n"
156 " node.labelSpan.appendChild(a);\n"
157 " node.label = document.createTextNode(text);\n"
158 " node.expanded = false;\n"
159 " a.appendChild(node.label);\n"
162 " if (link.substring(0,1)=='^') {\n"
163 " url = link.substring(1);\n"
166 " url = node.relpath+link;\n"
168 " a.className = stripPath(link.replace('#',':'));\n"
169 " if (link.indexOf('#')!=-1) {\n"
170 " var aname = '#'+link.split('#')[1];\n"
171 " var srcPage = stripPath($(location).attr('pathname'));\n"
172 " var targetPage = stripPath(link.split('#')[0]);\n"
173 " a.href = srcPage!=targetPage ? url : '#';\n"
174 " a.onclick = function(){\n"
175 " storeLink(link);\n"
176 " if (!$(a).parent().parent().hasClass('selected'))\n"
178 " $('.item').removeClass('selected');\n"
179 " $('.item').removeAttr('id');\n"
180 " $(a).parent().parent().addClass('selected');\n"
181 " $(a).parent().parent().attr('id','selected');\n"
183 " var pos, anchor = $(aname), docContent = $('#doc-content');\n"
184 " if (anchor.parent().attr('class')=='memItemLeft') {\n"
185 " pos = anchor.parent().position().top;\n"
186 " } else if (anchor.position()) {\n"
187 " pos = anchor.position().top;\n"
190 " var dist = Math.abs(Math.min(\n"
191 " pos-docContent.offset().top,\n"
192 " docContent[0].scrollHeight-\n"
193 " docContent.height()-docContent.scrollTop()));\n"
194 " docContent.animate({\n"
195 " scrollTop: pos + docContent.scrollTop() - docContent.offset().top\n"
196 " },Math.max(50,Math.min(500,dist)),function(){\n"
197 " window.location.replace(aname);\n"
203 " a.onclick = function() { storeLink(link); }\n"
206 " if (childrenData != null) \n"
208 " a.className = \"nolink\";\n"
209 " a.href = \"javascript:void(0)\";\n"
210 " a.onclick = node.expandToggle.onclick;\n"
214 " node.childrenUL = null;\n"
215 " node.getChildrenUL = function() {\n"
216 " if (!node.childrenUL) {\n"
217 " node.childrenUL = document.createElement(\"ul\");\n"
218 " node.childrenUL.className = \"children_ul\";\n"
219 " node.childrenUL.style.display = \"none\";\n"
220 " node.li.appendChild(node.childrenUL);\n"
222 " return node.childrenUL;\n"
228 "function showRoot()\n"
230 " var headerHeight = $(\"#top\").height();\n"
231 " var footerHeight = $(\"#nav-path\").height();\n"
232 " var windowHeight = $(window).height() - headerHeight - footerHeight;\n"
233 " (function (){ // retry until we can scroll to the selected item\n"
235 " var navtree=$('#nav-tree');\n"
236 " navtree.scrollTo('#selected',0,{offset:-windowHeight/2});\n"
238 " setTimeout(arguments.callee, 0);\n"
243 "function expandNode(o, node, imm, showRoot)\n"
245 " if (node.childrenData && !node.expanded) {\n"
246 " if (typeof(node.childrenData)==='string') {\n"
247 " var varName = node.childrenData;\n"
248 " getScript(node.relpath+varName,function(){\n"
249 " node.childrenData = getData(varName);\n"
250 " expandNode(o, node, imm, showRoot);\n"
253 " if (!node.childrenVisited) {\n"
254 " getNode(o, node);\n"
255 " } if (imm || ($.browser.msie && $.browser.version>8)) { \n"
256 " // somehow slideDown jumps to the start of tree for IE9 :-(\n"
257 " $(node.getChildrenUL()).show();\n"
259 " $(node.getChildrenUL()).slideDown(\"fast\");\n"
261 " if (node.isLast) {\n"
262 " node.plus_img.src = node.relpath+\"ftv2mlastnode.png\";\n"
264 " node.plus_img.src = node.relpath+\"ftv2mnode.png\";\n"
266 " node.expanded = true;\n"
271 "function glowEffect(n,duration)\n"
273 " n.addClass('glow').delay(duration).queue(function(next){\n"
274 " $(this).removeClass('glow');next();\n"
278 "function highlightAnchor()\n"
280 " var anchor = $($(location).attr('hash'));\n"
281 " if (anchor.parent().attr('class')=='memItemLeft'){\n"
282 " var rows = $('.memberdecls tr[class$=\"'+\n"
283 " window.location.hash.substring(1)+'\"]');\n"
284 " glowEffect(rows.children(),300); // member without details\n"
285 " } else if (anchor.parents().slice(2).prop('tagName')=='TR') {\n"
286 " glowEffect(anchor.parents('div.memitem'),1000); // enum value\n"
287 " } else if (anchor.parent().attr('class')=='fieldtype'){\n"
288 " glowEffect(anchor.parent().parent(),1000); // struct field\n"
289 " } else if (anchor.parent().is(\":header\")) {\n"
290 " glowEffect(anchor.parent(),1000); // section header\n"
292 " glowEffect(anchor.next(),1000); // normal member\n"
296 "function selectAndHighlight(hash,n)\n"
300 " var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);\n"
301 " a=$('.item a[class$=\"'+link+'\"]');\n"
303 " if (a && a.length) {\n"
304 " a.parent().parent().addClass('selected');\n"
305 " a.parent().parent().attr('id','selected');\n"
306 " highlightAnchor();\n"
308 " $(n.itemDiv).addClass('selected');\n"
309 " $(n.itemDiv).attr('id','selected');\n"
314 "function showNode(o, node, index, hash)\n"
316 " if (node && node.childrenData) {\n"
317 " if (typeof(node.childrenData)==='string') {\n"
318 " var varName = node.childrenData;\n"
319 " getScript(node.relpath+varName,function(){\n"
320 " node.childrenData = getData(varName);\n"
321 " showNode(o,node,index,hash);\n"
324 " if (!node.childrenVisited) {\n"
325 " getNode(o, node);\n"
327 " $(node.getChildrenUL()).show();\n"
328 " if (node.isLast) {\n"
329 " node.plus_img.src = node.relpath+\"ftv2mlastnode.png\";\n"
331 " node.plus_img.src = node.relpath+\"ftv2mnode.png\";\n"
333 " node.expanded = true;\n"
334 " var n = node.children[o.breadcrumbs[index]];\n"
335 " if (index+1<o.breadcrumbs.length) {\n"
336 " showNode(o,n,index+1,hash);\n"
338 " if (typeof(n.childrenData)==='string') {\n"
339 " var varName = n.childrenData;\n"
340 " getScript(n.relpath+varName,function(){\n"
341 " n.childrenData = getData(varName);\n"
342 " node.expanded=false;\n"
343 " showNode(o,node,index,hash); // retry with child node expanded\n"
346 " var rootBase = stripPath(o.toroot.replace(/\\..+$/, ''));\n"
347 " if (rootBase==\"index\" || rootBase==\"pages\") {\n"
348 " expandNode(o, n, true, true);\n"
350 " selectAndHighlight(hash,n);\n"
355 " selectAndHighlight(hash);\n"
359 "function getNode(o, po)\n"
361 " po.childrenVisited = true;\n"
362 " var l = po.childrenData.length-1;\n"
363 " for (var i in po.childrenData) {\n"
364 " var nodeData = po.childrenData[i];\n"
365 " po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],\n"
370 "function gotoNode(o,subIndex,root,hash,relpath)\n"
372 " var nti = navTreeSubIndices[subIndex][root+hash];\n"
373 " o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);\n"
374 " if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index\n"
375 " navTo(o,NAVTREE[0][1],\"\",relpath);\n"
376 " $('.item').removeClass('selected');\n"
377 " $('.item').removeAttr('id');\n"
379 " if (o.breadcrumbs) {\n"
380 " o.breadcrumbs.unshift(0); // add 0 for root node\n"
381 " showNode(o, o.node, 0, hash);\n"
385 "function navTo(o,root,hash,relpath)\n"
387 " var link = cachedLink();\n"
389 " var parts = link.split('#');\n"
390 " root = parts[0];\n"
391 " if (parts.length>1) hash = '#'+parts[1];\n"
394 " if (root==NAVTREE[0][1]) {\n"
395 " $('#nav-sync').css('top','30px');\n"
397 " $('#nav-sync').css('top','5px');\n"
399 " if (hash.match(/^#l\\d+$/)) {\n"
400 " var anchor=$('a[name='+hash.substring(1)+']');\n"
401 " glowEffect(anchor.parent(),1000); // line number\n"
402 " hash=''; // strip line number anchors\n"
403 " //root=root.replace(/_source\\./,'.'); // source link to doc link\n"
405 " var url=root+hash;\n"
407 " while (NAVTREEINDEX[i+1]<=url) i++;\n"
408 " if (navTreeSubIndices[i]) {\n"
409 " gotoNode(o,i,root,hash,relpath)\n"
411 " getScript(relpath+'navtreeindex'+i,function(){\n"
412 " navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);\n"
413 " if (navTreeSubIndices[i]) {\n"
414 " gotoNode(o,i,root,hash,relpath);\n"
420 "function showSyncOff(n,relpath)\n"
422 " n.html('<img src=\"'+relpath+'sync_off.png\" title=\"'+SYNCOFFMSG+'\"/>');\n"
425 "function showSyncOn(n,relpath)\n"
427 " n.html('<img src=\"'+relpath+'sync_on.png\"/ title=\"'+SYNCONMSG+'\">');\n"
430 "function toggleSyncButton(relpath)\n"
432 " var navSync = $('#nav-sync');\n"
433 " if (navSync.hasClass('sync')) {\n"
434 " navSync.removeClass('sync');\n"
435 " showSyncOff(navSync,relpath);\n"
436 " storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));\n"
438 " navSync.addClass('sync');\n"
439 " showSyncOn(navSync,relpath);\n"
444 "function initNavTree(toroot,relpath)\n"
446 " var o = new Object();\n"
447 " o.toroot = toroot;\n"
448 " o.node = new Object();\n"
449 " o.node.li = document.getElementById(\"nav-tree-contents\");\n"
450 " o.node.childrenData = NAVTREE;\n"
451 " o.node.children = new Array();\n"
452 " o.node.childrenUL = document.createElement(\"ul\");\n"
453 " o.node.getChildrenUL = function() { return o.node.childrenUL; };\n"
454 " o.node.li.appendChild(o.node.childrenUL);\n"
455 " o.node.depth = 0;\n"
456 " o.node.relpath = relpath;\n"
457 " o.node.expanded = false;\n"
458 " o.node.isLast = true;\n"
459 " o.node.plus_img = document.createElement(\"img\");\n"
460 " o.node.plus_img.src = relpath+\"ftv2pnode.png\";\n"
461 " o.node.plus_img.width = 16;\n"
462 " o.node.plus_img.height = 22;\n"
464 " if (localStorageSupported()) {\n"
465 " var navSync = $('#nav-sync');\n"
466 " if (cachedLink()) {\n"
467 " showSyncOff(navSync,relpath);\n"
468 " navSync.removeClass('sync');\n"
470 " showSyncOn(navSync,relpath);\n"
472 " navSync.click(function(){ toggleSyncButton(relpath); });\n"
475 " navTo(o,toroot,window.location.hash,relpath);\n"
477 " $(window).bind('hashchange', function(){\n"
478 " if (window.location.hash && window.location.hash.length>1){\n"
480 " if ($(location).attr('hash')){\n"
481 " var clslink=stripPath($(location).attr('pathname'))+':'+\n"
482 " $(location).attr('hash').substring(1);\n"
483 " a=$('.item a[class$=\"'+clslink+'\"]');\n"
485 " if (a==null || !$(a).parent().parent().hasClass('selected')){\n"
486 " $('.item').removeClass('selected');\n"
487 " $('.item').removeAttr('id');\n"
489 " var link=stripPath2($(location).attr('pathname'));\n"
490 " navTo(o,link,$(location).attr('hash'),relpath);\n"
494 " $(window).load(showRoot);\n"