|
|
@ -198,6 +198,11 @@ define([
|
|
|
|
return $messages.find(dataQuery(id));
|
|
|
|
return $messages.find(dataQuery(id));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var scrollChatToBottom = function () {
|
|
|
|
|
|
|
|
var $messagebox = $('.cp-app-contacts-messages');
|
|
|
|
|
|
|
|
$messagebox.scrollTop($messagebox[0].scrollHeight);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var normalizeLabels = function ($messagebox) {
|
|
|
|
var normalizeLabels = function ($messagebox) {
|
|
|
|
$messagebox.find('div.cp-app-contacts-message').toArray().reduce(function (a, b) {
|
|
|
|
$messagebox.find('div.cp-app-contacts-message').toArray().reduce(function (a, b) {
|
|
|
|
var $b = $(b);
|
|
|
|
var $b = $(b);
|
|
|
@ -364,10 +369,7 @@ define([
|
|
|
|
input.value = '';
|
|
|
|
input.value = '';
|
|
|
|
sending = false;
|
|
|
|
sending = false;
|
|
|
|
debug('sent successfully');
|
|
|
|
debug('sent successfully');
|
|
|
|
var $messagebox = $(messages);
|
|
|
|
scrollChatToBottom();
|
|
|
|
|
|
|
|
|
|
|
|
var height = $messagebox[0].scrollHeight;
|
|
|
|
|
|
|
|
$messagebox.scrollTop(height);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -584,7 +586,7 @@ define([
|
|
|
|
$messagebox.append(el_message);
|
|
|
|
$messagebox.append(el_message);
|
|
|
|
|
|
|
|
|
|
|
|
if (shouldScroll) {
|
|
|
|
if (shouldScroll) {
|
|
|
|
$messagebox.scrollTop($messagebox[0].scrollHeight);
|
|
|
|
scrollChatToBottom();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
normalizeLabels($messagebox);
|
|
|
|
normalizeLabels($messagebox);
|
|
|
|
reorderRooms();
|
|
|
|
reorderRooms();
|
|
|
|