diff options
Diffstat (limited to 'src/navtree_js.h')
-rw-r--r-- | src/navtree_js.h | 122 |
1 files changed, 77 insertions, 45 deletions
diff --git a/src/navtree_js.h b/src/navtree_js.h index 3eccef6..84f20b7 100644 --- a/src/navtree_js.h +++ b/src/navtree_js.h @@ -1,3 +1,6 @@ +"\n" +"var navTreeIndex;\n" +"\n" "function getData(varName)\n" "{\n" " var i = varName.lastIndexOf('/');\n" @@ -18,11 +21,14 @@ " script.type = 'text/javascript';\n" " script.onload = func; \n" " script.src = scriptName+'.js'; \n" -" script.onreadystatechange = function() {\n" -" if (script.readyState=='complete' || script.readyState=='loaded') { \n" -" func(); if (show) showRoot(); \n" +" if ($.browser.msie && $.browser.version<=8) { \n" +" // script.onload does work with older versions of IE\n" +" script.onreadystatechange = function() {\n" +" if (script.readyState=='complete' || script.readyState=='loaded') { \n" +" func(); if (show) showRoot(); \n" +" }\n" " }\n" -" };\n" +" }\n" " head.appendChild(script); \n" "}\n" "\n" @@ -135,18 +141,20 @@ " var pos, anchor = $(aname), docContent = $('#doc-content');\n" " if (anchor.parent().attr('class')=='memItemLeft') {\n" " pos = anchor.parent().position().top;\n" -" } else {\n" +" } else if (anchor.position()) {\n" " pos = anchor.position().top;\n" " }\n" -" var dist = Math.abs(Math.min(\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" +" 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" " };\n" " } else {\n" " a.href = url;\n" @@ -181,6 +189,7 @@ " var windowHeight = $(window).height() - headerHeight - footerHeight;\n" " (function (){ // retry until we can scroll to the selected item\n" " try {\n" +" var navtree=$('#nav-tree');\n" " navtree.scrollTo('#selected',0,{offset:-windowHeight/2});\n" " } catch (err) {\n" " setTimeout(arguments.callee, 0);\n" @@ -200,7 +209,8 @@ " } else {\n" " if (!node.childrenVisited) {\n" " getNode(o, node);\n" -" } if (imm) {\n" +" } if (imm || ($.browser.msie && $.browser.version>8)) { \n" +" // somehow slideDown jumps to the start of tree for IE9 :-(\n" " $(node.getChildrenUL()).show();\n" " } else {\n" " $(node.getChildrenUL()).slideDown(\"fast\");\n" @@ -215,24 +225,49 @@ " }\n" "}\n" "\n" +"function glowEffect(n,duration)\n" +"{\n" +" n.addClass('glow').delay(duration).queue(function(next){\n" +" $(this).removeClass('glow');next();\n" +" });\n" +"}\n" +"\n" "function highlightAnchor()\n" "{\n" " var anchor = $($(location).attr('hash'));\n" " if (anchor.parent().attr('class')=='memItemLeft'){\n" -" var rows = $('.memberdecls tr[class$=\\\"\"'+\n" -" window.location.hash.substring(1)+'\"\\\"]').children();\n" -" rows.effect('highlight',{},1500);\n" +" var rows = $('.memberdecls tr[class$=\"'+\n" +" window.location.hash.substring(1)+'\"]');\n" +" glowEffect(rows.children(),300);\n" " } else if (anchor.parent().is(\":header\")) {\n" -" anchor.parent().effect('highlight',{},1500);\n" +" glowEffect(anchor.parent(),1000);\n" " } else {\n" -" var targetDiv = anchor.next();\n" -" $(targetDiv).children('.memproto,.memdoc').effect(\"highlight\",{},1500);\n" +" glowEffect(anchor.next(),1000);\n" +" }\n" +"}\n" +"\n" +"function selectAndHighlight(n)\n" +"{\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" +" }\n" +" if (a && a.length) {\n" +" a.parent().parent().addClass('selected');\n" +" a.parent().parent().attr('id','selected');\n" +" highlightAnchor();\n" +" } else if (n) {\n" +" $(n.itemDiv).addClass('selected');\n" +" $(n.itemDiv).attr('id','selected');\n" " }\n" +" showRoot();\n" "}\n" "\n" "function showNode(o, node, index)\n" "{\n" -" if (node.childrenData /*&& !node.expanded*/) {\n" +" if (node && node.childrenData) {\n" " if (typeof(node.childrenData)==='string') {\n" " var varName = node.childrenData;\n" " getScript(node.relpath+varName,function(){\n" @@ -265,24 +300,12 @@ " if (o.toroot==\"index.html\" || n.childrenData) {\n" " expandNode(o, n, true, true);\n" " }\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" -" }\n" -" if (a && a.length) {\n" -" a.parent().parent().addClass('selected');\n" -" a.parent().parent().attr('id','selected');\n" -" highlightAnchor();\n" -" } else {\n" -" $(n.itemDiv).addClass('selected');\n" -" $(n.itemDiv).attr('id','selected');\n" -" }\n" -" showRoot();\n" +" selectAndHighlight(n);\n" " }\n" " }\n" " }\n" +" } else {\n" +" selectAndHighlight();\n" " }\n" "}\n" "\n" @@ -297,18 +320,27 @@ " }\n" "}\n" "\n" +"function gotoNode(o,root,hash)\n" +"{\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" +"\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" +" if (navTreeIndex){\n" +" gotoNode(o,root,hash);\n" +" } else {\n" +" getScript(relpath+\"navtreeindex\",function(){\n" +" navTreeIndex = eval('NAVTREEINDEX');\n" +" if (navTreeIndex){\n" +" gotoNode(o,root,hash);\n" +" }\n" +" },true);\n" +" } \n" "}\n" "\n" "function initNavTree(toroot,relpath)\n" @@ -339,7 +371,7 @@ " if ($(location).attr('hash')){\n" " var clslink=stripPath($(location).attr('pathname'))+':'+\n" " $(location).attr('hash').substring(1);\n" -" a=$('.item a[class$=\\\"\"'+clslink+'\"\\\"]');\n" +" a=$('.item a[class$=\"'+clslink+'\"]');\n" " }\n" " if (a==null || !$(a).parent().parent().hasClass('selected')){\n" " $('.item').removeClass('selected');\n" |