blob: c7dd7bce190bf2751ec24f0158b23188cbb28f77 (
plain)
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
|
$(".name").on("click", function(event) {
var $parent = $(this).parent();
if ($parent.hasClass("collapsed")) {
$parent.removeClass("collapsed");
$parent.children("ul").slideDown(50);
} else {
$parent.addClass("collapsed");
$parent.children("ul").slideUp(50);
}
});
function extractTime($el) {
var text = $el.children(".name")
.children(".time").text().replace(/[^0-9]/, "");
return parseInt(text);
}
var $overlay = $("#overlay");
$(".name").on("mouseenter", function(event) {
var $this = $(this);
var thisTime = null;
$overlay.empty();
$this.parents(".node").each(function(i, parent) {
var $parent = $(parent);
var time = extractTime($parent);
if (thisTime == null) {
thisTime = time;
} else {
var $el = $(document.createElement("span"));
var pos = $parent.position();
var width = $el.outerWidth();
$el.text(((thisTime / time) * 100).toFixed(2) + "%");
$el.css({
top: pos.top + "px"
});
$overlay.append($el);
}
});
});
$(".loading").hide();
$(".stack").show();
|