diff --git a/index.html b/index.html index 578651b..bdb9efe 100644 --- a/index.html +++ b/index.html @@ -100,7 +100,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
  • - + {{ content.shortName }}{{ content.fullName }} diff --git a/js/models.js b/js/models.js index bbac9e6..42e46fa 100644 --- a/js/models.js +++ b/js/models.js @@ -16,10 +16,10 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) { var number = message['number'] var pointer = message['pointers'][0] var lines = [] - var active = false; - var notification = ''; - var unread = ''; - var lastSeen = -2; + var active = false + var notification = 0 + var unread = 0 + var lastSeen = -2 /* * Adds a line to this buffer @@ -30,7 +30,7 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) { var addLine = function(line) { lines.push(line); } - + return { id: pointer, fullName: fullName, @@ -40,6 +40,8 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) { lines: lines, addLine: addLine, lastSeen: lastSeen, + unread: unread, + notification: notification, } } @@ -100,6 +102,8 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) { var BufferList = [] activeBuffer = null; + unreads = 0; + notifications = 0; this.model = { 'buffers': {} } diff --git a/js/websockets.js b/js/websockets.js index ec10555..3bb68cd 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -200,20 +200,12 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'plugins', functi if (!initial) { if (!buffer.active && _.contains(message.tags, 'notify_message') && !_.contains(message.tags, 'notify_none')) { - if (buffer.unread == '' || buffer.unread == undefined) { - buffer.unread = 1; - }else { - buffer.unread++; - } + buffer.unread++; } if(message.highlight || _.contains(message.tags, 'notify_private') ) { + buffer.notification++; $rootScope.createHighlight(buffer, message); - if (buffer.notification == '' || buffer.notification == undefined) { - buffer.notification = 1; - }else { - buffer.notification++; - } } } } @@ -523,10 +515,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // Find next buffer with activity and switch to it for(i in $scope.buffers) { var buffer = $scope.buffers[i]; - if((parseInt(buffer.notification) || 0) > 0) { + if(buffer.notification > 0) { $scope.setActiveBuffer(buffer.id); break; - }else if((parseInt(buffer.unread) || 0) > 0) { + }else if(buffer.unread > 0) { $scope.setActiveBuffer(buffer.id); break; }