diff options
Diffstat (limited to 'recipes/twitter')
-rw-r--r-- | recipes/twitter/LICENSE | 21 | ||||
-rw-r--r-- | recipes/twitter/README.md | 21 | ||||
-rw-r--r-- | recipes/twitter/icon.png | bin | 0 -> 34190 bytes | |||
-rw-r--r-- | recipes/twitter/icon.svg | 35 | ||||
-rw-r--r-- | recipes/twitter/index.js | 3 | ||||
-rw-r--r-- | recipes/twitter/package.json | 17 | ||||
-rw-r--r-- | recipes/twitter/webview.js | 23 |
7 files changed, 120 insertions, 0 deletions
diff --git a/recipes/twitter/LICENSE b/recipes/twitter/LICENSE new file mode 100644 index 0000000..0c2c44e --- /dev/null +++ b/recipes/twitter/LICENSE | |||
@@ -0,0 +1,21 @@ | |||
1 | MIT License | ||
2 | |||
3 | Copyright (c) 2019 Jason White & the Ferdi Team | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in all | ||
13 | copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | SOFTWARE. | ||
diff --git a/recipes/twitter/README.md b/recipes/twitter/README.md new file mode 100644 index 0000000..51a7ae5 --- /dev/null +++ b/recipes/twitter/README.md | |||
@@ -0,0 +1,21 @@ | |||
1 | # Twitter for Franz | ||
2 | This is a [Twitter](https://twitter.com) recipe for [Ferdi](https://getferdi.com). | ||
3 | |||
4 | * Notifications and Messages display a direct messages badge. | ||
5 | |||
6 | |||
7 | ## Installation | ||
8 | |||
9 | To install a new recipe: | ||
10 | |||
11 | 1. Open the Franz `recipes` directory on your machine (create the `dev` directory if it doesn't exist): | ||
12 | * Mac: `~/Library/Application Support/Franz/recipes/dev/` | ||
13 | * Linux: `~/.config/Franz/recipes/dev/` | ||
14 | * Windows: `%appdata%/Franz/recipes/dev/` | ||
15 | 2. Clone or copy the contents of this repo to a directory named `twitter` in the `dev` folder. | ||
16 | 3. Reload Franz. | ||
17 | 4. Add a new service. Click the "Development" button under available services | ||
18 | to see the recipes added in `.../recipes/dev/`. | ||
19 | |||
20 | ## References | ||
21 | * [Franz Integration Documentation](https://github.com/meetfranz/plugins/tree/master/docs) | ||
diff --git a/recipes/twitter/icon.png b/recipes/twitter/icon.png new file mode 100644 index 0000000..37af09a --- /dev/null +++ b/recipes/twitter/icon.png | |||
Binary files differ | |||
diff --git a/recipes/twitter/icon.svg b/recipes/twitter/icon.svg new file mode 100644 index 0000000..b7ac960 --- /dev/null +++ b/recipes/twitter/icon.svg | |||
@@ -0,0 +1,35 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <svg | ||
3 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
4 | xmlns:cc="http://creativecommons.org/ns#" | ||
5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
6 | xmlns:svg="http://www.w3.org/2000/svg" | ||
7 | xmlns="http://www.w3.org/2000/svg" | ||
8 | version="1.1" | ||
9 | id="svg3626" | ||
10 | viewBox="0 0 300.00006 244.18703" | ||
11 | height="300.00006" | ||
12 | width="300.00006"> | ||
13 | <defs | ||
14 | id="defs3628" /> | ||
15 | <metadata | ||
16 | id="metadata3631"> | ||
17 | <rdf:RDF> | ||
18 | <cc:Work | ||
19 | rdf:about=""> | ||
20 | <dc:format>image/svg+xml</dc:format> | ||
21 | <dc:type | ||
22 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
23 | <dc:title></dc:title> | ||
24 | </cc:Work> | ||
25 | </rdf:RDF> | ||
26 | </metadata> | ||
27 | <g | ||
28 | transform="translate(-539.17946,-568.85777)" | ||
29 | id="layer1"> | ||
30 | <path | ||
31 | id="path3611" | ||
32 | style="fill:#1da1f2;fill-opacity:1;fill-rule:nonzero;stroke:none" | ||
33 | d="m 633.89823,812.04479 c 112.46038,0 173.95627,-93.16765 173.95627,-173.95625 0,-2.64628 -0.0539,-5.28062 -0.1726,-7.90305 11.93799,-8.63016 22.31446,-19.39999 30.49762,-31.65984 -10.95459,4.86937 -22.74358,8.14741 -35.11071,9.62551 12.62341,-7.56929 22.31446,-19.54304 26.88583,-33.81739 -11.81284,7.00307 -24.89517,12.09297 -38.82383,14.84055 -11.15723,-11.88436 -27.04079,-19.31655 -44.62892,-19.31655 -33.76374,0 -61.14426,27.38052 -61.14426,61.13233 0,4.79784 0.5364,9.46458 1.58538,13.94057 -50.81546,-2.55686 -95.87353,-26.88582 -126.02546,-63.87991 -5.25082,9.03545 -8.27852,19.53111 -8.27852,30.73006 0,21.21186 10.79366,39.93837 27.20766,50.89296 -10.03077,-0.30992 -19.45363,-3.06348 -27.69044,-7.64676 -0.009,0.25652 -0.009,0.50661 -0.009,0.78077 0,29.60957 21.07478,54.3319 49.0513,59.93435 -5.13757,1.40062 -10.54335,2.15158 -16.12196,2.15158 -3.93364,0 -7.76596,-0.38716 -11.49099,-1.1026 7.78383,24.2932 30.35457,41.97073 57.11525,42.46543 -20.92578,16.40207 -47.28712,26.17062 -75.93712,26.17062 -4.92898,0 -9.79834,-0.28036 -14.58427,-0.84634 27.05868,17.34379 59.18936,27.46396 93.72193,27.46396" /> | ||
34 | </g> | ||
35 | </svg> | ||
diff --git a/recipes/twitter/index.js b/recipes/twitter/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/recipes/twitter/index.js | |||
@@ -0,0 +1,3 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => Franz; \ No newline at end of file | ||
diff --git a/recipes/twitter/package.json b/recipes/twitter/package.json new file mode 100644 index 0000000..831c1ec --- /dev/null +++ b/recipes/twitter/package.json | |||
@@ -0,0 +1,17 @@ | |||
1 | { | ||
2 | "id": "twitter", | ||
3 | "name": "Twitter", | ||
4 | "version": "1.1.1", | ||
5 | "description": "Twitter", | ||
6 | "main": "index.js", | ||
7 | "author": "Ferdi Team <hello@getferdi.com> and Jason White <jdwhite@menelos.com>", | ||
8 | "license": "MIT", | ||
9 | "repository": "https://github.com/getferdi/recipes", | ||
10 | "config": { | ||
11 | "serviceURL": "https://twitter.com", | ||
12 | "hasNotificationSound": true, | ||
13 | "hasDirectMessages": true, | ||
14 | "hasIndirectMessages": false, | ||
15 | "hasTeamId": false | ||
16 | } | ||
17 | } | ||
diff --git a/recipes/twitter/webview.js b/recipes/twitter/webview.js new file mode 100644 index 0000000..81f0ba5 --- /dev/null +++ b/recipes/twitter/webview.js | |||
@@ -0,0 +1,23 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = () => { | ||
5 | var direct = 0; | ||
6 | |||
7 | // "Notifications" and "Messages" - aria-label ending in | ||
8 | // "unread items". Sum the values for direct badge. | ||
9 | const notificationsElement = document.querySelector('[data-testid=AppTabBar_Notifications_Link] div div div'); | ||
10 | if (notificationsElement) { | ||
11 | direct += notificationsElement.innerHTML; | ||
12 | } | ||
13 | const DMElement = document.querySelector('[data-testid=AppTabBar_DirectMessage_Link] div div div'); | ||
14 | if (DMElement) { | ||
15 | direct += DMElement.innerHTML; | ||
16 | } | ||
17 | |||
18 | Franz.setBadge(direct); | ||
19 | }; | ||
20 | |||
21 | Franz.loop(getMessages); | ||
22 | |||
23 | }; \ No newline at end of file | ||