Show HN: MapChat – A simple location based chat in 300 lines of code
idoco.github.io
idoco.github.io
And then it took me like 5 seconds to figure out how to chat. I first tried to click on people's chat to reply to them and then I finally found the text input at the bottom of the screen. Then nothing would happen when I hit enter. Then I eventually found the blue circle send button and that didn't work.
Then I tried Chrome. Worked! So I found some bugs in Safari :)
Amazing that this was done in 300 lines. Something about this format is immediately appealing. Maybe it's because dots on a map feel more human than handles on a forum or comment thread. Anonymity is this double-edged sword in communities. Maybe this is the minimum amount needed to make people behave? Probably not, but something IS interesting here.
Right now it's just people shouting...I hope your next trick is to figure out how to turn it into conversations. Suggestion: Please don't be tempted to just rewrite it or start from scratch. Iterate from this version because 1) it would be faster and 2) this one already has some magic in it.
Thanks for sharing!
Version 8.0.6 (10600.6.3)
I'm having that problem in Firefox.
I will try to add some features to improve conversation, you are welcome to add and track these suggestions on the issues page of the project.
"We've noticed that one of your CloudApp drops has been getting an unusual amount of attention: Screen Recording 2015-06-19 at 09.44 AM.gif has had a download transfer rate of 4.2 GB in the last day or so.
Even though we deeply appreciate you trusting us with your data, this violates our download limit and fair use policy. Unfortunately this is not something we are able to host on our servers.
Your drop has been disabled and can't be reached as of this moment. We haven't deleted it from our servers though so if you need to get it back or feel you might have received this email in error please contact us so we can sort it out."
> Mixed Content: The page at 'https://idoco.github.io/map-chat/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://chatmap.cloudapp.net/chat/info?t=1434731663123'. This request has been blocked; the content must be served over HTTPS
Currently the websocket connection is in http, I'm not sure how it will effect the server if I change it to https. Will it create more load on it?
Before today, I thought it would be cool to enable some html :)
msg.text =
msg.text.replace('>','')
.replace('<','')
.replace(';','')
.replace('/','')
.replace('\\','')
.replace('\'','')
.replace('\"','')
.replace(':"','')
.replace('!important','');
I will think of a more clever solution next week :)div.textContent = msg;
msg.text = div.innerHTML;
This should remove all HTML/CSS/Script.
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.[0]https://github.com/janl/mustache.js/blob/master/mustache.js#...
Does Google not offer much higher limits if you're willing to pay? I'd be curious to try a similar app, but it seems that popularity might kill one pretty quickly with such low API limits.
Lets try to enjoy some hacking free chat, instead of ruining it. You can fill you spare time by implementing new features and sending me pull requests :)
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.
Anyone else experience that?
Adding more traditional scrolling chat bubbles (see Ultima Online) would help that I think.
perhaps 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
I think that'd provide a nice basis for fleshing it out.
Maybe I'll change it after I'll make messages dissolve after some time.
Also requested are message history and dots of different colors.
1. Fade timeout on messages (10 to 20 seconds).
2. Clicking on a chat bubble needs to bring it to the front (change the z-index). Sometimes just want to read a specific message hidden behind another, and having to click to close gets tired fast. Extra bonus if future messages from the same person you've clicked on once always pop up on top of others in the area (or provide a little "pin" option in each chat bubble, but that will probably clutter too much).
And as a separate suggestion already mentioned by others:
3. The ability to toggle the enableHighAccuracy boolean. Exact street address is a little too creepy.
Every time I load the page.
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?
If you implement some new cool features, I'll be glad to merge them.
GitHub issues are a good way if you want to comment about the app. You can also contact me at ido.mapchat @gmail.com
BTW as for writing this message there are 150 people on the map :)