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