Barış Soner Uşaklı 6 years ago
parent b179c9376f
commit cf6cf99bc0

@ -58,24 +58,26 @@ $(document).ready(function() {
function setupTaskbar() {
$(window).on('filter:taskbar.push', function(ev, data) {
data.options.className = 'taskbar-' + data.module;
if (data.module === 'composer') {
data.options.icon = 'fa-commenting-o';
} else if (data.module === 'chat') {
if (!data.element.length) {
createChatIcon(data);
$(window).one('action:taskbar.pushed', function(ev, data) {
updateChatCount(data.element);
});
} else if (!data.element.hasClass('active')) {
updateChatCount(data.element);
if (data.element.length && !data.element.hasClass('active')) {
increaseChatCount(data.element);
}
}
});
$(window).on('action:taskbar.pushed', function(ev, data) {
if (data.module === 'chat') {
createChatIcon(data);
var elData = data.element.data();
if (elData && elData.options && !elData.options.isSelf) {
increaseChatCount(data.element);
}
}
});
socket.on('event:chats.markedAsRead', function(data) {
$('#taskbar [data-roomId="' + data.roomId + '"]')
$('#taskbar [data-roomid="' + data.roomId + '"]')
.removeClass('new')
.attr('data-content', 0);
});
@ -100,7 +102,7 @@ $(document).ready(function() {
});
}
function updateChatCount(el) {
function increaseChatCount(el) {
var count = (parseInt($(el).attr('data-content'), 10) || 0) + 1;
$(el).attr('data-content', count);
}

Loading…
Cancel
Save