summaryrefslogtreecommitdiffstats
path: root/src/navtree_js.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/navtree_js.h')
-rw-r--r--src/navtree_js.h55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/navtree_js.h b/src/navtree_js.h
index 746b39d..3eccef6 100644
--- a/src/navtree_js.h
+++ b/src/navtree_js.h
@@ -125,10 +125,13 @@
" var targetPage = stripPath(link.split('#')[0]);\n"
" a.href = srcPage!=targetPage ? url : '#';\n"
" a.onclick = function(){\n"
-" $('.item').removeClass('selected');\n"
-" $('.item').removeAttr('id');\n"
-" $(a).parent().parent().addClass('selected');\n"
-" $(a).parent().parent().attr('id','selected');\n"
+" if (!$(a).parent().parent().hasClass('selected'))\n"
+" {\n"
+" $('.item').removeClass('selected');\n"
+" $('.item').removeAttr('id');\n"
+" $(a).parent().parent().addClass('selected');\n"
+" $(a).parent().parent().attr('id','selected');\n"
+" }\n"
" var pos, anchor = $(aname), docContent = $('#doc-content');\n"
" if (anchor.parent().attr('class')=='memItemLeft') {\n"
" pos = anchor.parent().position().top;\n"
@@ -229,7 +232,7 @@
"\n"
"function showNode(o, node, index)\n"
"{\n"
-" if (node.childrenData && !node.expanded) {\n"
+" if (node.childrenData /*&& !node.expanded*/) {\n"
" if (typeof(node.childrenData)==='string') {\n"
" var varName = node.childrenData;\n"
" getScript(node.relpath+varName,function(){\n"
@@ -276,6 +279,7 @@
" $(n.itemDiv).addClass('selected');\n"
" $(n.itemDiv).attr('id','selected');\n"
" }\n"
+" showRoot();\n"
" }\n"
" }\n"
" }\n"
@@ -293,6 +297,20 @@
" }\n"
"}\n"
"\n"
+"function navTo(o,root,hash,relpath)\n"
+"{\n"
+" getScript(relpath+\"navtreeindex\",function(){\n"
+" var navTreeIndex = eval('NAVTREEINDEX');\n"
+" if (navTreeIndex) {\n"
+" var nti = navTreeIndex[root+hash];\n"
+" o.breadcrumbs = nti ? nti : navTreeIndex[root];\n"
+" if (o.breadcrumbs==null) o.breadcrumbs = navTreeIndex[\"index.html\"];\n"
+" o.breadcrumbs.unshift(0);\n"
+" showNode(o, o.node, 0);\n"
+" }\n"
+" },true);\n"
+"}\n"
+"\n"
"function initNavTree(toroot,relpath)\n"
"{\n"
" var o = new Object();\n"
@@ -313,35 +331,22 @@
" o.node.plus_img.width = 16;\n"
" o.node.plus_img.height = 22;\n"
"\n"
-" getScript(relpath+\"navtreeindex\",function(){\n"
-" var navTreeIndex = eval('NAVTREEINDEX');\n"
-" if (navTreeIndex) {\n"
-" var nti = navTreeIndex[toroot+window.location.hash];\n"
-" o.breadcrumbs = nti ? nti : navTreeIndex[toroot];\n"
-" if (o.breadcrumbs==null) o.breadcrumbs = navTreeIndex[\"index.html\"];\n"
-" o.breadcrumbs.unshift(0);\n"
-" showNode(o, o.node, 0);\n"
-" }\n"
-" },true);\n"
+" navTo(o,toroot,window.location.hash,relpath);\n"
"\n"
" $(window).bind('hashchange', function(){\n"
" if (window.location.hash && window.location.hash.length>1){\n"
-" highlightAnchor();\n"
" var a;\n"
" if ($(location).attr('hash')){\n"
-" var link=stripPath($(location).attr('pathname'))+':'+\n"
-" $(location).attr('hash').substring(1);\n"
-" a=$('.item a[class$=\\\"\"'+link+'\"\\\"]');\n"
+" var clslink=stripPath($(location).attr('pathname'))+':'+\n"
+" $(location).attr('hash').substring(1);\n"
+" a=$('.item a[class$=\\\"\"'+clslink+'\"\\\"]');\n"
" }\n"
-" if (a && a.length){\n"
+" if (a==null || !$(a).parent().parent().hasClass('selected')){\n"
" $('.item').removeClass('selected');\n"
" $('.item').removeAttr('id');\n"
-" a.parent().parent().addClass('selected');\n"
-" a.parent().parent().attr('id','selected');\n"
-" var anchor = $($(location).attr('hash'));\n"
-" var targetDiv = anchor.next();\n"
-" showRoot();\n"
" }\n"
+" var link=stripPath($(location).attr('pathname'));\n"
+" navTo(o,link,$(location).attr('hash'),relpath);\n"
" }\n"
" })\n"
"\n"