Skip to content

Commit

Permalink
Fix unread count
Browse files Browse the repository at this point in the history
Change queryselector to fix unread count
  • Loading branch information
DelK committed Dec 9, 2024
1 parent f1b2809 commit 19c67d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion recipes/office365-owa/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "office365-owa",
"name": "Office 365 Outlook",
"version": "1.7.3",
"version": "1.7.4",
"license": "MIT",
"aliases": [
"live.com",
Expand Down
10 changes: 5 additions & 5 deletions recipes/office365-owa/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ function _interopRequireDefault(obj) {
const _path = _interopRequireDefault(require('path'));

module.exports = (Ferdium, settings) => {
const collectCounts = selector => {
const collectCounts = (selector, index=0) => {
let unreadCount = 0;
const foldersElement = document.querySelector(selector);
const foldersElement = document.querySelectorAll(selector)[index];
if (foldersElement) {
const allScreenReaders = foldersElement.querySelectorAll(
'span.screenReaderOnly',
'div[role=treeitem] > span:last-child span.screenReaderOnly'
);
for (const child of allScreenReaders) {
if (child.previousSibling) {
Expand All @@ -36,8 +36,8 @@ module.exports = (Ferdium, settings) => {
// new app
directUnreadCount =
settings.onlyShowFavoritesInUnreadCount === true
? collectCounts('div[role=tree]:nth-child(2)')
: collectCounts('div[role=tree]:nth-child(1)');
? collectCounts('div[role=tree]', 0)
: collectCounts('div[role=tree]', 1);

indirectUnreadCount = collectCounts('div[role=tree]:nth-child(4)'); // groups
}
Expand Down

0 comments on commit 19c67d0

Please sign in to comment.