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

module.exports = Franz => {
  const getMessages = function getMessages() {
    const { title } = document;
    const regex = /\d+/;

    if (regex.test(title)) {
      Franz.setBadge(
        Number(regex.exec(title)[0])
      );
    } else {
      Franz.setBadge(0);
    }
  };

  Franz.loop(getMessages);
};