-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·101 lines (95 loc) · 2.78 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
function draw()
{
$("div.container").each(function()
{
w = parseInt($(this).css("width"));
$($(this).children().get(0)).css("left", "" + (w - 100) + "px");
sppx = parseInt($(this).attr("sppx"));
if((60 / sppx) > 30)
{
$($(this).children().get(2)).attr("interval", "60");
}
else if((3600 / sppx) > 30)
{
$($(this).children().get(2)).attr("interval", "3600");
}
else
{
$($(this).children().get(2)).attr("interval", "86400");
}
$(this).children("div.bglines").empty();
pointTime = parseInt($(this).attr("pointTime"));
sppx = parseInt($(this).attr("sppx"));
interval = parseInt($(this).children("div.bglines").attr("interval"));
pxinterval = interval * 1.0 / sppx;
x = (pointTime % interval);
x = x * 1.0 / sppx;
while(0 - x + $(this).width() / 2 > 0)
{
x = x + pxinterval;
}
for(i = 0; (pxinterval * i) / 6 - x + $(this).width() / 2 < $(this).width() - 15; i++)
{
if((pxinterval * i) / 6 - x + $(this).width() / 2 - 15 < 0)
{
continue;
}
if(i % 6 == 0)
{
}
else
{
$("div.bglines").append('<div class="vr" style="background-color:rgba(0, 0, 0, 0.3); left:' + Math.floor((pxinterval * i) / 6 - x - 15 + $(this).width() / 2) + 'px"></div>');
}
}
$(this).find("div.timeline").each(function()
{
w = parseInt($(this).css("width"));
$(this).children("div.activity").each(function()
{
startTime = parseInt($(this).attr("startTime"));
endTime = parseInt($(this).attr("endTime"));
$(this).css("width", ((endTime - startTime) * 1.0 / sppx) + "px");
$(this).css("left", (((startTime - pointTime) * 1.0 / sppx) + w / 2) + "px");
});
});
});
}
function addTimeline1()
{
$("div.timelineholder1 > ul.sortable").prepend('<li><div class="timeline"></div></li>');
$($("div.timelineholder1 > ul.sortable").children().get(0)).find(".timeline").each(function()
{
});
}
function addTimeline2()
{
$("div.timelineholder2 > ul.sortable").prepend('<li><div class="timeline"></div></li>');
$($("div.timelineholder2 > ul.sortable").children().get(0)).find(".timeline").each(function()
{
});
}
$(this).parent().attr("dx", "10");
},
function(e)
{
$(this).parent().attr("dx", "0");
});
$($(this).children().get(1)).hover(function(e)
{
$(this).parent().attr("dx", "-10");
},
function(e)
{
$(this).parent().attr("dx", "0");
});
});
setInterval(function()
{
$("div.container").each(function() {
dx = parseInt($(this).attr("dx")); sppx = parseInt($(this).attr("sppx"));
$(this).attr("pointTime", (parseInt($(this).attr("pointTime")) + dx * sppx) + "");
draw();
});
}, 5);
});