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.
Great work! Obviously ~300 lines of code isn't enough to do a full-fledged slick interface...but one suggestion that presumably would be easy to implement: a button that closes all current word-balloons.
I was also thinking a "reply" button for threaded discussions between users...but then that would kill the fun simplicity of the app...I just like seeing where HN users are currently this morning. And also, the ways people try to obfuscate XSS attacks
There are private rooms, but the UI do not support that yet.
Just add #word to the url and get your private chat map.
i.e. http://idoco.github.io/map-chat#test
116 comments
[ 59.9 ms ] story [ 4262 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 :)
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 :)
https://github.com/idoco/map-chat/pull/11
I was also thinking a "reply" button for threaded discussions between users...but then that would kill the fun simplicity of the app...I just like seeing where HN users are currently this morning. And also, the ways people try to obfuscate XSS attacks
I'm afraid that a reply button might take out some of the fun and the simplicity, but I will conciser that.