aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/fastmail/webview.js
blob: 42883e871947648af70859607058b34c3418cc41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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.innerText);
    Ferdi.setBadge(messages);
  };

  Ferdi.loop(getMessages);

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