More proper unread messages detection.
This commit is contained in:
parent
9be3323859
commit
c8349a314f
13
renderer.js
13
renderer.js
@ -6,8 +6,17 @@ const { shell } = require('electron')
|
|||||||
|
|
||||||
// Unread mails check.
|
// Unread mails check.
|
||||||
function checkForUnreads() {
|
function checkForUnreads() {
|
||||||
unread = parseInt(document.title.split(' ')[0]);
|
//var unread = parseInt($(".mail-MessagesFilters-Item_unread .mail-LabelList-Item_count").html());
|
||||||
if (typeof (unread) != NaN && unread > 0) {
|
var unread = 0;
|
||||||
|
items = document.getElementsByClassName('mail-LabelList-Item_count');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var unreadInt = parseInt(items[i].innerHTML);
|
||||||
|
if (typeof (unreadInt) != NaN && unreadInt > 0) {
|
||||||
|
unread += unreadInt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unread > 0) {
|
||||||
ipc.send('has-unread', unread);
|
ipc.send('has-unread', unread);
|
||||||
} else {
|
} else {
|
||||||
ipc.send('has-no-unread');
|
ipc.send('has-no-unread');
|
||||||
|
Reference in New Issue
Block a user