aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/webex-teams/webview.js
blob: 8a748e89db28766ad30c2d1d2c9119dbb14e7207 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module.exports = Ferdi => {
  const getMessages = () => {
    let count = 0;

    let span = document.querySelectorAll('.navigation-list-item--badgeCount');

    if (span.length === 0) {
      span = document.querySelectorAll(
        '.navigation-list-item--badgeCount-minimized',
      );
    }

    if (span.length > 0) {
      count = Ferdi.safeParseInt(span[0].textContent);
    }

    Ferdi.setBadge(count);
  };

  Ferdi.loop(getMessages);
};