From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/notion/README.md | 8 ++++++++ recipes/notion/icon.png | Bin 0 -> 43926 bytes recipes/notion/icon.svg | 7 +++++++ recipes/notion/index.js | 3 +++ recipes/notion/package.json | 15 +++++++++++++++ recipes/notion/webview.js | 17 +++++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 recipes/notion/README.md create mode 100644 recipes/notion/icon.png create mode 100644 recipes/notion/icon.svg create mode 100644 recipes/notion/index.js create mode 100644 recipes/notion/package.json create mode 100644 recipes/notion/webview.js (limited to 'recipes/notion') diff --git a/recipes/notion/README.md b/recipes/notion/README.md new file mode 100644 index 0000000..ac5c10a --- /dev/null +++ b/recipes/notion/README.md @@ -0,0 +1,8 @@ +# Ferdi-notion +A Notion recipe for Ferdi + +### Release notes +1.0.0: First version + +### How to create your own Ferdi recipes: +* [Read the documentation](https://github.com/getferdi/recipes/blob/master/docs/integration.md) diff --git a/recipes/notion/icon.png b/recipes/notion/icon.png new file mode 100644 index 0000000..cb3b715 Binary files /dev/null and b/recipes/notion/icon.png differ diff --git a/recipes/notion/icon.svg b/recipes/notion/icon.svg new file mode 100644 index 0000000..58047ab --- /dev/null +++ b/recipes/notion/icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/recipes/notion/index.js b/recipes/notion/index.js new file mode 100644 index 0000000..17daa35 --- /dev/null +++ b/recipes/notion/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; diff --git a/recipes/notion/package.json b/recipes/notion/package.json new file mode 100644 index 0000000..d94b340 --- /dev/null +++ b/recipes/notion/package.json @@ -0,0 +1,15 @@ +{ + "id": "notion", + "name": "Notion", + "version": "1.0.1", + "description": "Notion", + "main": "index.js", + "author": "Tania R. Zuniga ", + "license": "MIT", + "repository": "https://github.com/TanZng/ferdi-notion", + "config": { + "serviceURL": "https://www.notion.so/", + "hasIndirectMessages": true, + "hasNotificationSound": true + } +} diff --git a/recipes/notion/webview.js b/recipes/notion/webview.js new file mode 100644 index 0000000..5308626 --- /dev/null +++ b/recipes/notion/webview.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = (Franz) => { + function getMessages() { + let direct = 0; + let indirect = 0; + const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div'); + if (badgeDiv) { + const count = parseInt(badgeDiv.innerText); + direct = isNaN(count) ? 0 : count; + } + + Franz.setBadge(direct, indirect); + } + + Franz.loop(getMessages); +} -- cgit v1.2.3-70-g09d2