diff options
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 | ||