diff options
author | Francisco Marques <franciscopcmarques@gmail.com> | 2020-10-07 15:24:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-07 15:24:54 +0100 |
commit | 00ddef3290732403dc1ca02b1c2ae7a7b6a796c3 (patch) | |
tree | 9867bd95de83aa825a76f145409c9929ae265a2c /recipes/slite/webview.js | |
parent | Add recipe for Lark (#315) (diff) | |
download | ferdium-recipes-00ddef3290732403dc1ca02b1c2ae7a7b6a796c3.tar.gz ferdium-recipes-00ddef3290732403dc1ca02b1c2ae7a7b6a796c3.tar.zst ferdium-recipes-00ddef3290732403dc1ca02b1c2ae7a7b6a796c3.zip |
Add recipe for Slite (#312)
Diffstat (limited to 'recipes/slite/webview.js')
-rw-r--r-- | recipes/slite/webview.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/recipes/slite/webview.js b/recipes/slite/webview.js new file mode 100644 index 0000000..6e0fa46 --- /dev/null +++ b/recipes/slite/webview.js | |||
@@ -0,0 +1,24 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | var _path = _interopRequireDefault(require("path")); | ||
4 | |||
5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
6 | |||
7 | module.exports = Ferdi => { | ||
8 | const getMessages = function getMessages() { | ||
9 | let direct = 0; | ||
10 | |||
11 | const notificationButton = document.querySelector( | ||
12 | "#app button[data-test-id='notificationsCount'" | ||
13 | ); | ||
14 | |||
15 | if (notificationButton) { | ||
16 | const notificationCount = parseInt(notificationButton.innerText); | ||
17 | direct = isNaN(notificationCount) ? 0 : notificationCount; | ||
18 | } | ||
19 | |||
20 | Ferdi.setBadge(direct); | ||
21 | }; | ||
22 | |||
23 | Ferdi.loop(getMessages); | ||
24 | }; | ||