diff options
author | 2022-08-26 23:09:00 -0400 | |
---|---|---|
committer | 2022-08-27 03:09:00 +0000 | |
commit | 8735813856440acb982db4fb1303e44a443c4298 (patch) | |
tree | 4c2c3ef1380849ee82951d4c8093cb92b3d843db /recipes/mailfence/webview.js | |
parent | fix: add warning to whatsapp theming (#138) (diff) | |
download | ferdium-recipes-8735813856440acb982db4fb1303e44a443c4298.tar.gz ferdium-recipes-8735813856440acb982db4fb1303e44a443c4298.tar.zst ferdium-recipes-8735813856440acb982db4fb1303e44a443c4298.zip |
Added Mailfence recipe. (#160)
Diffstat (limited to 'recipes/mailfence/webview.js')
-rw-r--r-- | recipes/mailfence/webview.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/recipes/mailfence/webview.js b/recipes/mailfence/webview.js new file mode 100644 index 0000000..309f4e8 --- /dev/null +++ b/recipes/mailfence/webview.js | |||
@@ -0,0 +1,27 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) | ||
4 | { | ||
5 | return obj && obj.__esModule ? obj : | ||
6 | { | ||
7 | default: obj | ||
8 | }; | ||
9 | } | ||
10 | |||
11 | module.exports = Ferdium => | ||
12 | { | ||
13 | const getMessages = () => | ||
14 | { | ||
15 | let unreadCount = 0; | ||
16 | for (const counterElement of document.querySelectorAll('.GCSDBRWBMXB')) | ||
17 | { | ||
18 | const unreadCounter = Ferdium.safeParseInt(counterElement.textContent); | ||
19 | unreadCount = Math.max(unreadCount, unreadCounter); | ||
20 | } | ||
21 | |||
22 | Ferdium.setBadge(unreadCount); | ||
23 | }; | ||
24 | Ferdium.loop(getMessages); | ||
25 | |||
26 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
27 | }; \ No newline at end of file | ||