summaryrefslogtreecommitdiff
path: root/public/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/lib')
-rw-r--r--public/js/lib/views/room/chat.js5
-rw-r--r--public/js/lib/views/room/room.js9
2 files changed, 5 insertions, 9 deletions
diff --git a/public/js/lib/views/room/chat.js b/public/js/lib/views/room/chat.js
index 222522f..0932e47 100644
--- a/public/js/lib/views/room/chat.js
+++ b/public/js/lib/views/room/chat.js
@@ -24,8 +24,8 @@ var ChatView = View.extend({
this.seen[key] = true
var $el = $( this.template )
- $el.find(".nick").html(msg.nick)
- $el.find(".msg").html(msg.msg)
+ $el.find(".nick").html(sanitize(msg.nick))
+ $el.find(".msg").html(sanitizeHTML(msg.msg))
this.$messages.append($el)
if (! this.scrolled) {
this.scrollToBottom()
@@ -34,7 +34,6 @@ var ChatView = View.extend({
send: function(e){
e && e.preventDefault()
- console.log("hi")
var val = this.$msg.sanitize()
this.$msg.focus()
if (! val) return
diff --git a/public/js/lib/views/room/room.js b/public/js/lib/views/room/room.js
index 3b3b253..13f08ce 100644
--- a/public/js/lib/views/room/room.js
+++ b/public/js/lib/views/room/room.js
@@ -1,5 +1,3 @@
-var chat
-
var RoomView = View.extend({
events: {
@@ -11,20 +9,19 @@ var RoomView = View.extend({
var base = this
this.name = name
- chat = this.chatView = new ChatView (socket)
+ this.chatView = new ChatView (socket)
this.userlist = new UserlistView (socket)
-
app.socket.emit("join", { nick: user.username })
app.socket.on("welcome", function(room){
- room.messages.forEach(chat.add)
+ room.messages.forEach(base.chat.add)
base.userlist.users = room.users
base.userlist.update()
})
app.socket.on("message", function(msg){
- chat.add(msg)
+ base.chat.add(msg)
})
}