diff options
author | Maxime Marty-Dessus <maxime.martydessus@gmail.com> | 2021-11-04 18:05:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-04 22:35:00 +0530 |
commit | 5598d4b3bfc2956a6ccd16ceb1fad9e67ccff10e (patch) | |
tree | 3eecb19127b9e850133116f3212ec460bd00e738 | |
parent | Add Confluence recipe (#758) (diff) | |
download | ferdium-recipes-5598d4b3bfc2956a6ccd16ceb1fad9e67ccff10e.tar.gz ferdium-recipes-5598d4b3bfc2956a6ccd16ceb1fad9e67ccff10e.tar.zst ferdium-recipes-5598d4b3bfc2956a6ccd16ceb1fad9e67ccff10e.zip |
Add recipe for Chatwoot (#760)
-rw-r--r-- | all.json | 9 | ||||
-rw-r--r-- | recipes/chatwoot/icon.svg | 12 | ||||
-rw-r--r-- | recipes/chatwoot/index.js | 1 | ||||
-rw-r--r-- | recipes/chatwoot/package.json | 11 | ||||
-rw-r--r-- | recipes/chatwoot/webview.js | 14 |
5 files changed, 47 insertions, 0 deletions
@@ -187,6 +187,15 @@ | |||
187 | }, | 187 | }, |
188 | { | 188 | { |
189 | "featured": false, | 189 | "featured": false, |
190 | "id": "chatwoot", | ||
191 | "name": "Chatwoot", | ||
192 | "version": "1.0.0", | ||
193 | "icons": { | ||
194 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/chatwoot/icon.svg" | ||
195 | } | ||
196 | }, | ||
197 | { | ||
198 | "featured": false, | ||
190 | "id": "chatwork", | 199 | "id": "chatwork", |
191 | "name": "ChatWork", | 200 | "name": "ChatWork", |
192 | "version": "1.1.2", | 201 | "version": "1.1.2", |
diff --git a/recipes/chatwoot/icon.svg b/recipes/chatwoot/icon.svg new file mode 100644 index 0000000..1652967 --- /dev/null +++ b/recipes/chatwoot/icon.svg | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <svg width="512px" height="512px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
3 | <!-- Generator: Sketch 59.1 (86144) - https://sketch.com --> | ||
4 | <title>woot-log</title> | ||
5 | <desc>Created with Sketch.</desc> | ||
6 | <g id="Logo" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> | ||
7 | <g id="woot-log" fill-rule="nonzero"> | ||
8 | <circle id="Oval" fill="#47A7F6" cx="256" cy="256" r="256"></circle> | ||
9 | <path d="M362.807947,368.807947 L244.122956,368.807947 C178.699407,368.807947 125.456954,315.561812 125.456954,250.12177 C125.456954,184.703089 178.699407,131.456954 244.124143,131.456954 C309.565494,131.456954 362.807947,184.703089 362.807947,250.12177 L362.807947,368.807947 Z" id="Fill-1" stroke="#FFFFFF" stroke-width="6" fill="#FFFFFF"></path> | ||
10 | </g> | ||
11 | </g> | ||
12 | </svg> \ No newline at end of file | ||
diff --git a/recipes/chatwoot/index.js b/recipes/chatwoot/index.js new file mode 100644 index 0000000..653b54c --- /dev/null +++ b/recipes/chatwoot/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = (Ferdi) => Ferdi; | |||
diff --git a/recipes/chatwoot/package.json b/recipes/chatwoot/package.json new file mode 100644 index 0000000..6c024e7 --- /dev/null +++ b/recipes/chatwoot/package.json | |||
@@ -0,0 +1,11 @@ | |||
1 | { | ||
2 | "id": "chatwoot", | ||
3 | "name": "Chatwoot", | ||
4 | "version": "1.0.0", | ||
5 | "license": "MIT", | ||
6 | "repository": "https://github.com/maximeMD/ferdi-chatwoot", | ||
7 | "config": { | ||
8 | "serviceURL": "https://app.chatwoot.com/app/login" | ||
9 | } | ||
10 | } | ||
11 | \ No newline at end of file | ||
diff --git a/recipes/chatwoot/webview.js b/recipes/chatwoot/webview.js new file mode 100644 index 0000000..05e33b3 --- /dev/null +++ b/recipes/chatwoot/webview.js | |||
@@ -0,0 +1,14 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | const getMessages = function getMessages() { | ||
3 | const unreadBadges = document.querySelectorAll("span.unread"); | ||
4 | const unreadBadgesArray = [...unreadBadges]; | ||
5 | const unreadMessagesCount = unreadBadgesArray.reduce( | ||
6 | (previousValue, currentBadge) => | ||
7 | previousValue + Ferdi.safeParseInt(currentBadge.textContent), | ||
8 | 0, | ||
9 | ); | ||
10 | Ferdi.setBadge(unreadMessagesCount); | ||
11 | }; | ||
12 | |||
13 | Ferdi.loop(getMessages); | ||
14 | }; | ||