-
Notifications
You must be signed in to change notification settings - Fork 147
/
script.js
41 lines (38 loc) · 1.11 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// load the mindmap
$(document).ready(function() {
// enable the mindmap in the body
$('body').mindmap();
// add the data to the mindmap
var root = $('body>ul>li').get(0).mynode = $('body').addRootNode($('body>ul>li>a').text(), {
href:'/',
url:'/',
onclick:function(node) {
$(node.obj.activeNode.content).each(function() {
this.hide();
});
}
});
$('body>ul>li').hide();
var addLI = function() {
var parentnode = $(this).parents('li').get(0);
if (typeof(parentnode)=='undefined') parentnode=root;
else parentnode=parentnode.mynode;
this.mynode = $('body').addNode(parentnode, $('a:eq(0)',this).text(), {
// href:$('a:eq(0)',this).text().toLowerCase(),
href:$('a:eq(0)',this).attr('href'),
onclick:function(node) {
$(node.obj.activeNode.content).each(function() {
this.hide();
});
$(node.content).each(function() {
this.show();
});
}
});
$(this).hide();
$('>ul>li', this).each(addLI);
};
$('body>ul>li>ul').each(function() {
$('>li', this).each(addLI);
});
});