mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
highlighting of the user with whom you are currently chatting with #1788
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
/* globals define, app*/
|
||||
/* globals define, app, ajaxify, utils, socket */
|
||||
|
||||
define('forum/chats', ['string','sounds'], function(S, sounds) {
|
||||
define('forum/chats', ['string', 'sounds'], function(S, sounds) {
|
||||
var Chats = {};
|
||||
|
||||
Chats.init = function() {
|
||||
var containerEl = $('.expanded-chat ul');
|
||||
|
||||
Chats.addEventListeners();
|
||||
Chats.addSocketListeners();
|
||||
Chats.scrollToBottom(containerEl);
|
||||
Chats.setActive();
|
||||
};
|
||||
|
||||
Chats.getRecipientUid = function() {
|
||||
console.log($('.expanded-chat'));
|
||||
return parseInt($('.expanded-chat').attr('data-uid'), 10);
|
||||
};
|
||||
|
||||
@@ -93,5 +98,19 @@ define('forum/chats', ['string','sounds'], function(S, sounds) {
|
||||
}
|
||||
};
|
||||
|
||||
Chats.scrollToBottom = function(containerEl) {
|
||||
if (containerEl.length) {
|
||||
containerEl.scrollTop(
|
||||
containerEl[0].scrollHeight - containerEl.height()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Chats.setActive = function() {
|
||||
console.log(Chats.getRecipientUid());
|
||||
$('.chats-list li').removeClass('bg-primary');
|
||||
$('.chats-list li[data-uid="' + Chats.getRecipientUid() + '"]').addClass('bg-primary');
|
||||
};
|
||||
|
||||
return Chats;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user