diff options
Diffstat (limited to 'recipes/amazon-work-mail')
-rw-r--r-- | recipes/amazon-work-mail/.gitignore | 2 | ||||
-rw-r--r-- | recipes/amazon-work-mail/LICENSE | 21 | ||||
-rwxr-xr-x | recipes/amazon-work-mail/icon.svg | 1 | ||||
-rw-r--r-- | recipes/amazon-work-mail/index.js | 1 | ||||
-rw-r--r-- | recipes/amazon-work-mail/package.json | 11 | ||||
-rw-r--r-- | recipes/amazon-work-mail/webview.js | 32 |
6 files changed, 68 insertions, 0 deletions
diff --git a/recipes/amazon-work-mail/.gitignore b/recipes/amazon-work-mail/.gitignore new file mode 100644 index 0000000..63137ec --- /dev/null +++ b/recipes/amazon-work-mail/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | # Linter | ||
2 | .jshintrc | ||
diff --git a/recipes/amazon-work-mail/LICENSE b/recipes/amazon-work-mail/LICENSE new file mode 100644 index 0000000..231d35b --- /dev/null +++ b/recipes/amazon-work-mail/LICENSE | |||
@@ -0,0 +1,21 @@ | |||
1 | MIT License | ||
2 | |||
3 | Copyright (c) 2017 Yoav Maman | ||
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/amazon-work-mail/icon.svg b/recipes/amazon-work-mail/icon.svg new file mode 100755 index 0000000..72a9bfb --- /dev/null +++ b/recipes/amazon-work-mail/icon.svg | |||
@@ -0,0 +1 @@ | |||
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="100" height="100"><defs><linearGradient id="a" x1="50" y1="-687.73" x2="50" y2="-603.9" gradientTransform="translate(0 696)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f58536"/><stop offset="1" stop-color="#d16929"/></linearGradient></defs><path fill="url(#a)" d="M13 28.9 50 7.8l37 21.1v42.2L50 92.2 13 71.1V28.9z"/><path d="M71.4 35.8v9l-22.1 9.8-22.1-9.8v-9h-3.9v33h51.9v-33zm0 29.2H27.3V49.2L49.4 59l22.1-9.8V65z" fill="#fff"/><path fill="#fff" d="M49.3 21.7 23.4 33.3v5.1h3.9v-2.5l22-9.9 22.1 9.9v2.5h3.9v-5.1l-26-11.6z"/><path fill="#fff" d="M35.1 48.4v-6.3h28.4v6.3l4-1.8v-8.5H31.2v8.5l3.9 1.8z"/></svg> \ No newline at end of file | |||
diff --git a/recipes/amazon-work-mail/index.js b/recipes/amazon-work-mail/index.js new file mode 100644 index 0000000..23607bd --- /dev/null +++ b/recipes/amazon-work-mail/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = Ferdi => Ferdi; | |||
diff --git a/recipes/amazon-work-mail/package.json b/recipes/amazon-work-mail/package.json new file mode 100644 index 0000000..e407dd2 --- /dev/null +++ b/recipes/amazon-work-mail/package.json | |||
@@ -0,0 +1,11 @@ | |||
1 | { | ||
2 | "id": "amazon-work-mail", | ||
3 | "name": "Amazon WorkMail", | ||
4 | "version": "1.1.1", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "serviceURL": "https://{teamID}.awsapps.com/mail", | ||
8 | "hasIndirectMessages": false, | ||
9 | "hasTeamId": true | ||
10 | } | ||
11 | } | ||
diff --git a/recipes/amazon-work-mail/webview.js b/recipes/amazon-work-mail/webview.js new file mode 100644 index 0000000..944a15c --- /dev/null +++ b/recipes/amazon-work-mail/webview.js | |||
@@ -0,0 +1,32 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | const reload = (EventType) => new Promise((resolve, reject) => { | ||
3 | const btn = document.getElementsByClassName('giraffe-hierarchy-node-refresh')[0]; | ||
4 | const EventObject = document.createEvent('Events'); | ||
5 | EventObject.initEvent(EventType, true, false); | ||
6 | |||
7 | if (btn.dispatchEvent(EventObject)) { | ||
8 | resolve(); | ||
9 | } else { | ||
10 | reject(); | ||
11 | } | ||
12 | }); | ||
13 | |||
14 | const getUnread = () => { | ||
15 | const nodes = document.getElementsByClassName('giraffe-hierarchy-node-counter'); | ||
16 | let counter = 0; | ||
17 | |||
18 | for (let i = 0; i < nodes.length; i++) { | ||
19 | counter += Ferdi.safeParseInt(nodes[i].innerText); | ||
20 | } | ||
21 | |||
22 | Ferdi.setBadge(counter); | ||
23 | }; | ||
24 | |||
25 | if (!window.location.pathname.includes('auth')) { | ||
26 | Ferdi.loop(getUnread); | ||
27 | |||
28 | window.setInterval(() => { | ||
29 | reload('click'); | ||
30 | }, 60000); | ||
31 | } | ||
32 | }; | ||