From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/mastodon/README.md | 5 +++++ recipes/mastodon/icon.png | Bin 0 -> 34530 bytes recipes/mastodon/icon.svg | 10 ++++++++++ recipes/mastodon/index.js | 14 ++++++++++++++ recipes/mastodon/package.json | 24 ++++++++++++++++++++++++ recipes/mastodon/webview.js | 28 ++++++++++++++++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 recipes/mastodon/README.md create mode 100644 recipes/mastodon/icon.png create mode 100644 recipes/mastodon/icon.svg create mode 100644 recipes/mastodon/index.js create mode 100644 recipes/mastodon/package.json create mode 100644 recipes/mastodon/webview.js (limited to 'recipes/mastodon') 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 @@ +# franz-plugin-mastodon + +[franz](http://meetfranz.com/) integration for [Mastodon](https://github.com/tootsuite/mastodon). + +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 Binary files /dev/null and b/recipes/mastodon/icon.png 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 @@ + + + + + + + + + + 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 @@ +module.exports = (Franz) => { + class Mastodon extends Franz { + validateServer(URL) { + const api = `${URL}`; + return new Promise((resolve, reject) => { + $.get(api, (resp) => { + resolve(); + }).fail(reject); + }); + } + } + + return Mastodon; +}; 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 @@ +{ + "name": "Mastodon", + "id": "mastodon", + "version": "1.1.2", + "description": "Mastodon Recipe for Ferdi", + "main": "index.js", + "author": "The Ferdi Team and Kan Fushihara ", + "license": "MIT", + "config": { + "serviceURL": "", + "serviceName": "Mastodon", + "message": "", + "popup": [], + "hasNotificationSound": true, + "hasIndirectMessages": false, + "hasTeamID": true, + "hasCustomUrl": true, + "hostedOnly": true, + "webviewOptions": { + "disablewebsecurity": "" + }, + "openDevTools": false + } +} 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 @@ +module.exports = (Franz, options) => { + let latestStatement = $('.status time').attr('datetime'); + let latestNotify = $($('.notification__message span').get(0)).text(); + + $($('div.column div.scrollable').get(0)).on('scroll', (ev) => { + latestStatement = $('.status time').attr('datetime'); + }); + $($('div.column div.scrollable').get(1)).on('scroll', (ev) => { + latestNotify = $($('.notification__message span').get(0)).text(); + }); + + function getMessages() { + var reply = 0; + const ln = $($('.notification__message span').get(0)).text(); + if (ln != latestNotify) { + reply = 1; + } + var unread = 0; + const ls = $('.status time').attr('datetime'); + if (ls != latestStatement) { + unread = 1; + } + + Franz.setBadge(reply, unread); + } + + Franz.loop(getMessages); +} -- cgit v1.2.3-54-g00ecf