From 54bb156f016cdceb359b42a37ae71a23c7762d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 13 Mar 2014 20:33:46 +0000 Subject: [PATCH] Add notification count to notifications --- js/glowingbear.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 26990f0..320fe44 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -929,11 +929,21 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.createHighlight = function(buffer, message) { var title = ''; var body = ''; + var numNotifications = buffer.notification; + if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) { - title = 'Private message from '; + if (numNotifications > 1) { + title = numNotifications.toString() + ' private messages from '; + } else { + title = 'Private message from '; + } body = message.text; } else { - title = 'Highlight in '; + if (numNotifications > 1) { + title = numNotifications.toString() + ' highlights in '; + } else { + title = 'Highlight in '; + } var prefix = ''; for (var i = 0; i < message.prefix.length; i++) { prefix += message.prefix[i].text;