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