diff options
Diffstat (limited to 'recipes/schildichat/webview.js')
-rw-r--r-- | recipes/schildichat/webview.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/recipes/schildichat/webview.js b/recipes/schildichat/webview.js new file mode 100644 index 0000000..bd7eef8 --- /dev/null +++ b/recipes/schildichat/webview.js | |||
@@ -0,0 +1,14 @@ | |||
1 | module.exports = Ferdium => { | ||
2 | function getMessages() { | ||
3 | const directMatches = document.querySelector('title').textContent | ||
4 | .match('(?<=\\[)\\d+(?=])'); | ||
5 | Ferdium.setBadge( | ||
6 | Ferdium.safeParseInt(directMatches !== null ? directMatches[0] : 0), | ||
7 | document.querySelector('.mx_SpaceTreeLevel') | ||
8 | .querySelectorAll('.mx_NotificationBadge_dot') | ||
9 | .length | ||
10 | ); | ||
11 | } | ||
12 | |||
13 | Ferdium.loop(getMessages); | ||
14 | }; | ||