diff options
author | Bennett <hello@vantezzen.io> | 2020-11-11 21:36:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 21:36:22 +0100 |
commit | 8b4972030b5e084f7abb1e4cef612395ecd3ba78 (patch) | |
tree | 32425e3d3e7677e0e2490648e9a33bf3bb86dbef | |
parent | Merge pull request #359 from iansealy/roundcube (diff) | |
parent | Update version number. (diff) | |
download | ferdium-recipes-8b4972030b5e084f7abb1e4cef612395ecd3ba78.tar.gz ferdium-recipes-8b4972030b5e084f7abb1e4cef612395ecd3ba78.tar.zst ferdium-recipes-8b4972030b5e084f7abb1e4cef612395ecd3ba78.zip |
Merge pull request #356 from iansealy/habitica
Habitica: Add notification count.
-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 | }; | ||