aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/fastmail/webview.js
blob: df39728943129ede8957dcb1be7777cf4ce90da6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

const path = require('path');

module.exports = (Franz) => {
  const getMessages = () => {
    const inbox = document.querySelector(".v-MailboxSource--inbox .v-MailboxSource-badge");
    if (!inbox) {
      return;
    }
    const messages = Number(inbox.innerText);
    if (!Number.isNaN(messages)) {
      Franz.setBadge(messages);
    }
  };

  Franz.injectJSUnsafe(path.join(__dirname, 'webview-unsafe.js'));
  Franz.loop(getMessages);
};