aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/plurk/webview.js
blob: c79853d2f1c8b0f6f16fd79cbc0b8cc7b29c2422 (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.innerHTML);
    }
    if (re) {
      direct += Ferdi.safeParseInt(re.innerHTML);
    }

    Ferdi.setBadge(direct);
  }

  Ferdi.loop(getMessages, 10000);
};