aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/guilded/webview.js
blob: 72a49b4b53a497079b1305e72cd90a5d5456f4fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = Franz => {
  const getMessages = function getMessages() {
    let unread = 0;
    const notificationBadge = document.getElementsByClassName('NavSelectorItem-unread-badge')[0];
    if (notificationBadge != undefined) {
      const innerBadge = notificationBadge.getElementsByClassName('BadgeV2-count')[0];
      unread = innerBadge.innerText;
    }
    Franz.setBadge(parseInt(unread, 10));
  };

  Franz.loop(getMessages);
};