aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/odysee/webview.js
blob: f51fb7b72b98c796b05838e8f6c00bfd7a767480 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}

const _path = _interopRequireDefault(require('path'));

module.exports = Ferdium => {
  function getNotifications() {
    let unreadNotifications = 0;
    for (const notificationCounterElement of document.querySelectorAll(
      '.notification__count',
    )) {
      unreadNotifications += Ferdium.safeParseInt(
        notificationCounterElement.textContent,
      );
    }

    Ferdium.setBadge(unreadNotifications);
  }
  Ferdium.loop(getNotifications);

  Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};