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

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

Loading…
Cancel
Save