diff options
author | 2023-04-27 23:58:21 +0200 | |
---|---|---|
committer | 2023-04-27 22:58:21 +0100 | |
commit | cea769dbe833d1a8757c8017940e59f6a4e578b5 (patch) | |
tree | 8acc6682eb8a3b8a5a29264384503b088950b950 /recipes/instagram-direct-messages/webview.js | |
parent | Fix URL in Amazon WorkMail (#344) (diff) | |
download | ferdium-recipes-cea769dbe833d1a8757c8017940e59f6a4e578b5.tar.gz ferdium-recipes-cea769dbe833d1a8757c8017940e59f6a4e578b5.tar.zst ferdium-recipes-cea769dbe833d1a8757c8017940e59f6a4e578b5.zip |
Fix Instagram Direct Messages count (#345)
Diffstat (limited to 'recipes/instagram-direct-messages/webview.js')
-rw-r--r-- | recipes/instagram-direct-messages/webview.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/recipes/instagram-direct-messages/webview.js b/recipes/instagram-direct-messages/webview.js index b59b9f2..290f596 100644 --- a/recipes/instagram-direct-messages/webview.js +++ b/recipes/instagram-direct-messages/webview.js | |||
@@ -14,12 +14,8 @@ setInterval(() => { | |||
14 | 14 | ||
15 | module.exports = (Ferdium) => { | 15 | module.exports = (Ferdium) => { |
16 | const getMessages = () => { | 16 | const getMessages = () => { |
17 | let count = 0; | 17 | const element = document.querySelector('a[href^="/direct/inbox"]'); |
18 | const elements = document.querySelectorAll('.rBNOH.soMvl'); | 18 | Ferdium.setBadge(element ? Ferdium.safeParseInt(element.textContent.match(/\d+/)[0]) : 0); |
19 | if (elements.length > 0) { | ||
20 | count += 1; | ||
21 | } | ||
22 | Ferdium.setBadge(count); | ||
23 | }; | 19 | }; |
24 | 20 | ||
25 | Ferdium.loop(getMessages); | 21 | Ferdium.loop(getMessages); |