aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/infomaniak-mail/webview.js
blob: f4e39dc1280528d20ee6a5755ac3d8fef0c9218b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module.exports = Ferdi => {
  const getMessages = () => {
    const count = document.querySelector('.ws-tree-node-badge');
    if (count) {
      const countText = count.textContent;
      if (countText) {
        Ferdi.setBadge(
          // eslint-disable-next-line unicorn/prefer-string-slice
          count ? Number(countText.substring(1, countText.length - 1)) : 0,
        );
      }
    }
  };

  Ferdi.loop(getMessages);
};