Skip to content

Node.js based forum software built for the modern web

closed #2360

Julian Lam74630b3a79e0
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index 9a6d7e7f79..67c9cd3164 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -8,7 +8,8 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
module.prepareDOM = function() {
var chatsToggleEl = $('#chat_dropdown'),
- chatsListEl = $('#chat-list');
+ chatsListEl = $('#chat-list'),
+ dropdownEl;
chatsToggleEl.on('click', function() {
if (chatsToggleEl.parent().hasClass('open')) {
@@ -36,16 +37,27 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
for(var x = 0; x<chats.length; ++x) {
userObj = chats[x];
- $('<li class="' + (userObj.unread ? 'unread' : '') + '"/>')
+ dropdownEl = $('<li class="' + (userObj.unread ? 'unread' : '') + '"/>')
.attr('data-uid', userObj.uid)
- .html('<a href="javascript:app.openChat(\'' +
- userObj.username +
- '\', ' + userObj.uid +
- ');">'+
+ .html('<a data-ajaxify="false">'+
'<img src="' + userObj.picture + '" title="' + userObj.username +'" />' +
'<i class="fa fa-circle status ' + userObj.status + '"></i> ' +
userObj.username + '</a>')
.appendTo(chatsListEl);
+
+ (function(userObj) {
+ dropdownEl.click(function() {
+ if (!ajaxify.currentPage.match(/^chats\//)) {
+ app.openChat(userObj.username, userObj.uid);
+ } else {
+ ajaxify.go('chats/' + utils.slugify(userObj.username));
+ }
+ /*javascript:app.openChat(\'' +
+ userObj.username +
+ '\', ' + userObj.uid +
+ ');*/
+ });
+ })(userObj);
}
var seeAll = '<li class="pagelink"><a href="' + config.relative_path + '/chats">[[modules:chat.see_all]]</a></li>';