aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/habitica
diff options
context:
space:
mode:
authorLibravatar Ian Sealy <git@iansealy.com>2020-11-10 16:47:09 +0000
committerLibravatar Ian Sealy <git@iansealy.com>2020-11-10 16:47:09 +0000
commit19c290a58c3e6973697d48b3490575cadbbf1b92 (patch)
treec0cee89cb58ac42a168b1f19136eba267ab3491a /recipes/habitica
parentMerge pull request #351 from tpapamichail/master (diff)
downloadferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.tar.gz
ferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.tar.zst
ferdium-recipes-19c290a58c3e6973697d48b3490575cadbbf1b92.zip
Habitica: Add notification count.
Diffstat (limited to 'recipes/habitica')
-rwxr-xr-xrecipes/habitica/webview.js16
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
3module.exports = Franz => Franz; 3module.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};