Update chat page behaviour on mobile

As the chat page is not optimised for mobile devices, if
entered, the chat messages themselves will be hidden
(corresponding commits on themes), and the client-side
javascript will open the chat modal when contacts are clicked.
v1.18.x
Julian Lam 10 years ago
parent 34a6275b85
commit 7fae82a9bd

@ -10,7 +10,8 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
var newMessage = false;
Chats.init = function() {
var containerEl = $('.expanded-chat ul');
var containerEl = $('.expanded-chat ul'),
env = utils.findBootstrapEnvironment();
if (!Chats.initialised) {
Chats.addSocketListeners();
@ -18,9 +19,11 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
}
Chats.addEventListeners();
Chats.setActive();
if (env === 'md' || env === 'lg') {
Chats.resizeMainWindow();
}
Chats.scrollToBottom($('.expanded-chat ul'));
Chats.initialised = true;
@ -40,7 +43,12 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
popoutEl = $('[data-action="pop-out"]');
$('.chats-list').on('click', 'li', function(e) {
var env = utils.findBootstrapEnvironment();
if (env === 'xs' || env === 'sm') {
app.openChat($(this).attr('data-username'), $(this).attr('data-uid'));
} else {
ajaxify.go('chats/' + utils.slugify($(this).attr('data-username')));
}
});
inputEl.on('keypress', function(e) {
@ -175,6 +183,8 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
messagesList.height($(window).height() - (fromTop + inputHeight + (margin * 4)));
}
Chats.setActive();
};
Chats.notifyTyping = function(toUid, typing) {

Loading…
Cancel
Save