aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/feedly/webview.js
blob: 4e5a5c83d8386da3ea2eaf62eca639c1c770f4f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module.exports = Ferdi => {
  getMessages = () => {
    const newsDOM = document.querySelectorAll("div[title='All'] > .LeftnavListRow__count")[0].innerHTML;
    let counter = parseInt(newsDOM);

    if (newsDOM.indexOf('K') !== -1 || newsDOM.indexOf('+') !== -1) {
      counter = `${newsDOM.substring(0, newsDOM.indexOf('K'))}000`;
    }

    Ferdi.setBadge(counter);
  };

  Ferdi.loop(getMessages);
};