diff options
author | 2020-09-22 20:56:48 +0200 | |
---|---|---|
committer | 2020-09-22 19:56:48 +0100 | |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /recipes/mastodon/webview.js | |
parent | Updated logos for Outlook/OWA (diff) | |
download | ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip |
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'recipes/mastodon/webview.js')
-rw-r--r-- | recipes/mastodon/webview.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/recipes/mastodon/webview.js b/recipes/mastodon/webview.js new file mode 100644 index 0000000..d3644e8 --- /dev/null +++ b/recipes/mastodon/webview.js | |||
@@ -0,0 +1,28 @@ | |||
1 | module.exports = (Franz, options) => { | ||
2 | let latestStatement = $('.status time').attr('datetime'); | ||
3 | let latestNotify = $($('.notification__message span').get(0)).text(); | ||
4 | |||
5 | $($('div.column div.scrollable').get(0)).on('scroll', (ev) => { | ||
6 | latestStatement = $('.status time').attr('datetime'); | ||
7 | }); | ||
8 | $($('div.column div.scrollable').get(1)).on('scroll', (ev) => { | ||
9 | latestNotify = $($('.notification__message span').get(0)).text(); | ||
10 | }); | ||
11 | |||
12 | function getMessages() { | ||
13 | var reply = 0; | ||
14 | const ln = $($('.notification__message span').get(0)).text(); | ||
15 | if (ln != latestNotify) { | ||
16 | reply = 1; | ||
17 | } | ||
18 | var unread = 0; | ||
19 | const ls = $('.status time').attr('datetime'); | ||
20 | if (ls != latestStatement) { | ||
21 | unread = 1; | ||
22 | } | ||
23 | |||
24 | Franz.setBadge(reply, unread); | ||
25 | } | ||
26 | |||
27 | Franz.loop(getMessages); | ||
28 | } | ||