diff options
Diffstat (limited to 'recipes')
-rwxr-xr-x | recipes/habitica/package.json | 2 | ||||
-rwxr-xr-x | recipes/habitica/webview.js | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/recipes/habitica/package.json b/recipes/habitica/package.json index 8fd53a1..688d3f2 100755 --- a/recipes/habitica/package.json +++ b/recipes/habitica/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "habitica", | 2 | "id": "habitica", |
3 | "name": "Habitica", | 3 | "name": "Habitica", |
4 | "version": "1.0.1", | 4 | "version": "1.0.2", |
5 | "description": "Habitica", | 5 | "description": "Habitica", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "license": "MIT", | 7 | "license": "MIT", |
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 | }; | ||