model.js
1.65 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var nodeColor;
function abcdon () {
obj = $(this);
if (obj.attr("class") == "node") {
node = obj.children().children().first();
nodeColor = node.attr("fill");
node.attr("fill", "yellow");
} else {
obj.addClass("highlight");
}
$(obj.attr("data-abcd")).addClass("highlight");
};
function abcdoff () {
obj = $(this);
if (obj.attr("class") == "node") {
node = obj.children().children().first();
node.attr("fill", nodeColor);
} else {
obj.removeClass("highlight");
}
$(obj.attr("data-abcd")).removeClass("highlight");
};
function treeon () {
obj = $(this);
if (obj.attr("class") != "node") {
obj.addClass("highlight");
}
$(obj.attr("data-tree")).addClass("highlight");
};
function treeoff () {
obj = $(this);
if (obj.attr("class") != "node") {
obj.removeClass("highlight");
}
$(obj.attr("data-tree")).removeClass("highlight");
};
function neton () {
obj = $(this);
$(obj.attr("data-net")).each(function () {
node = $(this).children().children().first();
nodeColor = node.attr("fill");
node.attr("fill", "yellow");
});
obj.addClass("highlight");
};
function netoff () {
obj = $(this);
$(obj.attr("data-net")).each(function () {
node = $(this).children().children().first();
node.attr("fill", nodeColor);
});
obj.removeClass("highlight");
};
$(document).ready(function() {
$("#model [data-abcd]").hover(abcdon, abcdoff);
$("#model [data-tree]").hover(treeon, treeoff);
$("#model [data-net]").hover(neton, netoff);
$(".tree .instance, .tree .action").each(function () {
obj = $(this);
obj.html($(obj.attr("data-abcd")).html());
});
});