aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/notion/webview.js
blob: 8ef9ff2c0e01c971389edef1326560f21c0e8bac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module.exports = (Ferdi) => {
  function getMessages() {
    let direct = 0;
    const indirect = 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 = parseInt(badgeDiv.innerText);
    }

    Ferdi.setBadge(direct, indirect);
  }

  Ferdi.loop(getMessages);
};