-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8e5512
commit 44d1197
Showing
2 changed files
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
// wait for Ferdium and Zoho Mail to initialize | ||
if ( | ||
Object.prototype.hasOwnProperty.call(window, 'ferdium') && | ||
Object.prototype.hasOwnProperty.call(window.ferdium, 'setBadge') && | ||
Object.prototype.hasOwnProperty.call(window, 'zmNCenter') && | ||
Object.prototype.hasOwnProperty.call(window, 'zmfolAction') | ||
) { | ||
const unreadNotifications = window.zmNCenter.counter.count(); // General Notifications by Zoho (Bell Icon) | ||
const unreadMail = window.zmfolAction.getUnreadViewCount(); // Unread messages count | ||
|
||
window.ferdium.setBadge(unreadMail, unreadNotifications); | ||
// Wait for Ferdium to initialize | ||
if (window.ferdium?.setBadge !== undefined) { | ||
window.ferdium.setBadge( | ||
window.ferdium.safeParseInt(window.zmfolAction?.getUnreadViewCount()) + | ||
window.ferdium.safeParseInt( | ||
document.querySelector('#wms_menu_unreadchats_cnt')?.textContent, | ||
), | ||
window.ferdium.safeParseInt( | ||
window.zmTopBar?.topBandElements()?.notification?.children | ||
?.notificationBadge?.textContent, | ||
), | ||
); | ||
} |