aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/notion/webview.js
blob: aa8eaec18a129dde5885f80c848266dc5a276a9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = (Ferdi) => {
  function getMessages() {
    let direct = 0;
    const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div');
    if (badgeDiv) {
      direct = Ferdi.safeParseInt(badgeDiv.innerText);
    }

    Ferdi.setBadge(direct);
  }

  Ferdi.loop(getMessages);
};