diff --git a/public/src/app.js b/public/src/app.js index 1f9d04c719..c04a423114 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -38,27 +38,21 @@ var socket, socket.on('connect', function(data){ if(reconnecting) { - app.alert({ - alert_id: 'connection_alert', - title: 'Connected', - message: 'Connection successful', - type: 'success', - timeout: 5000 - }); + setTimeout(function(){ + app.alert({ + alert_id: 'connection_alert', + title: 'Connected', + message: 'Connection successful.', + type: 'success', + timeout: 5000 + }); + }, 1000); reconnecting = false; } }); 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) { diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index 515f511a30..133771bda6 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -125,8 +125,10 @@ }); socket.on('api:notifications.counts', function(counts) { var notifIcon = document.querySelector('.notifications a i'); - if (counts.unread > 0) notifIcon.className = 'icon-circle active'; - else notifIcon.className = 'icon-circle-blank'; + if(notifIcon) { + if (counts.unread > 0) notifIcon.className = 'icon-circle active'; + else notifIcon.className = 'icon-circle-blank'; + } }); socket.on('event:new_notification', function() { console.log('WOOT');