summaryrefslogtreecommitdiffstats
path: root/src/navtree.js
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-08-23 12:35:09 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-08-23 13:38:23 (GMT)
commitfda8427000640072eef6584988e1be5887db3c48 (patch)
tree776efd625a2b6733025c015b6411a20b43b5651f /src/navtree.js
parent16bc7735b18c77ceee17fc06f04a73aca7e48e13 (diff)
downloadDoxygen-fda8427000640072eef6584988e1be5887db3c48.zip
Doxygen-fda8427000640072eef6584988e1be5887db3c48.tar.gz
Doxygen-fda8427000640072eef6584988e1be5887db3c48.tar.bz2
Made a couple of minor performance tweeks to navtree.js
Diffstat (limited to 'src/navtree.js')
-rw-r--r--src/navtree.js40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/navtree.js b/src/navtree.js
index 1a46df4..ed2565a 100644
--- a/src/navtree.js
+++ b/src/navtree.js
@@ -1,3 +1,5 @@
+var SYNCONMSG = 'click to disable panel synchronisation';
+var SYNCOFFMSG = 'click to enable panel synchronisation';
var navTreeSubIndices = new Array();
function getData(varName)
@@ -78,12 +80,12 @@ function createIndent(o,domNode,node,level)
var level=-1;
var n = node;
while (n.parentNode) { level++; n=n.parentNode; }
- var imgNode = document.createElement("img");
- imgNode.style.paddingLeft=(16*level).toString()+'px';
- imgNode.width = 16;
- imgNode.height = 22;
- imgNode.border = 0;
if (node.childrenData) {
+ var imgNode = document.createElement("img");
+ imgNode.style.paddingLeft=(16*level).toString()+'px';
+ imgNode.width = 16;
+ imgNode.height = 22;
+ imgNode.border = 0;
node.plus_img = imgNode;
node.expandToggle = document.createElement("a");
node.expandToggle.href = "javascript:void(0)";
@@ -100,8 +102,12 @@ function createIndent(o,domNode,node,level)
domNode.appendChild(node.expandToggle);
imgNode.src = node.relpath+"ftv2pnode.png";
} else {
- imgNode.src = node.relpath+"ftv2node.png";
- domNode.appendChild(imgNode);
+ var span = document.createElement("span");
+ span.style.display = 'inline-block';
+ span.style.width = 16*(level+1)+'px';
+ span.style.height = '22px';
+ span.innerHTML = '&nbsp;';
+ domNode.appendChild(span);
}
}
@@ -320,7 +326,7 @@ function showNode(o, node, index, hash)
if (!node.childrenVisited) {
getNode(o, node);
}
- $(node.getChildrenUL()).show();
+ $(node.getChildrenUL()).css({'display':'block'});
if (node.isLast) {
node.plus_img.src = node.relpath+"ftv2mlastnode.png";
} else {
@@ -352,8 +358,22 @@ function showNode(o, node, index, hash)
}
}
+function removeToInsertLater(element) {
+ var parentNode = element.parentNode;
+ var nextSibling = element.nextSibling;
+ parentNode.removeChild(element);
+ return function() {
+ if (nextSibling) {
+ parentNode.insertBefore(element, nextSibling);
+ } else {
+ parentNode.appendChild(element);
+ }
+ };
+}
+
function getNode(o, po)
{
+ var insertFunction = removeToInsertLater(po.li);
po.childrenVisited = true;
var l = po.childrenData.length-1;
for (var i in po.childrenData) {
@@ -361,6 +381,7 @@ function getNode(o, po)
po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
i==l);
}
+ insertFunction();
}
function gotoNode(o,subIndex,root,hash,relpath)
@@ -466,6 +487,7 @@ function initNavTree(toroot,relpath)
$(window).load(function(){
navTo(o,toroot,window.location.hash,relpath);
+ showRoot();
});
$(window).bind('hashchange', function(){
@@ -489,7 +511,5 @@ function initNavTree(toroot,relpath)
navTo(o,toroot,window.location.hash,relpath);
}
})
-
- $(window).load(showRoot);
}