Skip to content

Node.js based forum software built for the modern web

highlighting of the user with whom you are currently chatting with #1788

Julian Lama031bc272117
diff --git a/public/src/app.js b/public/src/app.js
index 3d32f683b3..023e2bd2c5 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -156,13 +156,13 @@ var socket,
app.enterRoom('global');
- if (config.environment === 'development' && console && console.log) {
- var log = console.log;
- console.log = function() {
- log.apply(this, arguments);
- socket.emit('tools.log', arguments);
- };
- }
+ // if (config.environment === 'development' && console && console.log) {
+ // var log = console.log;
+ // console.log = function() {
+ // log.apply(this, arguments);
+ // socket.emit('tools.log', arguments);
+ // };
+ // }
app.cacheBuster = config['cache-buster'];
diff --git a/public/src/forum/chats.js b/public/src/forum/chats.js
index 1341be1c14..73d892b445 100644
--- a/public/src/forum/chats.js
+++ b/public/src/forum/chats.js
@@ -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;
});
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index 97339eb882..be6fc87c14 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -71,7 +71,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
module.bringModalToTop(modal);
checkOnlineStatus(modal);
taskbar.updateActive(modal.attr('UUID'));
- scrollToBottom(modal.find('#chat-content'));
+ Chats.scrollToBottom(modal.find('#chat-content'));
} else {
module.toggleNew(modal.attr('UUID'), true);
}
@@ -103,7 +103,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
modal.find('.user-typing').removeClass('hide').appendTo(chatContent);
if (atBottom) {
- scrollToBottom(chatContent);
+ Chats.scrollToBottom(chatContent);
}
});
@@ -247,7 +247,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
chatModal.removeClass('hide');
checkOnlineStatus(chatModal);
taskbar.updateActive(uuid);
- scrollToBottom(chatModal.find('#chat-content'));
+ Chats.scrollToBottom(chatModal.find('#chat-content'));
module.center(chatModal);
module.bringModalToTop(chatModal);
};
@@ -320,17 +320,9 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
chatContent.append(message);
- scrollToBottom(chatContent);
+ Chats.scrollToBottom(chatContent);
};
- function scrollToBottom(chatContent) {
- if(chatContent[0]) {
- chatContent.scrollTop(
- chatContent[0].scrollHeight - chatContent.height()
- );
- }
- }
-
module.toggleNew = function(uuid, state) {
taskbar.toggleNew(uuid, state);
};