mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
looks better without disconnect alert
This commit is contained in:
@@ -38,27 +38,21 @@ var socket,
|
|||||||
|
|
||||||
socket.on('connect', function(data){
|
socket.on('connect', function(data){
|
||||||
if(reconnecting) {
|
if(reconnecting) {
|
||||||
|
setTimeout(function(){
|
||||||
app.alert({
|
app.alert({
|
||||||
alert_id: 'connection_alert',
|
alert_id: 'connection_alert',
|
||||||
title: 'Connected',
|
title: 'Connected',
|
||||||
message: 'Connection successful',
|
message: 'Connection successful.',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
});
|
});
|
||||||
|
}, 1000);
|
||||||
reconnecting = false;
|
reconnecting = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('disconnect', function(data){
|
socket.on('disconnect', function(data){
|
||||||
setTimeout(function() {
|
|
||||||
app.alert({
|
|
||||||
alert_id: 'connection_alert',
|
|
||||||
title: 'Disconnect',
|
|
||||||
message: 'You have disconnected from NodeBB, we will try to reconnect!',
|
|
||||||
type: 'error',
|
|
||||||
timeout: 5000
|
|
||||||
});
|
|
||||||
}, 500);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('reconnecting', function(data) {
|
socket.on('reconnecting', function(data) {
|
||||||
|
|||||||
@@ -125,8 +125,10 @@
|
|||||||
});
|
});
|
||||||
socket.on('api:notifications.counts', function(counts) {
|
socket.on('api:notifications.counts', function(counts) {
|
||||||
var notifIcon = document.querySelector('.notifications a i');
|
var notifIcon = document.querySelector('.notifications a i');
|
||||||
|
if(notifIcon) {
|
||||||
if (counts.unread > 0) notifIcon.className = 'icon-circle active';
|
if (counts.unread > 0) notifIcon.className = 'icon-circle active';
|
||||||
else notifIcon.className = 'icon-circle-blank';
|
else notifIcon.className = 'icon-circle-blank';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
socket.on('event:new_notification', function() {
|
socket.on('event:new_notification', function() {
|
||||||
console.log('WOOT');
|
console.log('WOOT');
|
||||||
|
|||||||
Reference in New Issue
Block a user