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

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

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

    Ferdium.setBadge(direct);
  };

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