diff --git a/scripts/communications.js b/scripts/communications.js index 3d7ec1d..b8dcbf8 100644 --- a/scripts/communications.js +++ b/scripts/communications.js @@ -400,12 +400,13 @@ function connect(profile, connection_id) if(data.mode == "new_message") { console.log("Recieved new message from "+data.from - +" in channel "+data.channel.toString()); + +" in channel "+data.channel.toString(), data.date); // Push the new messages to the chat g.chats[data.channel].messages.push({ message: data.message, - from: data.from + from: data.from, + date: data.date }); // Is the chat and server active diff --git a/scripts/formatting.js b/scripts/formatting.js index fe41724..3f6dbbd 100644 --- a/scripts/formatting.js +++ b/scripts/formatting.js @@ -205,8 +205,6 @@ function text_to_html(text) if(strikethrough_check) out += ""; if(code_check) out += ""; - console.log(out) - // Send out back return out; } diff --git a/scripts/profiles.js b/scripts/profiles.js index 01a4292..781c300 100644 --- a/scripts/profiles.js +++ b/scripts/profiles.js @@ -160,6 +160,7 @@ function chat_switch_to(id) // Setup some memory varibles var last_chat_user = ""; + var last_chat_date = ""; // Loop over the messages for(var i=0;i

"; + " "+date+"

"; } // Add some html data to the chat @@ -249,6 +257,13 @@ function chat_send() // Get the message var message = document.getElementById("chat-content-send-textarea").value; + // Get the date + var date = new Date(); + + // Remove some data from the date + date.setMilliseconds(0); + date.setSeconds(0); + // Is the message not empty and isnt a newline if(message.length > 0 && message != "\n") { @@ -259,7 +274,8 @@ function chat_send() { mode: "send_message", channel: active_chat, - message: message + message: message, + date: Date.parse(date) } ); }