diff options
Diffstat (limited to 'recipes/mastodon')
-rw-r--r-- | recipes/mastodon/README.md | 5 | ||||
-rw-r--r-- | recipes/mastodon/icon.png | bin | 0 -> 34530 bytes | |||
-rw-r--r-- | recipes/mastodon/icon.svg | 10 | ||||
-rw-r--r-- | recipes/mastodon/index.js | 14 | ||||
-rw-r--r-- | recipes/mastodon/package.json | 24 | ||||
-rw-r--r-- | recipes/mastodon/webview.js | 28 |
6 files changed, 81 insertions, 0 deletions
diff --git a/recipes/mastodon/README.md b/recipes/mastodon/README.md new file mode 100644 index 0000000..04fca53 --- /dev/null +++ b/recipes/mastodon/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # franz-plugin-mastodon | ||
2 | |||
3 | [franz](http://meetfranz.com/) integration for [Mastodon](https://github.com/tootsuite/mastodon). | ||
4 | |||
5 | see http://qiita.com/kan/items/571b2f56c54e1e3b6516 | ||
diff --git a/recipes/mastodon/icon.png b/recipes/mastodon/icon.png new file mode 100644 index 0000000..102e722 --- /dev/null +++ b/recipes/mastodon/icon.png | |||
Binary files differ | |||
diff --git a/recipes/mastodon/icon.svg b/recipes/mastodon/icon.svg new file mode 100644 index 0000000..ecff3a2 --- /dev/null +++ b/recipes/mastodon/icon.svg | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
3 | <svg width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> | ||
4 | <g transform="matrix(5.46641,0,0,5.46641,39,4)"> | ||
5 | <path d="M169.446,111.27C166.901,124.363 146.652,138.692 123.396,141.469C111.269,142.916 99.329,144.246 86.597,143.662C65.775,142.708 49.345,138.692 49.345,138.692C49.345,140.719 49.47,142.649 49.72,144.454C52.427,165.003 70.096,166.234 86.833,166.808C103.726,167.386 118.768,162.643 118.768,162.643L119.462,177.915C119.462,177.915 107.646,184.26 86.597,185.427C74.99,186.065 60.578,185.135 43.792,180.692C7.386,171.056 1.125,132.249 0.167,92.873C-0.125,81.182 0.055,70.158 0.055,60.938C0.055,20.674 26.436,8.872 26.436,8.872C39.738,2.763 62.563,0.194 86.292,0L86.875,0C110.604,0.194 133.444,2.763 146.745,8.872C146.745,8.872 173.125,20.674 173.125,60.938C173.125,60.938 173.456,90.645 169.446,111.27" style="fill:rgb(48,136,212);fill-rule:nonzero;"/> | ||
6 | </g> | ||
7 | <g transform="matrix(5.46641,0,0,5.46641,39,-1.46641)"> | ||
8 | <path d="M142.008,64.062L142.008,112.815L122.693,112.815L122.693,65.495C122.693,55.52 118.496,50.457 110.101,50.457C100.819,50.457 96.167,56.463 96.167,68.339L96.167,94.24L76.966,94.24L76.966,68.339C76.966,56.463 72.313,50.457 63.031,50.457C54.636,50.457 50.439,55.52 50.439,65.495L50.439,112.815L31.124,112.815L31.124,64.062C31.124,54.098 33.661,46.18 38.757,40.322C44.012,34.464 50.894,31.461 59.437,31.461C69.321,31.461 76.806,35.26 81.755,42.859L86.566,50.924L91.378,42.859C96.326,35.26 103.811,31.461 113.696,31.461C122.238,31.461 129.12,34.464 134.376,40.322C139.471,46.18 142.008,54.098 142.008,64.062" style="fill:white;fill-rule:nonzero;"/> | ||
9 | </g> | ||
10 | </svg> | ||
diff --git a/recipes/mastodon/index.js b/recipes/mastodon/index.js new file mode 100644 index 0000000..561bb58 --- /dev/null +++ b/recipes/mastodon/index.js | |||
@@ -0,0 +1,14 @@ | |||
1 | module.exports = (Franz) => { | ||
2 | class Mastodon extends Franz { | ||
3 | validateServer(URL) { | ||
4 | const api = `${URL}`; | ||
5 | return new Promise((resolve, reject) => { | ||
6 | $.get(api, (resp) => { | ||
7 | resolve(); | ||
8 | }).fail(reject); | ||
9 | }); | ||
10 | } | ||
11 | } | ||
12 | |||
13 | return Mastodon; | ||
14 | }; | ||
diff --git a/recipes/mastodon/package.json b/recipes/mastodon/package.json new file mode 100644 index 0000000..887d7ab --- /dev/null +++ b/recipes/mastodon/package.json | |||
@@ -0,0 +1,24 @@ | |||
1 | { | ||
2 | "name": "Mastodon", | ||
3 | "id": "mastodon", | ||
4 | "version": "1.1.2", | ||
5 | "description": "Mastodon Recipe for Ferdi", | ||
6 | "main": "index.js", | ||
7 | "author": "The Ferdi Team <hello@getferdi.com> and Kan Fushihara <kan.fushihara@gmail.com>", | ||
8 | "license": "MIT", | ||
9 | "config": { | ||
10 | "serviceURL": "", | ||
11 | "serviceName": "Mastodon", | ||
12 | "message": "", | ||
13 | "popup": [], | ||
14 | "hasNotificationSound": true, | ||
15 | "hasIndirectMessages": false, | ||
16 | "hasTeamID": true, | ||
17 | "hasCustomUrl": true, | ||
18 | "hostedOnly": true, | ||
19 | "webviewOptions": { | ||
20 | "disablewebsecurity": "" | ||
21 | }, | ||
22 | "openDevTools": false | ||
23 | } | ||
24 | } | ||
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 | } | ||