aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/tweetdeck/webview.js
blob: 54b7997016217cfb6f9f06a781434a3b8779d3e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module.exports = Ferdi => {
  // Tweetdeck redirect fix
  Ferdi.ipcRenderer.on('redirect-url', (event, url) => {
    window.location.assign(url);
  });

  const getMessages = function getMessages() {
    const elements = document.querySelectorAll('.msg-unread-count');
    let count = 0;
    if (elements[0]) {
      count = Ferdi.safeParseInt(elements[0].innerHTML);
    }

    Ferdi.setBadge(count);
  };

  Ferdi.loop(getMessages);
};