From ead1f80b0820b59902a17edb3c490ea6adae2ecf Mon Sep 17 00:00:00 2001 From: Michael Nutt Date: Fri, 11 Mar 2011 00:01:57 -0500 Subject: [PATCH] websocket js handler should know about different notification types --- public/javascripts/web-socket-receiver.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/javascripts/web-socket-receiver.js b/public/javascripts/web-socket-receiver.js index d09759662..cb888f857 100644 --- a/public/javascripts/web-socket-receiver.js +++ b/public/javascripts/web-socket-receiver.js @@ -16,7 +16,8 @@ var WebSocketReceiver = { onMessage: function(evt) { var obj = jQuery.parseJSON(evt.data); - if(obj['class'] == 'notifications') { + + if(obj['class'].match(/^notifications/)) { WebSocketReceiver.processNotification(obj); } else if (obj['class'] == 'people') { WSR.debug("got a " + obj['class']); @@ -60,7 +61,7 @@ var WebSocketReceiver = { processNotification: function(notification){ - var nBadge = $("#notification_badge_number"); + var nBadge = $("#notification_badge div.badge_count"); nBadge.html().replace(/\d+/, function(num){ nBadge.html(parseInt(num)+1);