Commit 1294d682 authored by JC Brand's avatar JC Brand

Automatically remove leave/enter and enter/leave messages

after 10 seconds.
parent 4b5b5173
...@@ -320,6 +320,15 @@ body.reset { ...@@ -320,6 +320,15 @@ body.reset {
100% { opacity: 1 } 100% { opacity: 1 }
} }
@-webkit-keyframes fadeOut {
0% { opacity: 1; visibility: visible; }
100% { opacity: 0; visibility: hidden; }
}
@keyframes fadeOut {
0% { opacity: 1; visibility: visible; }
100% { opacity: 0; visibility: hidden; }
}
.fade-in { .fade-in {
@include fade-in; @include fade-in;
} }
...@@ -336,6 +345,14 @@ body.reset { ...@@ -336,6 +345,14 @@ body.reset {
opacity: 0 !important; opacity: 0 !important;
display: none !important; display: none !important;
} }
.fade-out {
animation-duration: 1s;
animation-fill-mode: forwards;
animation-name: fadeOut;
animation-timing-function: ease-in-out;
}
.collapsed { .collapsed {
height: 0 !important; height: 0 !important;
overflow: hidden !important; overflow: hidden !important;
......
...@@ -1441,12 +1441,13 @@ ...@@ -1441,12 +1441,13 @@
if (this.model.get('connection_status') !== converse.ROOMSTATUS.ENTERED) { if (this.model.get('connection_status') !== converse.ROOMSTATUS.ENTERED) {
return; return;
} }
const nick = occupant.get('nick'); const nick = occupant.get('nick'),
const stat = occupant.get('status'); stat = occupant.get('status');
const last_el = this.content.lastElementChild; let last_el = this.content.lastElementChild;
if (_.includes(_.get(last_el, 'classList', []), 'chat-info') && if (_.includes(_.get(last_el, 'classList', []), 'chat-info') &&
_.get(last_el, 'dataset', {}).leave === `"${nick}"`) { _.get(last_el, 'dataset', {}).leave === `"${nick}"`) {
last_el.outerHTML = last_el.outerHTML =
tpl_info({ tpl_info({
'data': `data-leavejoin="${nick}"`, 'data': `data-leavejoin="${nick}"`,
...@@ -1454,6 +1455,9 @@ ...@@ -1454,6 +1455,9 @@
'extra_classes': 'chat-event', 'extra_classes': 'chat-event',
'message': __('%1$s has left and re-entered the groupchat', nick) 'message': __('%1$s has left and re-entered the groupchat', nick)
}); });
last_el = this.content.lastElementChild;
setTimeout(() => u.addClass('fade-out', last_el), 10000);
setTimeout(() => last_el.parentElement.removeChild(last_el), 11500);
} else { } else {
let message; let message;
if (_.isNil(stat)) { if (_.isNil(stat)) {
...@@ -1482,8 +1486,8 @@ ...@@ -1482,8 +1486,8 @@
showLeaveNotification (occupant) { showLeaveNotification (occupant) {
const nick = occupant.get('nick'), const nick = occupant.get('nick'),
stat = occupant.get('status'), stat = occupant.get('status');
last_el = this.content.lastElementChild; let last_el = this.content.lastElementChild;
if (last_el && if (last_el &&
_.includes(_.get(last_el, 'classList', []), 'chat-info') && _.includes(_.get(last_el, 'classList', []), 'chat-info') &&
...@@ -1503,6 +1507,9 @@ ...@@ -1503,6 +1507,9 @@
'extra_classes': 'chat-event', 'extra_classes': 'chat-event',
'message': message 'message': message
}); });
last_el = this.content.lastElementChild;
setTimeout(() => u.addClass('fade-out', last_el), 10000);
setTimeout(() => last_el.parentElement.removeChild(last_el), 11500);
} else { } else {
let message; let message;
if (_.isNil(stat)) { if (_.isNil(stat)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment