Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
fda84270
Commit
fda84270
authored
Aug 23, 2013
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made a couple of minor performance tweeks to navtree.js
parent
16bc7735
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
20 deletions
+60
-20
navtree.js
src/navtree.js
+30
-10
navtree_js.h
src/navtree_js.h
+30
-10
No files found.
src/navtree.js
View file @
fda84270
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
=
' '
;
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
);
}
src/navtree_js.h
View file @
fda84270
"var SYNCONMSG = 'click to disable panel synchronisation';
\n
"
"var SYNCOFFMSG = 'click to enable panel synchronisation';
\n
"
"var navTreeSubIndices = new Array();
\n
"
"
\n
"
"function getData(varName)
\n
"
...
...
@@ -78,12 +80,12 @@
" var level=-1;
\n
"
" var n = node;
\n
"
" while (n.parentNode) { level++; n=n.parentNode; }
\n
"
" var imgNode = document.createElement(
\"
img
\"
);
\n
"
" imgNode.style.paddingLeft=(16*level).toString()+'px';
\n
"
" imgNode.width = 16;
\n
"
" imgNode.height = 22;
\n
"
" imgNode.border = 0;
\n
"
" if (node.childrenData) {
\n
"
" var imgNode = document.createElement(
\"
img
\"
);
\n
"
" imgNode.style.paddingLeft=(16*level).toString()+'px';
\n
"
" imgNode.width = 16;
\n
"
" imgNode.height = 22;
\n
"
" imgNode.border = 0;
\n
"
" node.plus_img = imgNode;
\n
"
" node.expandToggle = document.createElement(
\"
a
\"
);
\n
"
" node.expandToggle.href =
\"
javascript:void(0)
\"
;
\n
"
...
...
@@ -100,8 +102,12 @@
" domNode.appendChild(node.expandToggle);
\n
"
" imgNode.src = node.relpath+
\"
ftv2pnode.png
\"
;
\n
"
" } else {
\n
"
" imgNode.src = node.relpath+
\"
ftv2node.png
\"
;
\n
"
" domNode.appendChild(imgNode);
\n
"
" var span = document.createElement(
\"
span
\"
);
\n
"
" span.style.display = 'inline-block';
\n
"
" span.style.width = 16*(level+1)+'px';
\n
"
" span.style.height = '22px';
\n
"
" span.innerHTML = ' ';
\n
"
" domNode.appendChild(span);
\n
"
" }
\n
"
"}
\n
"
"
\n
"
...
...
@@ -320,7 +326,7 @@
" if (!node.childrenVisited) {
\n
"
" getNode(o, node);
\n
"
" }
\n
"
" $(node.getChildrenUL()).
show(
);
\n
"
" $(node.getChildrenUL()).
css({'display':'block'}
);
\n
"
" if (node.isLast) {
\n
"
" node.plus_img.src = node.relpath+
\"
ftv2mlastnode.png
\"
;
\n
"
" } else {
\n
"
...
...
@@ -352,8 +358,22 @@
" }
\n
"
"}
\n
"
"
\n
"
"function removeToInsertLater(element) {
\n
"
" var parentNode = element.parentNode;
\n
"
" var nextSibling = element.nextSibling;
\n
"
" parentNode.removeChild(element);
\n
"
" return function() {
\n
"
" if (nextSibling) {
\n
"
" parentNode.insertBefore(element, nextSibling);
\n
"
" } else {
\n
"
" parentNode.appendChild(element);
\n
"
" }
\n
"
" };
\n
"
"}
\n
"
"
\n
"
"function getNode(o, po)
\n
"
"{
\n
"
" var insertFunction = removeToInsertLater(po.li);
\n
"
" po.childrenVisited = true;
\n
"
" var l = po.childrenData.length-1;
\n
"
" for (var i in po.childrenData) {
\n
"
...
...
@@ -361,6 +381,7 @@
" po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
\n
"
" i==l);
\n
"
" }
\n
"
" insertFunction();
\n
"
"}
\n
"
"
\n
"
"function gotoNode(o,subIndex,root,hash,relpath)
\n
"
...
...
@@ -466,6 +487,7 @@
"
\n
"
" $(window).load(function(){
\n
"
" navTo(o,toroot,window.location.hash,relpath);
\n
"
" showRoot();
\n
"
" });
\n
"
"
\n
"
" $(window).bind('hashchange', function(){
\n
"
...
...
@@ -489,7 +511,5 @@
" navTo(o,toroot,window.location.hash,relpath);
\n
"
" }
\n
"
" })
\n
"
"
\n
"
" $(window).load(showRoot);
\n
"
"}
\n
"
"
\n
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment