Show a toast when clicking nick of a user who left
This commit is contained in:
parent
cdfc5181e4
commit
afcc264f99
@ -708,6 +708,31 @@ img.emojione {
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
position: fixed;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 50px;
|
||||||
|
width: 250px;
|
||||||
|
margin-left: -125px;
|
||||||
|
|
||||||
|
background-color: #333;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
z-index: 100;
|
||||||
|
animation: fadein 0.5s, fadeout 0.5s 4.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadein {
|
||||||
|
from { bottom: 0; opacity: 0; }
|
||||||
|
to { bottom: 50px; opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeout {
|
||||||
|
from { bottom: 50px; opacity: 1; }
|
||||||
|
to { bottom: 0; opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
.glyphicon-spin {
|
.glyphicon-spin {
|
||||||
-webkit-animation: spin 1000ms infinite linear;
|
-webkit-animation: spin 1000ms infinite linear;
|
||||||
animation: spin 1000ms infinite linear;
|
animation: spin 1000ms infinite linear;
|
||||||
|
@ -217,6 +217,18 @@ weechat.directive('inputBar', function() {
|
|||||||
// Extract nick from bufferline prefix
|
// Extract nick from bufferline prefix
|
||||||
var nick = prefix[prefix.length - 1].text;
|
var nick = prefix[prefix.length - 1].text;
|
||||||
|
|
||||||
|
// Check whether the user is still online
|
||||||
|
var buffer = models.getBuffer(bufferline.buffer);
|
||||||
|
var is_online = buffer.queryNicklist(nick);
|
||||||
|
if (!is_online) {
|
||||||
|
// show a toast that the user left
|
||||||
|
var toast = document.createElement('div');
|
||||||
|
toast.id = "toast";
|
||||||
|
toast.innerHTML = nick + " has left the room";
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
setTimeout(function() { document.body.removeChild(toast); }, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
var newValue = $scope.command || ''; // can be undefined, in that case, use the empty string
|
var newValue = $scope.command || ''; // can be undefined, in that case, use the empty string
|
||||||
var addColon = newValue.length === 0;
|
var addColon = newValue.length === 0;
|
||||||
if (newValue.length > 0) {
|
if (newValue.length > 0) {
|
||||||
|
14
js/models.js
14
js/models.js
@ -308,6 +308,19 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
|
|||||||
return nicklist.hasOwnProperty('root');
|
return nicklist.hasOwnProperty('root');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check whether a particular nick is in the nicklist
|
||||||
|
var queryNicklist = function(nick) {
|
||||||
|
for (var groupIdx in nicklist) {
|
||||||
|
var nicks = nicklist[groupIdx].nicks;
|
||||||
|
for (var nickIdx in nicks) {
|
||||||
|
if (nicks[nickIdx].name === nick) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
/* Clear all our buffer lines */
|
/* Clear all our buffer lines */
|
||||||
var clear = function() {
|
var clear = function() {
|
||||||
while(lines.length > 0) {
|
while(lines.length > 0) {
|
||||||
@ -353,6 +366,7 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
|
|||||||
isNicklistEmpty: isNicklistEmpty,
|
isNicklistEmpty: isNicklistEmpty,
|
||||||
nicklistRequested: nicklistRequested,
|
nicklistRequested: nicklistRequested,
|
||||||
pinned: pinned,
|
pinned: pinned,
|
||||||
|
queryNicklist: queryNicklist,
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user