Add toolbar notification when the messenger is closed

This commit is contained in:
yflory
2018-09-12 15:07:50 +02:00
parent 5276dc0bf6
commit 10823fc124
3 changed files with 27 additions and 2 deletions

View File

@@ -72,6 +72,18 @@
.modal_main(); .modal_main();
}; };
& { & {
@keyframes notification {
0% {
background: rgba(0,0,0,0);
}
50% {
background: rgba(0,0,0,0.2);
}
100% {
background: rgba(0,0,0,0);
}
}
.toolbar_vars(); .toolbar_vars();
@toolbar_line-height: 32px; @toolbar_line-height: 32px;
@toolbar_top-height: 64px; @toolbar_top-height: 64px;
@@ -1001,6 +1013,11 @@
width: 125px; width: 125px;
text-align: center; text-align: center;
} }
#cp-toolbar-chat-drawer-open button {
&.cp-toolbar-notification {
animation: notification 2s ease-in-out infinite;
}
}
.cp-toolbar-share-button { .cp-toolbar-share-button {
width: 50px; width: 50px;
text-align: center; text-align: center;

View File

@@ -420,7 +420,7 @@ Messenger, MessengerUI, Messages) {
}).prependTo(toolbar.chatContent); }).prependTo(toolbar.chatContent);
var sframeChan = Common.getSframeChannel(); var sframeChan = Common.getSframeChannel();
var messenger = Messenger.create(sframeChan); var messenger = Messenger.create(sframeChan);
MessengerUI.create(messenger, $container, Common); MessengerUI.create(messenger, $container, Common, toolbar);
}; };
var createChat = function (toolbar, config) { var createChat = function (toolbar, config) {
if (!config.metadataMgr) { if (!config.metadataMgr) {
@@ -459,6 +459,7 @@ Messenger, MessengerUI, Messages) {
$content.show(); $content.show();
$button.addClass('cp-toolbar-button-active'); $button.addClass('cp-toolbar-button-active');
config.$contentContainer.addClass('cp-chat-visible'); config.$contentContainer.addClass('cp-chat-visible');
$button.removeClass('cp-toolbar-notification');
}; };
$closeIcon.click(function () { $closeIcon.click(function () {
Common.setAttribute(['toolbar', 'chat-drawer'], false); Common.setAttribute(['toolbar', 'chat-drawer'], false);

View File

@@ -40,7 +40,7 @@ define([
}; };
}; };
MessengerUI.create = function (messenger, $container, common) { MessengerUI.create = function (messenger, $container, common, toolbar) {
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
var origin = metadataMgr.getPrivateData().origin; var origin = metadataMgr.getPrivateData().origin;
@@ -96,8 +96,15 @@ define([
return $userlist.find(dataQuery(id)); return $userlist.find(dataQuery(id));
}; };
var notifyToolbar = function () {
if (!toolbar || !toolbar['chat']) { return; }
if (toolbar['chat'].find('button').hasClass('cp-toolbar-button-active')) { return; }
toolbar['chat'].find('button').addClass('cp-toolbar-notification');
};
var notify = function (id) { var notify = function (id) {
find.inList(id).addClass('cp-app-contacts-notify'); find.inList(id).addClass('cp-app-contacts-notify');
notifyToolbar();
}; };
var unnotify = function (id) { var unnotify = function (id) {
find.inList(id).removeClass('cp-app-contacts-notify'); find.inList(id).removeClass('cp-app-contacts-notify');