diff --git a/static/js/chat.js b/static/js/chat.js index 1636ab69..a0d0d9ac 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -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 diff --git a/static/js/pad2.js b/static/js/pad2.js index 8a2c3384..5f454172 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -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;