diff options
author | Victor B <39555268+victorbnl@users.noreply.github.com> | 2023-07-20 01:32:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 05:02:47 +0530 |
commit | d028830bc9e474115973bdc79fbac150bce054aa (patch) | |
tree | aaffbe1d08aebb96d8b8f1128e47648ebc89794a /recipes/skiff-mail/webview.js | |
parent | Add Miro recipe (#392) (diff) | |
download | ferdium-recipes-d028830bc9e474115973bdc79fbac150bce054aa.tar.gz ferdium-recipes-d028830bc9e474115973bdc79fbac150bce054aa.tar.zst ferdium-recipes-d028830bc9e474115973bdc79fbac150bce054aa.zip |
Add Skiff Mail recipe (#391)
Diffstat (limited to 'recipes/skiff-mail/webview.js')
-rw-r--r-- | recipes/skiff-mail/webview.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/recipes/skiff-mail/webview.js b/recipes/skiff-mail/webview.js new file mode 100644 index 0000000..522b062 --- /dev/null +++ b/recipes/skiff-mail/webview.js | |||
@@ -0,0 +1,17 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | ||
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | const getMessages = () => { | ||
9 | const element = document.querySelector('div[href="/mail/inbox"]'); | ||
10 | const matches = element.textContent.match(/\d+/); | ||
11 | const unreadCount = Ferdium.safeParseInt(matches ? matches[0] : 0); | ||
12 | Ferdium.setBadge(unreadCount); | ||
13 | }; | ||
14 | Ferdium.loop(getMessages); | ||
15 | |||
16 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
17 | }; | ||