aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/plurk/webview.js
blob: 09f15dae774618c9d8aa37f005bd2183fdcb6e56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module.exports = Ferdi => {
  const getMessages = () => {
    let direct = 0;

    const np = document.querySelector('#noti_np_count');
    const re = document.querySelector('#noti_re_count');

    if (np) {
      direct += Ferdi.safeParseInt(np.textContent);
    }
    if (re) {
      direct += Ferdi.safeParseInt(re.textContent);
    }

    Ferdi.setBadge(direct);
  };

  Ferdi.loop(getMessages, 10_000);
};