aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/bip/webview.js
blob: d24271608cff7325be85404567592fc30264d4a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use strict";

var _path = _interopRequireDefault(require("path"));

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

module.exports = Ferdi => {
    const getMessages = function getMessages() {
        var elements = document.querySelectorAll(".contact-list__message__unread-badge-counter");
        var count = 0;
        for (var i = 0; i < elements.length; i++) {
            var countValue = parseInt(elements[i].textContent || '0', 10);
            count += countValue;
        }
        Ferdi.setBadge(count, 0);
    };

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