diff options
author | Ian Sealy <git@iansealy.com> | 2020-11-10 16:47:09 +0000 |
---|---|---|
committer | Ian Sealy <git@iansealy.com> | 2020-11-10 16:47:09 +0000 |
commit | 19c290a58c3e6973697d48b3490575cadbbf1b92 (patch) | |
tree | c0cee89cb58ac42a168b1f19136eba267ab3491a /recipes | |
parent | Merge pull request #351 from tpapamichail/master (diff) | |
download | ferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.tar.gz ferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.tar.zst ferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.zip |
Habitica: Add notification count.
Diffstat (limited to 'recipes')
-rwxr-xr-x | recipes/habitica/webview.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/recipes/habitica/webview.js b/recipes/habitica/webview.js index 17daa35..66633cb 100755 --- a/recipes/habitica/webview.js +++ b/recipes/habitica/webview.js | |||
@@ -1,3 +1,17 @@ | |||
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | module.exports = Franz => Franz; | 3 | module.exports = (Franz) => { |
4 | const getMessages = () => { | ||
5 | let count = 0; | ||
6 | let element = document.querySelector(".message-count"); | ||
7 | if (element) { | ||
8 | count = Number(element.innerText); | ||
9 | if (Number.isNaN(count)) { | ||
10 | count = 0; | ||
11 | } | ||
12 | } | ||
13 | Franz.setBadge(count); | ||
14 | }; | ||
15 | |||
16 | Franz.loop(getMessages); | ||
17 | }; | ||