Inject the pad dependency into chat.

pull/343/head
Chad Weider 2012-01-15 21:05:19 -08:00
parent 8a0d6c6636
commit 72d29b1c62
2 changed files with 5 additions and 4 deletions

View File

@ -82,13 +82,13 @@ var chat = (function()
send: function()
{
var text = $("#chatinput").val();
pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text});
this._pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text});
$("#chatinput").val("");
},
addMessage: function(msg, increment)
{
//correct the time
msg.time += pad.clientTimeOffset;
msg.time += this._pad.clientTimeOffset;
//create the time string
var minutes = "" + new Date(msg.time).getMinutes();
@ -150,8 +150,9 @@ var chat = (function()
self.scrollDown();
},
init: function()
init: function(pad)
{
this._pad = pad;
$("#chatinput").keypress(function(evt)
{
//if the user typed enter, fire the send

View File

@ -413,7 +413,7 @@ var pad = {
pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp;
//initialize the chat
chat.init();
chat.init(this);
pad.initTime = +(new Date());
pad.padOptions = clientVars.initialOptions;