diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2012-05-19 12:11:23 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2012-05-19 12:11:23 (GMT) |
commit | 55e5055cfbb6f8e013a894c0ec8b10771231e3ba (patch) | |
tree | 58d7a64919b99cc76fdc7120ae5d0407f3163a67 /src/navtree.js | |
parent | 44ca9512aaeb19f7fbd07afda88ec4cfe53ce831 (diff) | |
download | Doxygen-55e5055cfbb6f8e013a894c0ec8b10771231e3ba.zip Doxygen-55e5055cfbb6f8e013a894c0ec8b10771231e3ba.tar.gz Doxygen-55e5055cfbb6f8e013a894c0ec8b10771231e3ba.tar.bz2 |
Release-1.8.1
Diffstat (limited to 'src/navtree.js')
-rw-r--r-- | src/navtree.js | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/src/navtree.js b/src/navtree.js index a70e854..edaaee3 100644 --- a/src/navtree.js +++ b/src/navtree.js @@ -1,5 +1,5 @@ - var navTreeIndex; +var navTreeSubIndices = new Array(); function getData(varName) { @@ -13,6 +13,14 @@ function stripPath(uri) return uri.substring(uri.lastIndexOf('/')+1); } +function stripPath2(uri) +{ + var i = uri.lastIndexOf('/'); + var s = uri.substring(i+1); + var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); + return m ? uri.substring(i-6) : s; +} + function getScript(scriptName,func,show) { var head = document.getElementsByTagName("head")[0]; @@ -297,7 +305,8 @@ function showNode(o, node, index) showNode(o,node,index); // retry with child node expanded },true); } else { - if (o.toroot=="index.html" /*|| n.childrenData*/) { + var rootBase = o.toroot.replace(/\..+$/, ''); + if (rootBase=="index" || rootBase=="pages") { expandNode(o, n, true, true); } selectAndHighlight(n); @@ -320,24 +329,47 @@ function getNode(o, po) } } -function gotoNode(o,root,hash) +function gotoNode(o,subIndex,root,hash) { - var nti = navTreeIndex[root+hash]; - o.breadcrumbs = nti ? nti : navTreeIndex[root]; - if (o.breadcrumbs==null) o.breadcrumbs = navTreeIndex["index.html"]; - o.breadcrumbs.unshift(0); - showNode(o, o.node, 0); + var nti = navTreeSubIndices[subIndex][root+hash]; + o.breadcrumbs = nti ? nti : navTreeSubIndices[subIndex][root]; + if (o.breadcrumbs) + { + o.breadcrumbs.unshift(0); // add 0 for root node + showNode(o, o.node, 0); + } +} + +function gotoSubIndex(o,root,hash,relpath) +{ + if (hash.match(/^#l\d+$/)) + { + hash=''; // strip line number anchors + } + var url=root+hash; + var i=-1; + while (navTreeIndex[i+1]<=url) i++; + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash) + } else { + getScript(relpath+'navtreeindex'+i,function(){ + navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash); + } + },true); + } } function navTo(o,root,hash,relpath) { if (navTreeIndex){ - gotoNode(o,root,hash); + gotoSubIndex(o,root,hash,relpath); } else { getScript(relpath+"navtreeindex",function(){ navTreeIndex = eval('NAVTREEINDEX'); if (navTreeIndex){ - gotoNode(o,root,hash); + gotoSubIndex(o,root,hash,relpath); } },true); } @@ -377,7 +409,7 @@ function initNavTree(toroot,relpath) $('.item').removeClass('selected'); $('.item').removeAttr('id'); } - var link=stripPath($(location).attr('pathname')); + var link=stripPath2($(location).attr('pathname')); navTo(o,link,$(location).attr('hash'),relpath); } }) |