aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/canvas/webview.js
blob: 070a9754bee782f551f411464776e025ac5119f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module.exports = Ferdi => {
  const getMessages = () => {
    let direct = 0;

    const MessageElement = document.querySelector(
      '[id=global_nav_conversations_link]',
    );
    if (MessageElement) {
      direct += Ferdi.safeParseInt(MessageElement.textContent);
    }

    Ferdi.setBadge(direct);
  };

  Ferdi.loop(getMessages);
};