aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/proton-mail/webview.js
blob: 3d8a30e6638786a29c0685b13f42730036fc6ed9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module.exports = Franz => {
    function getMessages() {
        const element = document.querySelector('.navigationItem-counter')
        if (!element) {
            return
        }
        const text = element.innerText
        const count = Number(text.substring(1, text.length - 1))
        if (Number.isNaN(count)) {
            return
        }
        Franz.setBadge(count)
    }

    Franz.loop(getMessages)
}