aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/sococo/webview.js
blob: 14561cd96db7957c459f6081ae53d5cb419804eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module.exports = (Ferdi) => {
  const getMessages = function 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);
};