aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/tt-rss/webview.js
diff options
context:
space:
mode:
authorLibravatar Celedhrim <Celedhrim@users.noreply.github.com>2022-03-16 22:41:05 +0100
committerLibravatar GitHub <noreply@github.com>2022-03-16 22:41:05 +0100
commit7337c3c428a67005944286d817826e15fe51fbf1 (patch)
treec84d52577d6224633eb8fc6fa518af322343bdd1 /recipes/tt-rss/webview.js
parentBump ZenHub recipe version to 1.0.0 (diff)
downloadferdium-recipes-7337c3c428a67005944286d817826e15fe51fbf1.tar.gz
ferdium-recipes-7337c3c428a67005944286d817826e15fe51fbf1.tar.zst
ferdium-recipes-7337c3c428a67005944286d817826e15fe51fbf1.zip
Add Tiny Tiny RSS recipe (#845)
Diffstat (limited to 'recipes/tt-rss/webview.js')
-rw-r--r--recipes/tt-rss/webview.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/recipes/tt-rss/webview.js b/recipes/tt-rss/webview.js
new file mode 100644
index 0000000..1bb700a
--- /dev/null
+++ b/recipes/tt-rss/webview.js
@@ -0,0 +1,21 @@
1"use strict";
2
3module.exports = Ferdi => {
4 const getMessages = function getMessages() {
5 // Initialize empty vars
6 var unread = 0;
7 var match = [];
8 // Extract the number from the title
9 match = document.title.match(/^\((\d+)\) Tiny Tiny RSS$/);
10 // Some logic to handle the match groups
11 unread = match != null && match.length > 0 ? match[1] : 0;
12 // Set unread msgs badge
13 Ferdi.setBadge(Number.parseInt(unread, 10));
14 };
15
16 const loopFunc = () => {
17 getMessages();
18 };
19
20 Ferdi.loop(loopFunc);
21};