diff options
author | Celedhrim <Celedhrim@users.noreply.github.com> | 2022-03-16 22:41:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-16 22:41:05 +0100 |
commit | 7337c3c428a67005944286d817826e15fe51fbf1 (patch) | |
tree | c84d52577d6224633eb8fc6fa518af322343bdd1 /recipes/tt-rss/webview.js | |
parent | Bump ZenHub recipe version to 1.0.0 (diff) | |
download | ferdium-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.js | 21 |
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 | |||
3 | module.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 | }; | ||