diff options
author | 2021-01-05 22:56:20 +0100 | |
---|---|---|
committer | 2021-01-05 22:56:20 +0100 | |
commit | 4f6eee0182a9250f4cdb8aab3e04868286d5c5ce (patch) | |
tree | ba6277f525ee8657bcf627741cea5935010d1184 /recipes/intercom/webview.js | |
parent | Update the Google Calendar icon (#400) (diff) | |
download | ferdium-recipes-4f6eee0182a9250f4cdb8aab3e04868286d5c5ce.tar.gz ferdium-recipes-4f6eee0182a9250f4cdb8aab3e04868286d5c5ce.tar.zst ferdium-recipes-4f6eee0182a9250f4cdb8aab3e04868286d5c5ce.zip |
Add Intercom recipe (#390)
Diffstat (limited to 'recipes/intercom/webview.js')
-rw-r--r-- | recipes/intercom/webview.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/recipes/intercom/webview.js b/recipes/intercom/webview.js new file mode 100644 index 0000000..2277a4d --- /dev/null +++ b/recipes/intercom/webview.js | |||
@@ -0,0 +1,12 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | function getMessages() { | ||
3 | const numMessages = parseInt(document.querySelector('.left-nav [data-content="Inbox"] .unread__container .unread').innerHTML.trim()); | ||
4 | if (numMessages >= 0) { | ||
5 | Ferdi.setBadge(numMessages, 0); | ||
6 | } else { | ||
7 | Ferdi.setBadge(0, 0); | ||
8 | } | ||
9 | } | ||
10 | |||
11 | Ferdi.loop(getMessages); | ||
12 | } \ No newline at end of file | ||