Thanks!
It took me about two weeks in after work hours.
The server is 70 lines of Java (vertx) and the UI is like 200 lines of JS (With very little JQuery)
* something to zoom the map (and thus, filtering messages for a given radius)
* and/or something to organize messages in a way they don't overlap :P (eg: balloons with a number, when clicked it shows the full list of messages)
It is possible to save the message history on the client side. But I though that this is fun to have no history :) Right now notifications (The switch on top) gives you some history.
I disabled the zoom buttons, because I was thinking about mobile browsers and the very limited screen space they have. I will reconsider
Very nice! it would be nice to have an option though that would fuzz your location a bit - I dont have a problem with people knowing im from my city - pinpointing my house is a different thing though...
Very cool project. A lot of people active already playing along. Would be nice if we could PM one another that to start a one-on-one convo with someone in a place we're interested in.
Make your regexs global, i.e. .replace(/</g, "") (note the g at the end), otherwise only the first instance is replaced. I made it easy for you: https://github.com/idoco/map-chat/pull/1
var entityMap = {
"&": "&",
"<": "<",
">": ">",
'"': '"',
"'": ''',
"/": '/'
};
function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s];
});
}
also document.createTextNode will tell the browser not to render the children as html, whereas appending a dom element and innerHTML will.[1] I'm just assuming that behavior is correct in all browsers though.
121 comments
[ 13.5 ms ] story [ 290 ms ] threadperhaps it needs:
* something to zoom the map (and thus, filtering messages for a given radius) * and/or something to organize messages in a way they don't overlap :P (eg: balloons with a number, when clicked it shows the full list of messages)
It is possible to save the message history on the client side. But I though that this is fun to have no history :) Right now notifications (The switch on top) gives you some history.
I disabled the zoom buttons, because I was thinking about mobile browsers and the very limited screen space they have. I will reconsider
PS: it's so amazing to see all that people around the world at the same time, on a map. sounds like a new world to explore :P
BTW as for writing this message there are 150 people on the map :)
FYI, someone just managed to inject a javascript alert.
Very fun app! Love it! Are chat bubbles auto disappearing? maybe let us set a timer?
div.textContent = msg;
msg.text = div.innerHTML;
This should remove all HTML/CSS/Script.
[0]https://github.com/janl/mustache.js/blob/master/mustache.js#...
[1]https://jsfiddle.net/1dsygwoj/
If you implement some new cool features, I'll be glad to merge them.
Before today, I thought it would be cool to enable some html :)