v1.18.x
barisusakli 10 years ago
parent e769ebe668
commit 38874345b7

@ -315,19 +315,19 @@ var socket,
require(['chat'], function (chat) {
chat.canMessage(touid, function(err) {
if (!err) {
if (!chat.modalExists(touid)) {
chat.createModal(username, touid, loadAndCenter);
} else {
loadAndCenter(chat.getModal(touid));
}
function loadAndCenter(chatModal) {
chat.load(chatModal.attr('UUID'));
chat.center(chatModal);
}
function loadAndCenter(chatModal) {
chat.load(chatModal.attr('UUID'));
chat.center(chatModal);
}
if (err) {
return app.alertError(err.message);
}
if (!chat.modalExists(touid)) {
chat.createModal(username, touid, loadAndCenter);
} else {
app.alertError(err.message);
loadAndCenter(chat.getModal(touid));
}
});
});

@ -115,7 +115,8 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
});
socket.on('event:user_status_change', function(data) {
updateStatus(data.status);
var modal = module.getModal(data.uid);
updateStatus(modal, data.status);
});
};
@ -148,13 +149,13 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
if (err) {
return app.alertError(err.message);
}
updateStatus(status);
updateStatus(chatModal, status);
});
}
function updateStatus(status) {
function updateStatus(chatModal, status) {
translator.translate('[[global:' + status + ']]', function(translated) {
$('#chat-user-status').attr('class', 'fa fa-circle status ' + status)
chatModal.find('#chat-user-status').attr('class', 'fa fa-circle status ' + status)
.attr('title', translated)
.attr('data-original-title', translated);
});
@ -175,6 +176,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
chatModal.css('position', 'fixed');
chatModal.css('zIndex', 100);
chatModal.appendTo($('body'));
module.center(chatModal);
chatModal.draggable({
start:function() {
module.bringModalToTop(chatModal);
@ -268,9 +270,17 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
};
module.center = function(chatModal) {
chatModal.css("left", Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
chatModal.css("top", Math.max(0, $(window).height() / 2 - $(chatModal).outerHeight() / 2) + "px");
var hideAfter = false;
if (chatModal.hasClass('hide')) {
chatModal.removeClass('hide');
hideAfter = true;
}
chatModal.css('left', Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + 'px');
chatModal.css('top', Math.max(0, $(window).height() / 2 - $(chatModal).outerHeight() / 2) + 'px');
chatModal.find('#chat-message-input').focus();
if (hideAfter) {
chatModal.addClass('hide');
}
return chatModal;
};
@ -280,7 +290,6 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
checkStatus(chatModal);
taskbar.updateActive(uuid);
Chats.scrollToBottom(chatModal.find('#chat-content'));
module.center(chatModal);
module.bringModalToTop(chatModal);
socket.emit('modules.chats.markRead', chatModal.attr('touid'));
};

@ -30,10 +30,7 @@ define('taskbar', function() {
module.minimize(uuid);
}
});
});
this.taskbar.on('click', 'li a', function(e) {
e.preventDefault();
return false;
});
taskbar.initialized = true;
@ -50,7 +47,6 @@ define('taskbar', function() {
},
discard: function(module, uuid) {
// Commit
var btnEl = taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"]');
btnEl.remove();
taskbar.update();

Loading…
Cancel
Save