aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/bip/webview.js
blob: 8b9eccc6eb56b2f28f12b691bdae4b9a85fe0b9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module.exports = Ferdi => {
  const getMessages = () => {
    const elements = document.querySelectorAll('.contact-list__message__unread-badge-counter');
    let count = 0;
    for (const element of elements) {
      count += Ferdi.safeParseInt(element.textContent);
    }
    Ferdi.setBadge(count, 0);
  };

  Ferdi.loop(getMessages);
};