Count for active channel only when window is not focused.

This commit is contained in:
mid0111
2016-01-14 22:24:35 +09:00
parent e53a43d17a
commit c5f9ca19ce

View File

@@ -13,12 +13,14 @@ var unreadCountTimer = setInterval(function() {
var unreadCount = document.getElementsByClassName('unread-title').length; var unreadCount = document.getElementsByClassName('unread-title').length;
// count for active channel // count for active channel
var newSeparators = document.getElementsByClassName('new-separator'); if(!electron.remote.getCurrentWindow().isFocused()) {
var newSeparators = document.getElementsByClassName('new-separator active');
for (var i = 0; i < newSeparators.length; i++) { for (var i = 0; i < newSeparators.length; i++) {
if (newSeparators[i].offsetParent !== null) { if (newSeparators[i].offsetParent !== null) {
unreadCount += 1; unreadCount += 1;
} }
} }
}
if (this.count != unreadCount) { if (this.count != unreadCount) {
ipc.sendToHost('onUnreadCountChange', unreadCount); ipc.sendToHost('onUnreadCountChange', unreadCount);