aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/podio/webview.js
blob: b1ddc4f7051fd43d6a66977cdde5eaac56daf081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const path = require('path');

module.exports = (Franz, options) => {
  const getMessages = () => {
    // get unread messages
    const updates = document.getElementsByClassName('counter')[0].innerHTML;

    // get conversations in 'My Inbox'
    //const inbox = document.getElementById('franz').getAttribute('data-inbox');

    // set Franz badge
    // updates => active unread count
    // inbox => passive unread count
    Franz.setBadge(updates, 0);
  };

  // inject franz.css stylesheet
  Franz.injectCSS(path.join(__dirname, 'css', 'franz.css'));

  // check for new messages every second and update Franz badge
  Franz.loop(getMessages);
};