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