diff options
author | 2021-02-03 03:48:59 +0700 | |
---|---|---|
committer | 2021-02-02 21:48:59 +0100 | |
commit | d5f13d314fd47ed2a0d061a422b566cd90b7ae08 (patch) | |
tree | 824196fe1fde4edcbd8a0afba815ddf8a9af61d3 /recipes/bip/webview.js | |
parent | Remove invalid file (#424) (diff) | |
download | ferdium-recipes-d5f13d314fd47ed2a0d061a422b566cd90b7ae08.tar.gz ferdium-recipes-d5f13d314fd47ed2a0d061a422b566cd90b7ae08.tar.zst ferdium-recipes-d5f13d314fd47ed2a0d061a422b566cd90b7ae08.zip |
Add recipe for BiP (#429)
Diffstat (limited to 'recipes/bip/webview.js')
-rw-r--r-- | recipes/bip/webview.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/recipes/bip/webview.js b/recipes/bip/webview.js new file mode 100644 index 0000000..d242716 --- /dev/null +++ b/recipes/bip/webview.js | |||
@@ -0,0 +1,22 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | var _path = _interopRequireDefault(require("path")); | ||
4 | |||
5 | function _interopRequireDefault(obj) { | ||
6 | return obj && obj.__esModule ? obj : {default: obj}; | ||
7 | } | ||
8 | |||
9 | module.exports = Ferdi => { | ||
10 | const getMessages = function getMessages() { | ||
11 | var elements = document.querySelectorAll(".contact-list__message__unread-badge-counter"); | ||
12 | var count = 0; | ||
13 | for (var i = 0; i < elements.length; i++) { | ||
14 | var countValue = parseInt(elements[i].textContent || '0', 10); | ||
15 | count += countValue; | ||
16 | } | ||
17 | Ferdi.setBadge(count, 0); | ||
18 | }; | ||
19 | |||
20 | Ferdi.loop(getMessages); | ||
21 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
22 | }; | ||