Merge pull request #1104 from lorenzhs/toast_addmention
Show a toast when clicking nick of a user who left
This commit is contained in:
commit
98977a3fae
@ -708,6 +708,30 @@ img.emojione {
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
position: fixed;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 50px;
|
||||||
|
width: 250px;
|
||||||
|
margin-left: -125px;
|
||||||
|
|
||||||
|
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;
|
||||||
|
@ -423,6 +423,10 @@ button.close:hover {
|
|||||||
color: var(--base01);
|
color: var(--base01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
background-color: var(--base01);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* Weechat colors and style */
|
/* Weechat colors and style */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
@ -134,6 +134,13 @@ input[type=text], input[type=password], #sendMessage, .badge, .btn-send, .btn-se
|
|||||||
border: 1px solid #363943;
|
border: 1px solid #363943;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
background-color: #283244;
|
||||||
|
border: 1px solid;
|
||||||
|
border-color: rgb(29, 94, 152);
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.horizontal-line {
|
.horizontal-line {
|
||||||
-webkit-box-shadow: rgba(255, 255, 255, 0.07) 0 1px 0;
|
-webkit-box-shadow: rgba(255, 255, 255, 0.07) 0 1px 0;
|
||||||
-moz-box-shadow: rgba(255, 255, 255, 0.07) 0 1px 0;
|
-moz-box-shadow: rgba(255, 255, 255, 0.07) 0 1px 0;
|
||||||
|
@ -2126,6 +2126,10 @@ code {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
background-color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Mobile layout */
|
/* Mobile layout */
|
||||||
/* */
|
/* */
|
||||||
|
@ -2092,6 +2092,10 @@ input[type=text].is-invalid{
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toast {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Mobile layout */
|
/* Mobile layout */
|
||||||
/* */
|
/* */
|
||||||
|
@ -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