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.h72
1 files changed, 46 insertions, 26 deletions
diff --git a/src/navtree_js.h b/src/navtree_js.h
index aa57a13..b0c6d7c 100644
--- a/src/navtree_js.h
+++ b/src/navtree_js.h
@@ -63,7 +63,7 @@
" script.onload = func; \n"
" script.src = scriptName+'.js'; \n"
" if ($.browser.msie && $.browser.version<=8) { \n"
-" // script.onload does work with older versions of IE\n"
+" // script.onload does not work with older versions of IE\n"
" script.onreadystatechange = function() {\n"
" if (script.readyState=='complete' || script.readyState=='loaded') { \n"
" func(); if (show) showRoot(); \n"
@@ -129,6 +129,34 @@
" imgNode.border = \"0\";\n"
"}\n"
"\n"
+"var animationInProgress = false;\n"
+"\n"
+"function gotoAnchor(anchor,aname,updateLocation)\n"
+"{\n"
+" var pos, docContent = $('#doc-content');\n"
+" if (anchor.parent().attr('class')=='memItemLeft' ||\n"
+" anchor.parent().attr('class')=='fieldtype' ||\n"
+" anchor.parent().is(':header')) \n"
+" {\n"
+" pos = anchor.parent().position().top;\n"
+" } else if (anchor.position()) {\n"
+" pos = anchor.position().top;\n"
+" }\n"
+" if (pos) {\n"
+" var dist = Math.abs(Math.min(\n"
+" pos-docContent.offset().top,\n"
+" docContent[0].scrollHeight-\n"
+" docContent.height()-docContent.scrollTop()));\n"
+" animationInProgress=true;\n"
+" docContent.animate({\n"
+" scrollTop: pos + docContent.scrollTop() - docContent.offset().top\n"
+" },Math.max(50,Math.min(500,dist)),function(){\n"
+" if (updateLocation) window.location.href=aname;\n"
+" animationInProgress=false;\n"
+" });\n"
+" }\n"
+"}\n"
+"\n"
"function newNode(o, po, text, link, childrenData, lastNode)\n"
"{\n"
" var node = new Object();\n"
@@ -170,7 +198,7 @@
" var aname = '#'+link.split('#')[1];\n"
" var srcPage = stripPath($(location).attr('pathname'));\n"
" var targetPage = stripPath(link.split('#')[0]);\n"
-" a.href = srcPage!=targetPage ? url : '#';\n"
+" a.href = srcPage!=targetPage ? url : \"javascript:void(0)\"; \n"
" a.onclick = function(){\n"
" storeLink(link);\n"
" if (!$(a).parent().parent().hasClass('selected'))\n"
@@ -180,23 +208,8 @@
" $(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"
-" } else if (anchor.position()) {\n"
-" pos = anchor.position().top;\n"
-" }\n"
-" if (pos) {\n"
-" var dist = Math.abs(Math.min(\n"
-" pos-docContent.offset().top,\n"
-" docContent[0].scrollHeight-\n"
-" docContent.height()-docContent.scrollTop()));\n"
-" docContent.animate({\n"
-" scrollTop: pos + docContent.scrollTop() - docContent.offset().top\n"
-" },Math.max(50,Math.min(500,dist)),function(){\n"
-" window.location.replace(aname);\n"
-" });\n"
-" }\n"
+" var anchor = $(aname);\n"
+" gotoAnchor(anchor,aname,true);\n"
" };\n"
" } else {\n"
" a.href = url;\n"
@@ -277,7 +290,8 @@
"\n"
"function highlightAnchor()\n"
"{\n"
-" var anchor = $($(location).attr('hash'));\n"
+" var aname = $(location).attr('hash');\n"
+" var anchor = $(aname);\n"
" if (anchor.parent().attr('class')=='memItemLeft'){\n"
" var rows = $('.memberdecls tr[class$=\"'+\n"
" window.location.hash.substring(1)+'\"]');\n"
@@ -291,6 +305,7 @@
" } else {\n"
" glowEffect(anchor.next(),1000); // normal member\n"
" }\n"
+" gotoAnchor(anchor,aname,false);\n"
"}\n"
"\n"
"function selectAndHighlight(hash,n)\n"
@@ -308,6 +323,11 @@
" $(n.itemDiv).addClass('selected');\n"
" $(n.itemDiv).attr('id','selected');\n"
" }\n"
+" if ($('#nav-tree-contents .item:first').hasClass('selected')) {\n"
+" $('#nav-sync').css('top','30px');\n"
+" } else {\n"
+" $('#nav-sync').css('top','5px');\n"
+" }\n"
" showRoot();\n"
"}\n"
"\n"
@@ -391,11 +411,6 @@
" if (parts.length>1) hash = '#'+parts[1];\n"
" else hash='';\n"
" }\n"
-" if (root==NAVTREE[0][1]) {\n"
-" $('#nav-sync').css('top','30px');\n"
-" } else {\n"
-" $('#nav-sync').css('top','5px');\n"
-" }\n"
" if (hash.match(/^#l\\d+$/)) {\n"
" var anchor=$('a[name='+hash.substring(1)+']');\n"
" glowEffect(anchor.parent(),1000); // line number\n"
@@ -424,7 +439,7 @@
"\n"
"function showSyncOn(n,relpath)\n"
"{\n"
-" n.html('<img src=\"'+relpath+'sync_on.png\"/ title=\"'+SYNCONMSG+'\">');\n"
+" n.html('<img src=\"'+relpath+'sync_on.png\" title=\"'+SYNCONMSG+'\"/>');\n"
"}\n"
"\n"
"function toggleSyncButton(relpath)\n"
@@ -488,6 +503,11 @@
" }\n"
" var link=stripPath2($(location).attr('pathname'));\n"
" navTo(o,link,$(location).attr('hash'),relpath);\n"
+" } else if (!animationInProgress) {\n"
+" $('#doc-content').scrollTop(0);\n"
+" $('.item').removeClass('selected');\n"
+" $('.item').removeAttr('id');\n"
+" navTo(o,toroot,window.location.hash,relpath);\n"
" }\n"
" })\n"
"\n"