aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/tt-rss/webview.js
diff options
context:
space:
mode:
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};