diff options
author | 2023-05-27 04:04:42 +0300 | |
---|---|---|
committer | 2023-05-27 06:50:49 +0530 | |
commit | 4fc05450495d7d70fabf271c86d97a98e8a8e498 (patch) | |
tree | f65c849f106c3e6f8b7f40a69b2770e600355407 /recipes/schildichat/webview.js | |
parent | add vaclavhodek as a contributor for code (#376) [skip ci] (diff) | |
download | ferdium-recipes-4fc05450495d7d70fabf271c86d97a98e8a8e498.tar.gz ferdium-recipes-4fc05450495d7d70fabf271c86d97a98e8a8e498.tar.zst ferdium-recipes-4fc05450495d7d70fabf271c86d97a98e8a8e498.zip |
Add SchildiChat recipe (#374)
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 | }; | ||