From 9db43e100a672b6d6932ac68c0fbe503c129138b Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 12 Sep 2021 22:01:51 +0530 Subject: Added a check to verify that the folder name of the recipe matches the recipe id (#708) Use the recipe-id as master to rename internal folder names --- recipes/amazon-work-mail/.gitignore | 2 ++ recipes/amazon-work-mail/LICENSE | 21 +++++++++++++++++++++ recipes/amazon-work-mail/icon.svg | 1 + recipes/amazon-work-mail/index.js | 1 + recipes/amazon-work-mail/package.json | 11 +++++++++++ recipes/amazon-work-mail/webview.js | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+) create mode 100644 recipes/amazon-work-mail/.gitignore create mode 100644 recipes/amazon-work-mail/LICENSE create mode 100755 recipes/amazon-work-mail/icon.svg create mode 100644 recipes/amazon-work-mail/index.js create mode 100644 recipes/amazon-work-mail/package.json create mode 100644 recipes/amazon-work-mail/webview.js (limited to 'recipes/amazon-work-mail') 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 @@ +# Linter +.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 @@ +MIT License + +Copyright (c) 2017 Yoav Maman + +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/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 @@ + \ 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 @@ +{ + "id": "amazon-work-mail", + "name": "Amazon WorkMail", + "version": "1.1.1", + "license": "MIT", + "config": { + "serviceURL": "https://{teamID}.awsapps.com/mail", + "hasIndirectMessages": false, + "hasTeamId": true + } +} 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 @@ +module.exports = (Ferdi) => { + const reload = (EventType) => new Promise((resolve, reject) => { + const btn = document.getElementsByClassName('giraffe-hierarchy-node-refresh')[0]; + const EventObject = document.createEvent('Events'); + EventObject.initEvent(EventType, true, false); + + if (btn.dispatchEvent(EventObject)) { + resolve(); + } else { + reject(); + } + }); + + const getUnread = () => { + const nodes = document.getElementsByClassName('giraffe-hierarchy-node-counter'); + let counter = 0; + + for (let i = 0; i < nodes.length; i++) { + counter += Ferdi.safeParseInt(nodes[i].innerText); + } + + Ferdi.setBadge(counter); + }; + + if (!window.location.pathname.includes('auth')) { + Ferdi.loop(getUnread); + + window.setInterval(() => { + reload('click'); + }, 60000); + } +}; -- cgit v1.2.3-70-g09d2