aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/good-reads/webview.js
blob: c1eabf8bd8101f906e3a2f82cef4238555588f12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = (Ferdi) => {
  const getMessages = () => {
    const notificationBadge = document.querySelector(
      ".siteHeader__topLevelItem--profileIcon .headerPersonalNav .modalTrigger .headerPersonalNav__icon .headerPersonalNav__flag"
    );
    let notification = notificationBadge
      ? Ferdi.safeParseInt(notificationBadge.textContent)
      : 0;

    Ferdi.setBadge(notification);
  };
  Ferdi.loop(getMessages);
};