|
|
@ -141,19 +141,31 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu |
|
|
|
bgColor: '#d00', |
|
|
|
bgColor: '#d00', |
|
|
|
textColor: '#fff' |
|
|
|
textColor: '#fff' |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
updateBadge(notifications); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var unread = unreadCount('unread'); |
|
|
|
var unread = unreadCount('unread'); |
|
|
|
if (unread === 0) { |
|
|
|
if (unread === 0) { |
|
|
|
$rootScope.favico.reset(); |
|
|
|
$rootScope.favico.reset(); |
|
|
|
|
|
|
|
updateBadge(''); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$rootScope.favico.badge(unread, { |
|
|
|
$rootScope.favico.badge(unread, { |
|
|
|
bgColor: '#5CB85C', |
|
|
|
bgColor: '#5CB85C', |
|
|
|
textColor: '#ff0' |
|
|
|
textColor: '#ff0' |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
updateBadge("."); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var updateBadge = function(value) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get ipc
|
|
|
|
|
|
|
|
if (typeof setElectronBadge === 'function') { |
|
|
|
|
|
|
|
setElectronBadge(value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* Function gets called from bufferLineAdded code if user should be notified */ |
|
|
|
/* Function gets called from bufferLineAdded code if user should be notified */ |
|
|
|
var createHighlight = function(buffer, message) { |
|
|
|
var createHighlight = function(buffer, message) { |
|
|
|
var title = ''; |
|
|
|
var title = ''; |
|
|
@ -204,6 +216,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu |
|
|
|
requestNotificationPermission: requestNotificationPermission, |
|
|
|
requestNotificationPermission: requestNotificationPermission, |
|
|
|
updateTitle: updateTitle, |
|
|
|
updateTitle: updateTitle, |
|
|
|
updateFavico: updateFavico, |
|
|
|
updateFavico: updateFavico, |
|
|
|
|
|
|
|
updateBadge: updateBadge, |
|
|
|
createHighlight: createHighlight, |
|
|
|
createHighlight: createHighlight, |
|
|
|
cancelAll: cancelAll, |
|
|
|
cancelAll: cancelAll, |
|
|
|
unreadCount: unreadCount |
|
|
|
unreadCount: unreadCount |
|
|
|