diff options
-rw-r--r-- | recipes/cinny/icon.svg | 14 | ||||
-rw-r--r-- | recipes/cinny/index.js | 1 | ||||
-rw-r--r-- | recipes/cinny/package.json | 17 | ||||
-rw-r--r-- | recipes/cinny/webview.js | 22 |
4 files changed, 54 insertions, 0 deletions
diff --git a/recipes/cinny/icon.svg b/recipes/cinny/icon.svg new file mode 100644 index 0000000..241eb5c --- /dev/null +++ b/recipes/cinny/icon.svg | |||
@@ -0,0 +1,14 @@ | |||
1 | <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In --> | ||
2 | <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="18px" height="18px" viewBox="0 0 18 18" enable-background="new 0 0 18 18" xml:space="preserve"> | ||
3 | <defs> | ||
4 | </defs> | ||
5 | <g> | ||
6 | <g> | ||
7 | <circle fill="#FFFFFF" cx="9" cy="9" r="8.5"/> | ||
8 | </g> | ||
9 | <g> | ||
10 | <path d="M9,0C4,0,0,4,0,9c0,5,4,9,9,9c5,0,9-4,9-9C18,4,14,0,9,0z M1.2,10.8l3.5-2.3c0-0.1,0-0.2,0-0.3c0-1.8,1.3-3.2,3.1-3.4 c0.1,0,0.2,0,0.4,0c1.2,0,2.3,0.6,2.9,1.6c0.3-0.1,0.6-0.1,0.9-0.1c0.4,0,0.8,0,1.2,0.1c0.7,0.2,1.4,0.5,2,0.9 C14.6,7.1,14,7,13.3,7c-1.2,0-2.2,0.4-2.9,1.4c-0.7,0.9-1.1,2-1.1,3.2c0,1.5-0.4,2.9-1.3,4.2c-0.3,0.4-0.5,0.7-0.8,1 C4.2,16.1,1.9,13.8,1.2,10.8z"/> | ||
11 | <circle cx="9.5" cy="6.4" r="0.5"/> | ||
12 | </g> | ||
13 | </g> | ||
14 | <script xmlns=""/></svg> \ No newline at end of file | ||
diff --git a/recipes/cinny/index.js b/recipes/cinny/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/cinny/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = Ferdium => Ferdium; | |||
diff --git a/recipes/cinny/package.json b/recipes/cinny/package.json new file mode 100644 index 0000000..5250882 --- /dev/null +++ b/recipes/cinny/package.json | |||
@@ -0,0 +1,17 @@ | |||
1 | { | ||
2 | "id": "cinny", | ||
3 | "name": "Cinny", | ||
4 | "version": "1.0.0", | ||
5 | "license": "MIT", | ||
6 | "aliases": [ | ||
7 | "Matrix" | ||
8 | ], | ||
9 | "config": { | ||
10 | "serviceURL": "https://app.cinny.in/", | ||
11 | "hasCustomUrl": true, | ||
12 | "message": "Cinny's default URL is https://app.cinny.in/", | ||
13 | "hasNotificationSound": true, | ||
14 | "hasDirectMessages": true, | ||
15 | "hasIndirectMessages": true | ||
16 | } | ||
17 | } | ||
diff --git a/recipes/cinny/webview.js b/recipes/cinny/webview.js new file mode 100644 index 0000000..f4fd306 --- /dev/null +++ b/recipes/cinny/webview.js | |||
@@ -0,0 +1,22 @@ | |||
1 | module.exports = Ferdium => { | ||
2 | function getMessages() { | ||
3 | // Number of messages from rooms which has "All Messages" notifications enabled or when mentionned in a room with "Mentions & Keyword" notifications level. | ||
4 | let directCount = 0; | ||
5 | // Number of messages for rooms which has "Mentions & Keyword" notifications level set which does not directly mention you. | ||
6 | let indirectCount = 0; | ||
7 | |||
8 | // Retrieves notification badges | ||
9 | const badges = document.querySelectorAll('.sidebar .notification-badge'); | ||
10 | for (const badge of badges) { | ||
11 | if (badge.childNodes.length === 0) { | ||
12 | indirectCount++; | ||
13 | } else { | ||
14 | directCount += Ferdium.safeParseInt(badge.childNodes[0].textContent); | ||
15 | } | ||
16 | } | ||
17 | |||
18 | // Set Ferdium badge | ||
19 | Ferdium.setBadge(directCount, indirectCount); | ||
20 | } | ||
21 | Ferdium.loop(getMessages); | ||
22 | }; | ||