aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/notion/webview.js
blob: b209e756f78f7bf4f3f095f063ff10105c49d67a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module.exports = Ferdi => {
  const 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.textContent);
    }

    Ferdi.setBadge(direct);
  };

  Ferdi.loop(getMessages);
};