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

module.exports = (Franz, options) => {
  const getMessages = () => {
    const inbox = document.querySelector('.topbar-notificationsButton.has-newNotifications');
    const passiveCount = inbox === null ? 0 : 1;
    // set Franz badge
    // updates => active unread count
    // inbox => passive unread count
    Franz.setBadge(0, passiveCount);
  };

  // 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);
};