diff --git a/static/js/app.js b/static/js/app.js index 01d7c0a..4d782bd 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,7 +1,6 @@ window.app = (function() { var that = {}, coords, - foundLocation = false, map, marker, username = localStorage.username || 'Anonymous', @@ -136,7 +135,7 @@ window.app = (function() { removeUser(data[1]); } else if (data[0] == 'update') { data[2].id = data[1]; - updateUserLocation(data[2]); + updateUser(data[2]); } }; that.ws.onclose = function (event) { @@ -162,7 +161,7 @@ window.app = (function() { }) }) }; - if (!foundLocation) { + if (!marker) { if (!map) { L.mapbox.accessToken = config.mapboxAccessToken; map = L.mapbox.map('map', 'mapbox.streets') @@ -172,7 +171,6 @@ window.app = (function() { .bindPopup(options.title) .addTo(map); map.setView(coords, zoomLevel); - foundLocation = true; updateUserList(); } else { map.removeLayer(marker); @@ -186,7 +184,7 @@ window.app = (function() { }); } - function updateUserLocation(data) { + function updateUser(data) { var user = getUserById(data.id); if (!user) { user = createUser(data);