diff options
Diffstat (limited to 'recipes/habitica')
-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 | }; | ||