diff options
author | 2021-09-12 07:46:49 +0530 | |
---|---|---|
committer | 2021-09-12 02:16:49 +0000 | |
commit | f22ee0b3fe5facaa37f4235daaffbb894e2cd314 (patch) | |
tree | 6ecc92f8815a5e999fbcec18df00446f54d74ab3 /recipes/mewe/webview.js | |
parent | New service: 'whereby' (#683) (diff) | |
download | ferdium-recipes-f22ee0b3fe5facaa37f4235daaffbb894e2cd314.tar.gz ferdium-recipes-f22ee0b3fe5facaa37f4235daaffbb894e2cd314.tar.zst ferdium-recipes-f22ee0b3fe5facaa37f4235daaffbb894e2cd314.zip |
Diffstat (limited to 'recipes/mewe/webview.js')
-rw-r--r-- | recipes/mewe/webview.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/recipes/mewe/webview.js b/recipes/mewe/webview.js new file mode 100644 index 0000000..a5b1806 --- /dev/null +++ b/recipes/mewe/webview.js | |||
@@ -0,0 +1,13 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | const calculateTotalDirectMessages = () => | ||
6 | Array.from(document.getElementsByClassName('chats-list-element')) | ||
7 | .map(el => Ferdi.safeParseInt(el.querySelector('.m-indicator .number').innerHTML)) | ||
8 | .reduce((curr, prev) => curr + prev, 0); | ||
9 | |||
10 | module.exports = Franz => { | ||
11 | Franz.loop(() => Franz.setBadge(calculateTotalDirectMessages())); | ||
12 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
13 | }; | ||