diff --git a/static/js/chat.js b/static/js/chat.js index 1636ab690..a0d0d9ac2 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 8a2c33847..5f454172f 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;