diff --git a/server.js b/server.js index d0e2b10d..d8b15101 100644 --- a/server.js +++ b/server.js @@ -171,7 +171,11 @@ io.sockets.on('connection', function (socket) { }); //User sends a chat message +<<<<<<< HEAD socket.on('chat:message', function(room, uid, message, name){ +======= + socket.on('chat:message', function(room, uid, message, name){ +>>>>>>> comments on sendchatmessage draw.chatMessage(room, uid, message, name); io.sockets.in(room).emit('chat:message', uid, message, name); }); diff --git a/src/static/css/style.css b/src/static/css/style.css index fb934d6f..ecacfd5c 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -492,7 +492,7 @@ input[type=checkbox] { #chatBox { position: absolute; bottom: 0px; - right: 20px; + right: 60px; width: 180px; height: 200px; z-index: 400; diff --git a/src/static/js/draw.js b/src/static/js/draw.js index b1814156..dce41e59 100755 --- a/src/static/js/draw.js +++ b/src/static/js/draw.js @@ -1169,16 +1169,17 @@ function processSettings(settings) { } function chatToggleShow() { + //If it's currently big, make it small, vice versa + //If the user does not have a name, ask for one + if($("#chatBox").height() > 10){ $("#chatBox").animate({height : 10},200); $("#chatMessages").hide(); $("#chatInput").hide(); } else { - if(chatName == ""){ chatName = prompt("What is your name?", ""); } - $("#chatBox").animate({height : 200},200); $("#chatMessages").show(); $("#chatInput").show(); @@ -1187,12 +1188,13 @@ function chatToggleShow() { } function sendChatMessage() { + //get the text, emit it, clear the text var message = $('#chatInput').val(); socket.emit('chat:message', room, uid, message, chatName || "unnamed"); $('#chatInput').val(''); - return(false); + return(false);//prevents page reload on submit } - + //does chatName belong here? var chatName = ""; chatToggleShow(); $("#chatLabel").click(function() {chatToggleShow();} );