From 8980eb2b8b05daf4350995da39c87814c3f66098 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Wed, 5 Feb 2020 20:00:14 +0100 Subject: Add Twitter recipe --- uncompressed/twitter/LICENSE | 21 +++++++++++++++++++++ uncompressed/twitter/README.md | 21 +++++++++++++++++++++ uncompressed/twitter/icon.png | Bin 0 -> 4298 bytes uncompressed/twitter/icon.svg | 1 + uncompressed/twitter/index.js | 3 +++ uncompressed/twitter/package.json | 17 +++++++++++++++++ uncompressed/twitter/webview.js | 17 +++++++++++++++++ 7 files changed, 80 insertions(+) create mode 100644 uncompressed/twitter/LICENSE create mode 100644 uncompressed/twitter/README.md create mode 100755 uncompressed/twitter/icon.png create mode 100755 uncompressed/twitter/icon.svg create mode 100644 uncompressed/twitter/index.js create mode 100644 uncompressed/twitter/package.json create mode 100644 uncompressed/twitter/webview.js (limited to 'uncompressed') diff --git a/uncompressed/twitter/LICENSE b/uncompressed/twitter/LICENSE new file mode 100644 index 0000000..0c2c44e --- /dev/null +++ b/uncompressed/twitter/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jason White & the Ferdi Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/uncompressed/twitter/README.md b/uncompressed/twitter/README.md new file mode 100644 index 0000000..51a7ae5 --- /dev/null +++ b/uncompressed/twitter/README.md @@ -0,0 +1,21 @@ +# Twitter for Franz +This is a [Twitter](https://twitter.com) recipe for [Ferdi](https://getferdi.com). + +* Notifications and Messages display a direct messages badge. + + +## Installation + +To install a new recipe: + +1. Open the Franz `recipes` directory on your machine (create the `dev` directory if it doesn't exist): +* Mac: `~/Library/Application Support/Franz/recipes/dev/` +* Linux: `~/.config/Franz/recipes/dev/` +* Windows: `%appdata%/Franz/recipes/dev/` +2. Clone or copy the contents of this repo to a directory named `twitter` in the `dev` folder. +3. Reload Franz. +4. Add a new service. Click the "Development" button under available services +to see the recipes added in `.../recipes/dev/`. + +## References +* [Franz Integration Documentation](https://github.com/meetfranz/plugins/tree/master/docs) diff --git a/uncompressed/twitter/icon.png b/uncompressed/twitter/icon.png new file mode 100755 index 0000000..b5eebc8 Binary files /dev/null and b/uncompressed/twitter/icon.png differ diff --git a/uncompressed/twitter/icon.svg b/uncompressed/twitter/icon.svg new file mode 100755 index 0000000..2832e7b --- /dev/null +++ b/uncompressed/twitter/icon.svg @@ -0,0 +1 @@ +Twitter_Logo_Blue \ No newline at end of file diff --git a/uncompressed/twitter/index.js b/uncompressed/twitter/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/uncompressed/twitter/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; \ No newline at end of file diff --git a/uncompressed/twitter/package.json b/uncompressed/twitter/package.json new file mode 100644 index 0000000..407a1a4 --- /dev/null +++ b/uncompressed/twitter/package.json @@ -0,0 +1,17 @@ +{ + "id": "twitter", + "name": "Twitter", + "version": "1.1.0", + "description": "Twitter", + "main": "index.js", + "author": "Ferdi Team and Jason White ", + "license": "MIT", + "repository": "https://github.com/getferdi/recipes", + "config": { + "serviceURL": "https://twitter.com", + "hasNotificationSound": true, + "hasDirectMessages": true, + "hasIndirectMessages": false, + "hasTeamId": false + } +} diff --git a/uncompressed/twitter/webview.js b/uncompressed/twitter/webview.js new file mode 100644 index 0000000..75655f1 --- /dev/null +++ b/uncompressed/twitter/webview.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = Franz => { + const getMessages = () => { + var direct = 0; + + // "Notifications" and "Messages" - aria-label ending in + // "unread items". Sum the values for direct badge. + direct += document.querySelector('[data-testid=AppTabBar_Notifications_Link] div div div').innerHTML; + direct += document.querySelector('[data-testid=AppTabBar_DirectMessage_Link] div div div').innerHTML; + + Franz.setBadge(direct); + }; + + Franz.loop(getMessages); + +}; \ No newline at end of file -- cgit v1.2.3-54-g00ecf