diff options
author | 2022-11-02 19:54:10 +0100 | |
---|---|---|
committer | 2022-11-02 18:54:10 +0000 | |
commit | 32db3ac916192c1acc354663cfd264f56e1304c6 (patch) | |
tree | 390fc4eb5983059635957d569ee94ae06e281a38 /recipes/ntfy/webview.js | |
parent | Updated Android Messages Icon (#217) (diff) | |
download | ferdium-recipes-32db3ac916192c1acc354663cfd264f56e1304c6.tar.gz ferdium-recipes-32db3ac916192c1acc354663cfd264f56e1304c6.tar.zst ferdium-recipes-32db3ac916192c1acc354663cfd264f56e1304c6.zip |
added new recipe for ntfy.sh notification service (#222)
Diffstat (limited to 'recipes/ntfy/webview.js')
-rw-r--r-- | recipes/ntfy/webview.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/recipes/ntfy/webview.js b/recipes/ntfy/webview.js new file mode 100644 index 0000000..45b8d2d --- /dev/null +++ b/recipes/ntfy/webview.js | |||
@@ -0,0 +1,14 @@ | |||
1 | module.exports = (Ferdium) => { | ||
2 | const getMessages = () => { | ||
3 | let msgRaw = document.title.match(/\(\d*\)/); | ||
4 | let messages = 0; | ||
5 | |||
6 | if (msgRaw) { | ||
7 | messages = Ferdium.safeParseInt(msgRaw[0].slice(1)); | ||
8 | } | ||
9 | |||
10 | Ferdium.setBadge(messages, 0); | ||
11 | } | ||
12 | |||
13 | Ferdium.loop(getMessages); | ||
14 | }; \ No newline at end of file | ||