miloyip | 28df04d | 2014-08-08 13:48:11 +0000 | [diff] [blame] | 1 | var NAVTREE = |
| 2 | [ |
| 3 | [ "RapidJSON", "index.html", [ |
| 4 | [ "Features", "md_doc_features.html", null ], |
| 5 | [ "Tutorial", "md_doc_tutorial.html", [ |
| 6 | [ "Value & Document", "md_doc_tutorial.html#ValueDocument", null ], |
| 7 | [ "Query Value", "md_doc_tutorial.html#QueryValue", [ |
| 8 | [ "Query Array", "md_doc_tutorial.html#QueryArray", null ], |
| 9 | [ "Query Object", "md_doc_tutorial.html#QueryObject", null ], |
| 10 | [ "Querying Number", "md_doc_tutorial.html#QueryNumber", null ], |
| 11 | [ "Query String", "md_doc_tutorial.html#QueryString", null ] |
| 12 | ] ], |
| 13 | [ "Create/Modify Values", "md_doc_tutorial.html#CreateModifyValues", [ |
| 14 | [ "Change Value Type", "md_doc_tutorial.html#ChangeValueType", null ], |
| 15 | [ "Move Semantics", "md_doc_tutorial.html#MoveSemantics", [ |
| 16 | [ "Move semantics and temporary values", "md_doc_tutorial.html#TemporaryValues", null ] |
| 17 | ] ], |
| 18 | [ "Create String", "md_doc_tutorial.html#CreateString", null ], |
| 19 | [ "Modify Array", "md_doc_tutorial.html#ModifyArray", null ], |
| 20 | [ "Modify Object", "md_doc_tutorial.html#ModifyObject", null ], |
| 21 | [ "Deep Copy Value", "md_doc_tutorial.html#DeepCopyValue", null ], |
| 22 | [ "Swap Values", "md_doc_tutorial.html#SwapValues", null ] |
| 23 | ] ], |
| 24 | [ "What's next", "md_doc_tutorial.html#WhatsNext", null ] |
| 25 | ] ], |
| 26 | [ "Stream", "md_doc_stream.html", [ |
| 27 | [ "Memory Streams", "md_doc_stream.html#MemoryStreams", [ |
| 28 | [ "StringStream (Input)", "md_doc_stream.html#StringStream", null ], |
| 29 | [ "StringBuffer (Output)", "md_doc_stream.html#StringBuffer", null ] |
| 30 | ] ], |
| 31 | [ "File Streams", "md_doc_stream.html#FileStreams", [ |
| 32 | [ "FileReadStream (Input)", "md_doc_stream.html#FileReadStream", null ], |
| 33 | [ "FileWriteStream (Output)", "md_doc_stream.html#FileWriteStream", null ] |
| 34 | ] ], |
| 35 | [ "Encoded Streams", "md_doc_stream.html#EncodedStreams", [ |
| 36 | [ "EncodedInputStream", "md_doc_stream.html#EncodedInputStream", null ], |
| 37 | [ "EncodedOutputStream", "md_doc_stream.html#EncodedOutputStream", null ], |
| 38 | [ "AutoUTFInputStream", "md_doc_stream.html#AutoUTFInputStream", null ], |
| 39 | [ "AutoUTFOutputStream", "md_doc_stream.html#AutoUTFOutputStream", null ] |
| 40 | ] ], |
| 41 | [ "Custom Stream", "md_doc_stream.html#CustomStream", [ |
| 42 | [ "Example: istream wrapper", "md_doc_stream.html#ExampleIStreamWrapper", null ], |
| 43 | [ "Example: ostream wrapper", "md_doc_stream.html#ExampleOStreamWrapper", null ] |
| 44 | ] ], |
| 45 | [ "Summary", "md_doc_stream.html#Summary", null ] |
| 46 | ] ], |
| 47 | [ "Encoding", "md_doc_encoding.html", [ |
| 48 | [ "Unicode", "md_doc_encoding.html#Unicode", [ |
| 49 | [ "Unicode Transformation Format", "md_doc_encoding.html#UTF", null ], |
| 50 | [ "Character Type", "md_doc_encoding.html#CharacterType", null ], |
| 51 | [ "AutoUTF", "md_doc_encoding.html#AutoUTF", null ], |
| 52 | [ "ASCII", "md_doc_encoding.html#ASCII", null ] |
| 53 | ] ], |
| 54 | [ "Validation & Transcoding", "md_doc_encoding.html#ValidationTranscoding", [ |
| 55 | [ "Transcoder", "md_doc_encoding.html#Transcoder", null ] |
| 56 | ] ] |
| 57 | ] ], |
| 58 | [ "DOM", "md_doc_dom.html", [ |
| 59 | [ "Template", "md_doc_dom.html#Template", [ |
| 60 | [ "Encoding", "md_doc_dom.html#Encoding", null ], |
| 61 | [ "Allocator", "md_doc_dom.html#Allocator", null ] |
| 62 | ] ], |
| 63 | [ "Parsing", "md_doc_dom.html#Parsing", [ |
| 64 | [ "Parse Error", "md_doc_dom.html#ParseError", null ], |
| 65 | [ "In Situ Parsing", "md_doc_dom.html#InSituParsing", null ], |
| 66 | [ "Transcoding and Validation", "md_doc_dom.html#TranscodingAndValidation", null ] |
| 67 | ] ], |
| 68 | [ "Techniques", "md_doc_dom.html#Techniques", [ |
| 69 | [ "User Buffer", "md_doc_dom.html#UserBuffer", null ] |
| 70 | ] ] |
| 71 | ] ], |
| 72 | [ "SAX", "md_doc_sax.html", [ |
| 73 | [ "Reader", "md_doc_sax.html#Reader", [ |
| 74 | [ "Handler", "md_doc_sax.html#Handler", null ], |
| 75 | [ "GenericReader", "md_doc_sax.html#GenericReader", null ] |
| 76 | ] ], |
| 77 | [ "Writer", "md_doc_sax.html#Writer", [ |
| 78 | [ "PrettyWriter", "md_doc_sax.html#PrettyWriter", null ], |
| 79 | [ "Completeness and Reset", "md_doc_sax.html#CompletenessReset", null ], |
| 80 | [ "Parsing JSON to Custom Data Structure", "md_doc_sax.html#CustomDataStructure", null ], |
| 81 | [ "Filtering of JSON", "md_doc_sax.html#Filtering", null ] |
| 82 | ] ] |
| 83 | ] ], |
| 84 | [ "Performance", "md_doc_performance.html", null ], |
| 85 | [ "Internals", "md_doc_internals.html", [ |
| 86 | [ "Value", "md_doc_internals.html#Value", [ |
| 87 | [ "Data Layout", "md_doc_internals.html#DataLayout", null ], |
| 88 | [ "Flags", "md_doc_internals.html#Flags", null ], |
| 89 | [ "MemoryPoolAllocator", "md_doc_internals.html#MemoryPoolAllocator", null ] |
| 90 | ] ], |
| 91 | [ "Parsing Optimization", "md_doc_internals.html#ParsingOptimization", [ |
| 92 | [ "Skip Whitespace with SIMD", "md_doc_internals.html#SkipwhitespaceWithSIMD", null ], |
| 93 | [ "Pow10()", "md_doc_internals.html#Pow10", null ], |
| 94 | [ "Local Stream Copy", "md_doc_internals.html#LocalStreamCopy", null ] |
| 95 | ] ], |
| 96 | [ "Parser", "md_doc_internals.html#Parser", [ |
| 97 | [ "Iterative Parser", "md_doc_internals.html#IterativeParser", [ |
| 98 | [ "Grammar", "md_doc_internals.html#IterativeParserGrammar", null ], |
| 99 | [ "Parsing Table", "md_doc_internals.html#IterativeParserParsingTable", null ], |
| 100 | [ "Implementation", "md_doc_internals.html#IterativeParserImplementation", null ] |
| 101 | ] ] |
| 102 | ] ] |
| 103 | ] ], |
| 104 | [ "FAQ", "md_doc_faq.html", null ], |
miloyip | 22ee6ef | 2014-08-20 01:22:05 +0000 | [diff] [blame^] | 105 | [ "Modules", "modules.html", "modules" ], |
miloyip | 28df04d | 2014-08-08 13:48:11 +0000 | [diff] [blame] | 106 | [ "Namespace Members", "namespacemembers.html", [ |
| 107 | [ "All", "namespacemembers.html", null ], |
| 108 | [ "Functions", "namespacemembers_func.html", null ], |
| 109 | [ "Typedefs", "namespacemembers_type.html", null ], |
| 110 | [ "Enumerations", "namespacemembers_enum.html", null ], |
| 111 | [ "Enumerator", "namespacemembers_eval.html", null ] |
| 112 | ] ], |
| 113 | [ "Classes", null, [ |
| 114 | [ "Class List", "annotated.html", "annotated" ], |
| 115 | [ "Class Hierarchy", "hierarchy.html", "hierarchy" ], |
| 116 | [ "Class Members", "functions.html", [ |
| 117 | [ "All", "functions.html", null ], |
| 118 | [ "Functions", "functions_func.html", null ], |
| 119 | [ "Variables", "functions_vars.html", null ], |
| 120 | [ "Typedefs", "functions_type.html", null ], |
| 121 | [ "Related Functions", "functions_rela.html", null ] |
| 122 | ] ] |
| 123 | ] ], |
| 124 | [ "Files", null, [ |
| 125 | [ "File List", "files.html", "files" ], |
| 126 | [ "File Members", "globals.html", [ |
| 127 | [ "All", "globals.html", null ], |
| 128 | [ "Macros", "globals_defs.html", null ] |
| 129 | ] ] |
| 130 | ] ] |
| 131 | ] ] |
| 132 | ]; |
| 133 | |
| 134 | var NAVTREEINDEX = |
| 135 | [ |
| 136 | "allocators_8h_source.html", |
miloyip | 22ee6ef | 2014-08-20 01:22:05 +0000 | [diff] [blame^] | 137 | "classrapidjson_1_1_generic_value.html#ae6351043ec30d8a151b0a072cfbc46d5", |
| 138 | "md_doc_tutorial.html#DeepCopyValue" |
miloyip | 28df04d | 2014-08-08 13:48:11 +0000 | [diff] [blame] | 139 | ]; |
| 140 | |
| 141 | var SYNCONMSG = 'click to disable panel synchronisation'; |
| 142 | var SYNCOFFMSG = 'click to enable panel synchronisation'; |
| 143 | var navTreeSubIndices = new Array(); |
| 144 | |
| 145 | function getData(varName) |
| 146 | { |
| 147 | var i = varName.lastIndexOf('/'); |
| 148 | var n = i>=0 ? varName.substring(i+1) : varName; |
| 149 | return eval(n.replace(/\-/g,'_')); |
| 150 | } |
| 151 | |
| 152 | function stripPath(uri) |
| 153 | { |
| 154 | return uri.substring(uri.lastIndexOf('/')+1); |
| 155 | } |
| 156 | |
| 157 | function stripPath2(uri) |
| 158 | { |
| 159 | var i = uri.lastIndexOf('/'); |
| 160 | var s = uri.substring(i+1); |
| 161 | var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); |
| 162 | return m ? uri.substring(i-6) : s; |
| 163 | } |
| 164 | |
| 165 | function hashValue() |
| 166 | { |
| 167 | return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); |
| 168 | } |
| 169 | |
| 170 | function hashUrl() |
| 171 | { |
| 172 | return '#'+hashValue(); |
| 173 | } |
| 174 | |
| 175 | function pathName() |
| 176 | { |
| 177 | return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); |
| 178 | } |
| 179 | |
| 180 | function localStorageSupported() |
| 181 | { |
| 182 | try { |
| 183 | return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; |
| 184 | } |
| 185 | catch(e) { |
| 186 | return false; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | |
| 191 | function storeLink(link) |
| 192 | { |
| 193 | if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { |
| 194 | window.localStorage.setItem('navpath',link); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | function deleteLink() |
| 199 | { |
| 200 | if (localStorageSupported()) { |
| 201 | window.localStorage.setItem('navpath',''); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | function cachedLink() |
| 206 | { |
| 207 | if (localStorageSupported()) { |
| 208 | return window.localStorage.getItem('navpath'); |
| 209 | } else { |
| 210 | return ''; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | function getScript(scriptName,func,show) |
| 215 | { |
| 216 | var head = document.getElementsByTagName("head")[0]; |
| 217 | var script = document.createElement('script'); |
| 218 | script.id = scriptName; |
| 219 | script.type = 'text/javascript'; |
| 220 | script.onload = func; |
| 221 | script.src = scriptName+'.js'; |
| 222 | if ($.browser.msie && $.browser.version<=8) { |
| 223 | // script.onload does not work with older versions of IE |
| 224 | script.onreadystatechange = function() { |
| 225 | if (script.readyState=='complete' || script.readyState=='loaded') { |
| 226 | func(); if (show) showRoot(); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | head.appendChild(script); |
| 231 | } |
| 232 | |
| 233 | function createIndent(o,domNode,node,level) |
| 234 | { |
| 235 | var level=-1; |
| 236 | var n = node; |
| 237 | while (n.parentNode) { level++; n=n.parentNode; } |
| 238 | if (node.childrenData) { |
| 239 | var imgNode = document.createElement("img"); |
| 240 | imgNode.style.paddingLeft=(16*level).toString()+'px'; |
| 241 | imgNode.width = 16; |
| 242 | imgNode.height = 22; |
| 243 | imgNode.border = 0; |
| 244 | node.plus_img = imgNode; |
| 245 | node.expandToggle = document.createElement("a"); |
| 246 | node.expandToggle.href = "javascript:void(0)"; |
| 247 | node.expandToggle.onclick = function() { |
| 248 | if (node.expanded) { |
| 249 | $(node.getChildrenUL()).slideUp("fast"); |
| 250 | node.plus_img.src = node.relpath+"ftv2pnode.png"; |
| 251 | node.expanded = false; |
| 252 | } else { |
| 253 | expandNode(o, node, false, false); |
| 254 | } |
| 255 | } |
| 256 | node.expandToggle.appendChild(imgNode); |
| 257 | domNode.appendChild(node.expandToggle); |
| 258 | imgNode.src = node.relpath+"ftv2pnode.png"; |
| 259 | } else { |
| 260 | var span = document.createElement("span"); |
| 261 | span.style.display = 'inline-block'; |
| 262 | span.style.width = 16*(level+1)+'px'; |
| 263 | span.style.height = '22px'; |
| 264 | span.innerHTML = ' '; |
| 265 | domNode.appendChild(span); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | var animationInProgress = false; |
| 270 | |
| 271 | function gotoAnchor(anchor,aname,updateLocation) |
| 272 | { |
| 273 | var pos, docContent = $('#doc-content'); |
| 274 | var ancParent = $(anchor.parent()); |
| 275 | if (ancParent.hasClass('memItemLeft') || |
| 276 | ancParent.hasClass('fieldname') || |
| 277 | ancParent.hasClass('fieldtype') || |
| 278 | ancParent.is(':header')) |
| 279 | { |
| 280 | pos = ancParent.position().top; |
| 281 | } else if (anchor.position()) { |
| 282 | pos = anchor.position().top; |
| 283 | } |
| 284 | if (pos) { |
| 285 | var dist = Math.abs(Math.min( |
| 286 | pos-docContent.offset().top, |
| 287 | docContent[0].scrollHeight- |
| 288 | docContent.height()-docContent.scrollTop())); |
| 289 | animationInProgress=true; |
| 290 | docContent.animate({ |
| 291 | scrollTop: pos + docContent.scrollTop() - docContent.offset().top |
| 292 | },Math.max(50,Math.min(500,dist)),function(){ |
| 293 | if (updateLocation) window.location.href=aname; |
| 294 | animationInProgress=false; |
| 295 | }); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | function newNode(o, po, text, link, childrenData, lastNode) |
| 300 | { |
| 301 | var node = new Object(); |
| 302 | node.children = Array(); |
| 303 | node.childrenData = childrenData; |
| 304 | node.depth = po.depth + 1; |
| 305 | node.relpath = po.relpath; |
| 306 | node.isLast = lastNode; |
| 307 | |
| 308 | node.li = document.createElement("li"); |
| 309 | po.getChildrenUL().appendChild(node.li); |
| 310 | node.parentNode = po; |
| 311 | |
| 312 | node.itemDiv = document.createElement("div"); |
| 313 | node.itemDiv.className = "item"; |
| 314 | |
| 315 | node.labelSpan = document.createElement("span"); |
| 316 | node.labelSpan.className = "label"; |
| 317 | |
| 318 | createIndent(o,node.itemDiv,node,0); |
| 319 | node.itemDiv.appendChild(node.labelSpan); |
| 320 | node.li.appendChild(node.itemDiv); |
| 321 | |
| 322 | var a = document.createElement("a"); |
| 323 | node.labelSpan.appendChild(a); |
| 324 | node.label = document.createTextNode(text); |
| 325 | node.expanded = false; |
| 326 | a.appendChild(node.label); |
| 327 | if (link) { |
| 328 | var url; |
| 329 | if (link.substring(0,1)=='^') { |
| 330 | url = link.substring(1); |
| 331 | link = url; |
| 332 | } else { |
| 333 | url = node.relpath+link; |
| 334 | } |
| 335 | a.className = stripPath(link.replace('#',':')); |
| 336 | if (link.indexOf('#')!=-1) { |
| 337 | var aname = '#'+link.split('#')[1]; |
| 338 | var srcPage = stripPath(pathName()); |
| 339 | var targetPage = stripPath(link.split('#')[0]); |
| 340 | a.href = srcPage!=targetPage ? url : "javascript:void(0)"; |
| 341 | a.onclick = function(){ |
| 342 | storeLink(link); |
| 343 | if (!$(a).parent().parent().hasClass('selected')) |
| 344 | { |
| 345 | $('.item').removeClass('selected'); |
| 346 | $('.item').removeAttr('id'); |
| 347 | $(a).parent().parent().addClass('selected'); |
| 348 | $(a).parent().parent().attr('id','selected'); |
| 349 | } |
| 350 | var anchor = $(aname); |
| 351 | gotoAnchor(anchor,aname,true); |
| 352 | }; |
| 353 | } else { |
| 354 | a.href = url; |
| 355 | a.onclick = function() { storeLink(link); } |
| 356 | } |
| 357 | } else { |
| 358 | if (childrenData != null) |
| 359 | { |
| 360 | a.className = "nolink"; |
| 361 | a.href = "javascript:void(0)"; |
| 362 | a.onclick = node.expandToggle.onclick; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | node.childrenUL = null; |
| 367 | node.getChildrenUL = function() { |
| 368 | if (!node.childrenUL) { |
| 369 | node.childrenUL = document.createElement("ul"); |
| 370 | node.childrenUL.className = "children_ul"; |
| 371 | node.childrenUL.style.display = "none"; |
| 372 | node.li.appendChild(node.childrenUL); |
| 373 | } |
| 374 | return node.childrenUL; |
| 375 | }; |
| 376 | |
| 377 | return node; |
| 378 | } |
| 379 | |
| 380 | function showRoot() |
| 381 | { |
| 382 | var headerHeight = $("#top").height(); |
| 383 | var footerHeight = $("#nav-path").height(); |
| 384 | var windowHeight = $(window).height() - headerHeight - footerHeight; |
| 385 | (function (){ // retry until we can scroll to the selected item |
| 386 | try { |
| 387 | var navtree=$('#nav-tree'); |
| 388 | navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); |
| 389 | } catch (err) { |
| 390 | setTimeout(arguments.callee, 0); |
| 391 | } |
| 392 | })(); |
| 393 | } |
| 394 | |
| 395 | function expandNode(o, node, imm, showRoot) |
| 396 | { |
| 397 | if (node.childrenData && !node.expanded) { |
| 398 | if (typeof(node.childrenData)==='string') { |
| 399 | var varName = node.childrenData; |
| 400 | getScript(node.relpath+varName,function(){ |
| 401 | node.childrenData = getData(varName); |
| 402 | expandNode(o, node, imm, showRoot); |
| 403 | }, showRoot); |
| 404 | } else { |
| 405 | if (!node.childrenVisited) { |
| 406 | getNode(o, node); |
| 407 | } if (imm || ($.browser.msie && $.browser.version>8)) { |
| 408 | // somehow slideDown jumps to the start of tree for IE9 :-( |
| 409 | $(node.getChildrenUL()).show(); |
| 410 | } else { |
| 411 | $(node.getChildrenUL()).slideDown("fast"); |
| 412 | } |
| 413 | if (node.isLast) { |
| 414 | node.plus_img.src = node.relpath+"ftv2mlastnode.png"; |
| 415 | } else { |
| 416 | node.plus_img.src = node.relpath+"ftv2mnode.png"; |
| 417 | } |
| 418 | node.expanded = true; |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | function glowEffect(n,duration) |
| 424 | { |
| 425 | n.addClass('glow').delay(duration).queue(function(next){ |
| 426 | $(this).removeClass('glow');next(); |
| 427 | }); |
| 428 | } |
| 429 | |
| 430 | function highlightAnchor() |
| 431 | { |
| 432 | var aname = hashUrl(); |
| 433 | var anchor = $(aname); |
| 434 | if (anchor.parent().attr('class')=='memItemLeft'){ |
| 435 | var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); |
| 436 | glowEffect(rows.children(),300); // member without details |
| 437 | } else if (anchor.parent().attr('class')=='fieldname'){ |
| 438 | glowEffect(anchor.parent().parent(),1000); // enum value |
| 439 | } else if (anchor.parent().attr('class')=='fieldtype'){ |
| 440 | glowEffect(anchor.parent().parent(),1000); // struct field |
| 441 | } else if (anchor.parent().is(":header")) { |
| 442 | glowEffect(anchor.parent(),1000); // section header |
| 443 | } else { |
| 444 | glowEffect(anchor.next(),1000); // normal member |
| 445 | } |
| 446 | gotoAnchor(anchor,aname,false); |
| 447 | } |
| 448 | |
| 449 | function selectAndHighlight(hash,n) |
| 450 | { |
| 451 | var a; |
| 452 | if (hash) { |
| 453 | var link=stripPath(pathName())+':'+hash.substring(1); |
| 454 | a=$('.item a[class$="'+link+'"]'); |
| 455 | } |
| 456 | if (a && a.length) { |
| 457 | a.parent().parent().addClass('selected'); |
| 458 | a.parent().parent().attr('id','selected'); |
| 459 | highlightAnchor(); |
| 460 | } else if (n) { |
| 461 | $(n.itemDiv).addClass('selected'); |
| 462 | $(n.itemDiv).attr('id','selected'); |
| 463 | } |
| 464 | if ($('#nav-tree-contents .item:first').hasClass('selected')) { |
| 465 | $('#nav-sync').css('top','30px'); |
| 466 | } else { |
| 467 | $('#nav-sync').css('top','5px'); |
| 468 | } |
| 469 | showRoot(); |
| 470 | } |
| 471 | |
| 472 | function showNode(o, node, index, hash) |
| 473 | { |
| 474 | if (node && node.childrenData) { |
| 475 | if (typeof(node.childrenData)==='string') { |
| 476 | var varName = node.childrenData; |
| 477 | getScript(node.relpath+varName,function(){ |
| 478 | node.childrenData = getData(varName); |
| 479 | showNode(o,node,index,hash); |
| 480 | },true); |
| 481 | } else { |
| 482 | if (!node.childrenVisited) { |
| 483 | getNode(o, node); |
| 484 | } |
| 485 | $(node.getChildrenUL()).css({'display':'block'}); |
| 486 | if (node.isLast) { |
| 487 | node.plus_img.src = node.relpath+"ftv2mlastnode.png"; |
| 488 | } else { |
| 489 | node.plus_img.src = node.relpath+"ftv2mnode.png"; |
| 490 | } |
| 491 | node.expanded = true; |
| 492 | var n = node.children[o.breadcrumbs[index]]; |
| 493 | if (index+1<o.breadcrumbs.length) { |
| 494 | showNode(o,n,index+1,hash); |
| 495 | } else { |
| 496 | if (typeof(n.childrenData)==='string') { |
| 497 | var varName = n.childrenData; |
| 498 | getScript(n.relpath+varName,function(){ |
| 499 | n.childrenData = getData(varName); |
| 500 | node.expanded=false; |
| 501 | showNode(o,node,index,hash); // retry with child node expanded |
| 502 | },true); |
| 503 | } else { |
| 504 | var rootBase = stripPath(o.toroot.replace(/\..+$/, '')); |
| 505 | if (rootBase=="index" || rootBase=="pages" || rootBase=="search") { |
| 506 | expandNode(o, n, true, true); |
| 507 | } |
| 508 | selectAndHighlight(hash,n); |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | } else { |
| 513 | selectAndHighlight(hash); |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | function removeToInsertLater(element) { |
| 518 | var parentNode = element.parentNode; |
| 519 | var nextSibling = element.nextSibling; |
| 520 | parentNode.removeChild(element); |
| 521 | return function() { |
| 522 | if (nextSibling) { |
| 523 | parentNode.insertBefore(element, nextSibling); |
| 524 | } else { |
| 525 | parentNode.appendChild(element); |
| 526 | } |
| 527 | }; |
| 528 | } |
| 529 | |
| 530 | function getNode(o, po) |
| 531 | { |
| 532 | var insertFunction = removeToInsertLater(po.li); |
| 533 | po.childrenVisited = true; |
| 534 | var l = po.childrenData.length-1; |
| 535 | for (var i in po.childrenData) { |
| 536 | var nodeData = po.childrenData[i]; |
| 537 | po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], |
| 538 | i==l); |
| 539 | } |
| 540 | insertFunction(); |
| 541 | } |
| 542 | |
| 543 | function gotoNode(o,subIndex,root,hash,relpath) |
| 544 | { |
| 545 | var nti = navTreeSubIndices[subIndex][root+hash]; |
| 546 | o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]); |
| 547 | if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index |
| 548 | navTo(o,NAVTREE[0][1],"",relpath); |
| 549 | $('.item').removeClass('selected'); |
| 550 | $('.item').removeAttr('id'); |
| 551 | } |
| 552 | if (o.breadcrumbs) { |
| 553 | o.breadcrumbs.unshift(0); // add 0 for root node |
| 554 | showNode(o, o.node, 0, hash); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | function navTo(o,root,hash,relpath) |
| 559 | { |
| 560 | var link = cachedLink(); |
| 561 | if (link) { |
| 562 | var parts = link.split('#'); |
| 563 | root = parts[0]; |
| 564 | if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,''); |
| 565 | else hash=''; |
| 566 | } |
| 567 | if (hash.match(/^#l\d+$/)) { |
| 568 | var anchor=$('a[name='+hash.substring(1)+']'); |
| 569 | glowEffect(anchor.parent(),1000); // line number |
| 570 | hash=''; // strip line number anchors |
| 571 | } |
| 572 | var url=root+hash; |
| 573 | var i=-1; |
| 574 | while (NAVTREEINDEX[i+1]<=url) i++; |
| 575 | if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index |
| 576 | if (navTreeSubIndices[i]) { |
| 577 | gotoNode(o,i,root,hash,relpath) |
| 578 | } else { |
| 579 | getScript(relpath+'navtreeindex'+i,function(){ |
| 580 | navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); |
| 581 | if (navTreeSubIndices[i]) { |
| 582 | gotoNode(o,i,root,hash,relpath); |
| 583 | } |
| 584 | },true); |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | function showSyncOff(n,relpath) |
| 589 | { |
| 590 | n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>'); |
| 591 | } |
| 592 | |
| 593 | function showSyncOn(n,relpath) |
| 594 | { |
| 595 | n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>'); |
| 596 | } |
| 597 | |
| 598 | function toggleSyncButton(relpath) |
| 599 | { |
| 600 | var navSync = $('#nav-sync'); |
| 601 | if (navSync.hasClass('sync')) { |
| 602 | navSync.removeClass('sync'); |
| 603 | showSyncOff(navSync,relpath); |
| 604 | storeLink(stripPath2(pathName())+hashUrl()); |
| 605 | } else { |
| 606 | navSync.addClass('sync'); |
| 607 | showSyncOn(navSync,relpath); |
| 608 | deleteLink(); |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | function initNavTree(toroot,relpath) |
| 613 | { |
| 614 | var o = new Object(); |
| 615 | o.toroot = toroot; |
| 616 | o.node = new Object(); |
| 617 | o.node.li = document.getElementById("nav-tree-contents"); |
| 618 | o.node.childrenData = NAVTREE; |
| 619 | o.node.children = new Array(); |
| 620 | o.node.childrenUL = document.createElement("ul"); |
| 621 | o.node.getChildrenUL = function() { return o.node.childrenUL; }; |
| 622 | o.node.li.appendChild(o.node.childrenUL); |
| 623 | o.node.depth = 0; |
| 624 | o.node.relpath = relpath; |
| 625 | o.node.expanded = false; |
| 626 | o.node.isLast = true; |
| 627 | o.node.plus_img = document.createElement("img"); |
| 628 | o.node.plus_img.src = relpath+"ftv2pnode.png"; |
| 629 | o.node.plus_img.width = 16; |
| 630 | o.node.plus_img.height = 22; |
| 631 | |
| 632 | if (localStorageSupported()) { |
| 633 | var navSync = $('#nav-sync'); |
| 634 | if (cachedLink()) { |
| 635 | showSyncOff(navSync,relpath); |
| 636 | navSync.removeClass('sync'); |
| 637 | } else { |
| 638 | showSyncOn(navSync,relpath); |
| 639 | } |
| 640 | navSync.click(function(){ toggleSyncButton(relpath); }); |
| 641 | } |
| 642 | |
| 643 | $(window).load(function(){ |
| 644 | navTo(o,toroot,hashUrl(),relpath); |
| 645 | showRoot(); |
| 646 | }); |
| 647 | |
| 648 | $(window).bind('hashchange', function(){ |
| 649 | if (window.location.hash && window.location.hash.length>1){ |
| 650 | var a; |
| 651 | if ($(location).attr('hash')){ |
| 652 | var clslink=stripPath(pathName())+':'+hashValue(); |
| 653 | a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]'); |
| 654 | } |
| 655 | if (a==null || !$(a).parent().parent().hasClass('selected')){ |
| 656 | $('.item').removeClass('selected'); |
| 657 | $('.item').removeAttr('id'); |
| 658 | } |
| 659 | var link=stripPath2(pathName()); |
| 660 | navTo(o,link,hashUrl(),relpath); |
| 661 | } else if (!animationInProgress) { |
| 662 | $('#doc-content').scrollTop(0); |
| 663 | $('.item').removeClass('selected'); |
| 664 | $('.item').removeAttr('id'); |
| 665 | navTo(o,toroot,hashUrl(),relpath); |
| 666 | } |
| 667 | }) |
| 668 | } |
| 669 | |