|
|
@ -154,23 +154,11 @@ define('chat', [
|
|
|
|
return $('#chat-modal-' + roomId).length !== 0;
|
|
|
|
return $('#chat-modal-' + roomId).length !== 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function checkStatus(chatModal) {
|
|
|
|
|
|
|
|
socket.emit('user.checkStatus', chatModal.attr('touid'), function(err, status) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.updateUserStatus(chatModal.find('[component="user/status"]'), status);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.createModal = function(data, callback) {
|
|
|
|
module.createModal = function(data, callback) {
|
|
|
|
templates.parse('chat', data, function(chatTpl) {
|
|
|
|
app.parseAndTranslate('chat', data, function(chatModal) {
|
|
|
|
translator.translate(chatTpl, function (chatTpl) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var chatModal = $(chatTpl),
|
|
|
|
var uuid = utils.generateUUID();
|
|
|
|
uuid = utils.generateUUID(),
|
|
|
|
var dragged = false;
|
|
|
|
dragged = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chatModal.attr('id', 'chat-modal-' + data.roomId);
|
|
|
|
chatModal.attr('id', 'chat-modal-' + data.roomId);
|
|
|
|
chatModal.attr('roomId', data.roomId);
|
|
|
|
chatModal.attr('roomId', data.roomId);
|
|
|
@ -179,6 +167,7 @@ define('chat', [
|
|
|
|
chatModal.css('position', 'fixed');
|
|
|
|
chatModal.css('position', 'fixed');
|
|
|
|
chatModal.css('zIndex', 100);
|
|
|
|
chatModal.css('zIndex', 100);
|
|
|
|
chatModal.appendTo($('body'));
|
|
|
|
chatModal.appendTo($('body'));
|
|
|
|
|
|
|
|
chatModal.find('.timeago').timeago();
|
|
|
|
module.center(chatModal);
|
|
|
|
module.center(chatModal);
|
|
|
|
|
|
|
|
|
|
|
|
app.loadJQueryUI(function() {
|
|
|
|
app.loadJQueryUI(function() {
|
|
|
@ -264,8 +253,6 @@ define('chat', [
|
|
|
|
|
|
|
|
|
|
|
|
Chats.addScrollHandler(chatModal.attr('roomId'), data.uid, chatModal.find('.chat-content'));
|
|
|
|
Chats.addScrollHandler(chatModal.attr('roomId'), data.uid, chatModal.find('.chat-content'));
|
|
|
|
|
|
|
|
|
|
|
|
checkStatus(chatModal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
taskbar.push('chat', chatModal.attr('UUID'), {
|
|
|
|
taskbar.push('chat', chatModal.attr('UUID'), {
|
|
|
|
title: data.users.length ? data.users[0].username : '',
|
|
|
|
title: data.users.length ? data.users[0].username : '',
|
|
|
|
roomId: data.roomId,
|
|
|
|
roomId: data.roomId,
|
|
|
@ -279,7 +266,6 @@ define('chat', [
|
|
|
|
callback(chatModal);
|
|
|
|
callback(chatModal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
module.focusInput = function(chatModal) {
|
|
|
|
module.focusInput = function(chatModal) {
|
|
|
|