diff options
Diffstat (limited to 'recipes/mastodon')
-rw-r--r-- | recipes/mastodon/index.js | 20 | ||||
-rw-r--r-- | recipes/mastodon/webview.js | 46 |
2 files changed, 33 insertions, 33 deletions
diff --git a/recipes/mastodon/index.js b/recipes/mastodon/index.js index 561bb58..14a7917 100644 --- a/recipes/mastodon/index.js +++ b/recipes/mastodon/index.js | |||
@@ -1,14 +1,14 @@ | |||
1 | module.exports = (Franz) => { | 1 | module.exports = (Franz) => { |
2 | class Mastodon extends Franz { | 2 | class Mastodon extends Franz { |
3 | validateServer(URL) { | 3 | validateServer(URL) { |
4 | const api = `${URL}`; | 4 | const api = `${URL}`; |
5 | return new Promise((resolve, reject) => { | 5 | return new Promise((resolve, reject) => { |
6 | $.get(api, (resp) => { | 6 | $.get(api, (resp) => { |
7 | resolve(); | 7 | resolve(); |
8 | }).fail(reject); | 8 | }).fail(reject); |
9 | }); | 9 | }); |
10 | } | ||
11 | } | 10 | } |
11 | } | ||
12 | 12 | ||
13 | return Mastodon; | 13 | return Mastodon; |
14 | }; | 14 | }; |
diff --git a/recipes/mastodon/webview.js b/recipes/mastodon/webview.js index d3644e8..1abe7b4 100644 --- a/recipes/mastodon/webview.js +++ b/recipes/mastodon/webview.js | |||
@@ -1,28 +1,28 @@ | |||
1 | module.exports = (Franz, options) => { | 1 | module.exports = (Franz, options) => { |
2 | let latestStatement = $('.status time').attr('datetime'); | 2 | let latestStatement = $('.status time').attr('datetime'); |
3 | let latestNotify = $($('.notification__message span').get(0)).text(); | 3 | let latestNotify = $($('.notification__message span').get(0)).text(); |
4 | 4 | ||
5 | $($('div.column div.scrollable').get(0)).on('scroll', (ev) => { | 5 | $($('div.column div.scrollable').get(0)).on('scroll', (ev) => { |
6 | latestStatement = $('.status time').attr('datetime'); | 6 | latestStatement = $('.status time').attr('datetime'); |
7 | }); | 7 | }); |
8 | $($('div.column div.scrollable').get(1)).on('scroll', (ev) => { | 8 | $($('div.column div.scrollable').get(1)).on('scroll', (ev) => { |
9 | latestNotify = $($('.notification__message span').get(0)).text(); | 9 | latestNotify = $($('.notification__message span').get(0)).text(); |
10 | }); | 10 | }); |
11 | 11 | ||
12 | function getMessages() { | 12 | function getMessages() { |
13 | var reply = 0; | 13 | let reply = 0; |
14 | const ln = $($('.notification__message span').get(0)).text(); | 14 | const ln = $($('.notification__message span').get(0)).text(); |
15 | if (ln != latestNotify) { | 15 | if (ln != latestNotify) { |
16 | reply = 1; | 16 | reply = 1; |
17 | } | 17 | } |
18 | var unread = 0; | 18 | let unread = 0; |
19 | const ls = $('.status time').attr('datetime'); | 19 | const ls = $('.status time').attr('datetime'); |
20 | if (ls != latestStatement) { | 20 | if (ls != latestStatement) { |
21 | unread = 1; | 21 | unread = 1; |
22 | } | ||
23 | |||
24 | Franz.setBadge(reply, unread); | ||
25 | } | 22 | } |
26 | 23 | ||
27 | Franz.loop(getMessages); | 24 | Franz.setBadge(reply, unread); |
28 | } | 25 | } |
26 | |||
27 | Franz.loop(getMessages); | ||
28 | }; | ||