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

function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}

module.exports = Ferdi => {
  const getMessages = () => {
    let count = 0;
    const element = document.querySelector(
      '.dashboard-top-panel .indicators .stats-group .cell-value',
    );
    if (element) {
      count = Ferdi.safeParseInt(element.textContent);
    }

    Ferdi.setBadge(count);
  };

  Ferdi.loop(getMessages);

  Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
};