aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/sococo/webview.js
blob: 4f7e045d7708abe85642ff4cd6bfd8430159a8d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module.exports = (Ferdi) => {
  const getMessages = () => {
    let indirect = document.querySelectorAll('.new-messages');
    let direct = 0;
    document.querySelectorAll('.people-pane .badge').forEach(function(badge){
      direct += Ferdi.safeParseInt(badge.innerText);
    });
    Ferdi.setBadge(direct, indirect);
  };

  Ferdi.loop(getMessages);
};