Commit 5ee9a678 authored by ichim-david's avatar ichim-david

Changed the following:

- removed extra jQuerify wrapping of message at onChatRoomMessage
- Construct an array of strings and add it to onChatRoomRoster only
  after loop is done in order to have only 1 dom insertion
parent 764a7101
...@@ -1011,7 +1011,7 @@ ...@@ -1011,7 +1011,7 @@
'time': (new Date()).toLocaleTimeString().substring(0,5), 'time': (new Date()).toLocaleTimeString().substring(0,5),
'message': body, 'message': body,
'username': sender, 'username': sender,
'extra_classes': ($(message).find('delay').length > 0) && 'delayed' || '' 'extra_classes': ($message.find('delay').length > 0) && 'delayed' || ''
})); }));
} else { } else {
$chat_content.append( $chat_content.append(
...@@ -1020,7 +1020,7 @@ ...@@ -1020,7 +1020,7 @@
'time': (new Date()).toLocaleTimeString().substring(0,5), 'time': (new Date()).toLocaleTimeString().substring(0,5),
'message': body, 'message': body,
'username': sender, 'username': sender,
'extra_classes': ($(message).find('delay').length > 0) && 'delayed' || '' 'extra_classes': ($message.find('delay').length > 0) && 'delayed' || ''
})); }));
} }
$chat_content.scrollTop($chat_content[0].scrollHeight); $chat_content.scrollTop($chat_content[0].scrollHeight);
...@@ -1033,6 +1033,8 @@ ...@@ -1033,6 +1033,8 @@
// underscore size is needed because roster is on object // underscore size is needed because roster is on object
var controlboxview = xmppchat.chatboxesview.views.controlbox, var controlboxview = xmppchat.chatboxesview.views.controlbox,
roster_size = _.size(roster), roster_size = _.size(roster),
$participant_list = this.$el.find('.participant-list'),
participants = [],
i; i;
if (controlboxview) { if (controlboxview) {
...@@ -1040,8 +1042,9 @@ ...@@ -1040,8 +1042,9 @@
} }
this.$el.find('.participant-list').empty(); this.$el.find('.participant-list').empty();
for (i=0; i<roster_size; i++) { for (i=0; i<roster_size; i++) {
this.$el.find('.participant-list').append('<li>' + Strophe.unescapeNode(_.keys(roster)[i]) + '</li>'); participants.push('<li>' + Strophe.unescapeNode(_.keys(roster)[i]) + '</li>');
} }
$participant_list.append(participants.join(""));
return true; return true;
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment