mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-26 09:19:55 +01:00
lots of tweaks to chat and taskbar
This commit is contained in:
@@ -183,11 +183,16 @@
|
||||
if (chat.modalExists(data.fromuid)) {
|
||||
modal = chat.getModal(data.fromuid);
|
||||
chat.appendChatMessage(modal, data.message, data.timestamp);
|
||||
|
||||
if (modal.is(":visible")) {
|
||||
chat.load(modal.attr('UUID'));
|
||||
} else {
|
||||
chat.toggleNew(modal.attr('UUID'), true);
|
||||
}
|
||||
} else {
|
||||
modal = chat.createModal(data.username, data.fromuid);
|
||||
chat.toggleNew(modal.attr('UUID'), true);
|
||||
}
|
||||
|
||||
chat.load(modal.attr('UUID'));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ define(['taskbar'], function(taskbar) {
|
||||
chatModal.find('.close').on('click', function(e) {
|
||||
clearInterval(chatModal.intervalId);
|
||||
chatModal.intervalId = 0;
|
||||
chatModal.hide();
|
||||
chatModal.remove();
|
||||
chatModal.data('modal', null);
|
||||
taskbar.discard('chat', uuid);
|
||||
});
|
||||
|
||||
@@ -81,7 +82,11 @@ define(['taskbar'], function(taskbar) {
|
||||
checkOnlineStatus(chatModal);
|
||||
});
|
||||
|
||||
taskbar.push('chat', chatModal.attr('UUID'), {title:'<i class="fa fa-comment"></i> ' + username});
|
||||
taskbar.push('chat', chatModal.attr('UUID'), {
|
||||
title:'<i class="fa fa-comment"></i> ' + username,
|
||||
state: ''
|
||||
});
|
||||
|
||||
return chatModal;
|
||||
}
|
||||
|
||||
@@ -149,7 +154,11 @@ define(['taskbar'], function(taskbar) {
|
||||
chatContent.scrollTop(
|
||||
chatContent[0].scrollHeight - chatContent.height()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
module.toggleNew = function(uuid, state) {
|
||||
taskbar.toggleNew(uuid, state);
|
||||
};
|
||||
|
||||
return module;
|
||||
});
|
||||
@@ -25,6 +25,7 @@ define(function() {
|
||||
if (_btn.className.indexOf('active') === -1) {
|
||||
taskbar.minimizeAll();
|
||||
module.load(uuid);
|
||||
taskbar.toggleNew(uuid, false);
|
||||
|
||||
// Highlight the button
|
||||
$(taskbar.tasklist).removeClass('active');
|
||||
@@ -69,7 +70,7 @@ define(function() {
|
||||
'</a>';
|
||||
btnEl.setAttribute('data-module', module);
|
||||
btnEl.setAttribute('data-uuid', uuid);
|
||||
btnEl.className = options.state || 'active';
|
||||
btnEl.className = options.state !== undefined ? options.state : 'active';
|
||||
|
||||
if (!options.state || options.state === 'active') taskbar.minimizeAll();
|
||||
taskbar.tasklist.appendChild(btnEl);
|
||||
@@ -82,14 +83,21 @@ define(function() {
|
||||
},
|
||||
minimizeAll: function() {
|
||||
$(taskbar.tasklist.querySelectorAll('.active')).removeClass('active');
|
||||
},
|
||||
toggleNew: function(uuid, state) {
|
||||
var btnEl = $(taskbar.tasklist.querySelector('[data-uuid="' + uuid + '"]'));
|
||||
btnEl.toggleClass('new', state);
|
||||
}
|
||||
}
|
||||
|
||||
if (!taskbar.initialized) taskbar.init();
|
||||
if (!taskbar.initialized) {
|
||||
taskbar.init();
|
||||
}
|
||||
|
||||
return {
|
||||
push: taskbar.push,
|
||||
discard: taskbar.discard,
|
||||
minimize: taskbar.minimize
|
||||
minimize: taskbar.minimize,
|
||||
toggleNew: taskbar.toggleNew
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user