statusbar.innerHTML = 'No websockets :(. This means that you either use <em>Internet Explorer</em> or <em>Android</em>. In both cases, I suggest that you use <ahref="http://www.google.com/chrome/">Chrome</a> or <ahref="http://www.getfirefox.net/">Firefox</a>!';
statusbar.innerHTML = 'No websockets :(. This means that you either use <em>Internet Explorer</em> or <em>Android</em>. In both cases, I suggest that you use <ahref="http://www.google.com/chrome/">Chrome</a> or <ahref="http://www.getfirefox.net/">Firefox</a>!';
@ -80,46 +76,52 @@
}
}
function onMessage(evt) {
function onMessage(evt) {
var people = JSON.parse(evt.data);
var ret = JSON.parse(evt.data);
for (var i = people.length - 1; i >= 0; i--) {
var people = ret.people;
var user = document.getElementById(people[i].name);
var balls = ret.balls;
if(user){
var lines = ret.lines;
user.style.left = people[i].position.x + "px";
user.style.top = people[i].position.y + "px";
for(ball in balls_online){
ball.should_remove = true;
}
for (var i = balls.length - 1; i >= 0; i--) {
var ball = document.getElementById(balls[i].information);
if(ball){
ball.style.left = balls[i].position.x + "px";
ball.style.top = balls[i].position.y + "px";
ball.should_remove = false;
} else {
} else {
var name = document.createElement('span')
var ball = document.createElement('div');
name.className = "name";
ball.should_remove = false;
name.innerText = people[i].name;
ball.id = balls[i].information;
ball.className = 'ball';
var user = document.createElement('div');
ball.innerHTML = '<divclass="bullet"></div>';
user.id = people[i].name;
ball.style.left = balls[i].position.x + "px";
user.className = 'user';
ball.style.top = balls[i].position.y + "px";
user.innerHTML = '<divclass="bullet"></div>';
user.appendChild(name);
user.style.left = people[i].position.x + "px";
user.style.top = people[i].position.y + "px";
circle.appendChild(user);
}
}
var nodes = circle.childNodes;
ballscreen.appendChild(ball);
for(var i = nodes.length -1; i >= 0; i--) {
balls_online.push(ball);
var should_remove = true;
for (var j = people.length - 1; j >= 0; j--){
if(people[j].name == nodes[i].id) {
should_remove = false;
break;
}
}
}
if(should_remove){
circle.removeChild(nodes[i]);
}
}
for (var i = balls_online.length - 1; i >= 0; i--) {
if(balls_online[i].should_remove){
ballscreen.removeChild(balls_online[i]);
balls_online.splice(i, 1);
}
}
};
for (var i = svglines_online.length - 1; i >= 0; i--) {