aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/fastmail/webview.js
blob: 782963b214fe84e20012346a4daa95b0faa6f9aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const _path = _interopRequireDefault(require('path'));

function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}

module.exports = Ferdi => {
  const getMessages = () => {
    const inbox = document.querySelector(
      '.v-MailboxSource--inbox .v-MailboxSource-badge',
    );
    if (!inbox) {
      return;
    }
    const messages = Ferdi.safeParseInt(inbox.textContent);
    Ferdi.setBadge(messages);
  };

  Ferdi.loop(getMessages);

  Ferdi.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js'));
};