|
|
|
@ -49,16 +49,33 @@ $(document).ready(function() {
|
|
|
|
|
if (data.module === 'composer') {
|
|
|
|
|
data.options.icon = 'fa-plus';
|
|
|
|
|
} else if (data.module === 'chat') {
|
|
|
|
|
data.options.icon = 'fa-spinner fa-spin';
|
|
|
|
|
if (!data.element.length) {
|
|
|
|
|
createChatIcon(data);
|
|
|
|
|
$(window).one('action:taskbar.pushed', function(ev, data) {
|
|
|
|
|
updateChatCount(data.element);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.getJSON(config.relative_path + '/api/user/' + utils.slugify(data.options.title), function(user) {
|
|
|
|
|
var el = $('#taskbar [data-uuid="' + data.uuid + '"] a');
|
|
|
|
|
el.find('i').remove();
|
|
|
|
|
el.css('background-image', 'url(' + user.picture + ')');
|
|
|
|
|
});
|
|
|
|
|
} else if (!data.element.hasClass('active')) {
|
|
|
|
|
updateChatCount(data.element);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createChatIcon(data) {
|
|
|
|
|
data.options.icon = 'fa-spinner fa-spin';
|
|
|
|
|
|
|
|
|
|
$.getJSON(config.relative_path + '/api/user/' + utils.slugify(data.options.title), function(user) {
|
|
|
|
|
var el = $('#taskbar [data-uuid="' + data.uuid + '"] a');
|
|
|
|
|
el.find('i').remove();
|
|
|
|
|
el.css('background-image', 'url(' + user.picture + ')');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateChatCount(el) {
|
|
|
|
|
var count = (parseInt($(el).attr('data-content'), 10) || 0) + 1;
|
|
|
|
|
$(el).attr('data-content', count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|