aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/slite/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/slite/webview.js')
-rw-r--r--recipes/slite/webview.js24
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
3var _path = _interopRequireDefault(require("path"));
4
5function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
7module.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};