-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.js
49 lines (49 loc) · 1.8 KB
/
test2.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
$(document).ready(function()
{
var time = 0;
var open = new Array();
var todelete = new Array();
for (var x = 0; x < 11; x++)
{
open[x] = 0;
}
var width = $(document).width();
setInterval(function()
{
time++;
while(todelete.length > 0 && todelete[0][0] < time)
{
console.log("Removing "+todelete[0][1]);
$('#'+todelete[0][1]).remove();
todelete.splice(0,1);
}
console.log(time);
}, 1000);
var INT = 10;
setInterval(function()
{
var i = 5;
var done = false;
for (var diff = 0; diff <= 5; diff++)
{
var index = i-diff;
if (open[index] < time)
{
open[index] = time + MULT*INT;
$('body').append("<div class=\"tweetbox\" id=\""+time+"\" style=\"top:"+(25*index)+"px\">This is tweet #"+time+".................................................................................................................................................");
todelete.push([time+15, time]);
$('#'+time).animate({right:"+="+(2*width)+"px"}, 15000, "linear");
break;
}
index = i+diff;
if (open[index] < time)
{
open[index] = time + MULT*INT;
$('body').append("<div class=\"tweetbox\" id=\""+time+"\"style=\"top:"+(25*index)+"px\">This is tweet #"+time+".................................................................................................................................................");
todelete.push([time+15, time]);
$('#'+time).animate({right:"+="+(2*width)+"px"}, 15000, "linear");
break;
}
}
}, 1000);
});