This commit is contained in:
j 2016-01-26 16:06:07 +05:30
parent ddf94ef736
commit 13bfab3407
1 changed files with 19 additions and 1 deletions

View File

@ -191,6 +191,11 @@ window.app = (function() {
if (!user) {
user = createUser(data);
}
user.coords = data.coords;
if (user.name != data.name) {
user.name = data.name;
updateUserList();
}
var options = {
title: user.name,
icon: L.icon({
@ -200,7 +205,6 @@ window.app = (function() {
})
})
};
user.coords = data.coords;
if (user.marker) {
map.removeLayer(user.marker);
}
@ -221,6 +225,20 @@ window.app = (function() {
div.innerHTML = user.name;
div.style.background = 'rgb(' + user.color.join(', ') + ')';
div.style.top = '8px'
div.onclick = function() {
if (!user.id) {
var name = prompt("What is your name?", username) || 'Anonymous';
localStorage.username = username = name;
update({
name: username,
color: color,
coords: coords
});
updateUserList();
} else if (user.coords) {
map.setView(user.coords, zoomLevel);
}
}
list.appendChild(div);
});
if (userlist) {