From 00ddef3290732403dc1ca02b1c2ae7a7b6a796c3 Mon Sep 17 00:00:00 2001 From: Francisco Marques Date: Wed, 7 Oct 2020 15:24:54 +0100 Subject: Add recipe for Slite (#312) --- recipes/slite/README.md | 7 +++++++ recipes/slite/icon.png | Bin 0 -> 12363 bytes recipes/slite/icon.svg | 1 + recipes/slite/index.js | 3 +++ recipes/slite/package.json | 14 ++++++++++++++ recipes/slite/webview.js | 24 ++++++++++++++++++++++++ 6 files changed, 49 insertions(+) create mode 100644 recipes/slite/README.md create mode 100644 recipes/slite/icon.png create mode 100644 recipes/slite/icon.svg create mode 100644 recipes/slite/index.js create mode 100644 recipes/slite/package.json create mode 100644 recipes/slite/webview.js (limited to 'recipes/slite') diff --git a/recipes/slite/README.md b/recipes/slite/README.md new file mode 100644 index 0000000..ffc15d1 --- /dev/null +++ b/recipes/slite/README.md @@ -0,0 +1,7 @@ +# Slite for Ferdi + +This is a Ferdi recipe for [Slite](https://slite.com/) + +## Release notes + +1.0.0: First version \ No newline at end of file diff --git a/recipes/slite/icon.png b/recipes/slite/icon.png new file mode 100644 index 0000000..f18b347 Binary files /dev/null and b/recipes/slite/icon.png differ diff --git a/recipes/slite/icon.svg b/recipes/slite/icon.svg new file mode 100644 index 0000000..9648d20 --- /dev/null +++ b/recipes/slite/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/slite/index.js b/recipes/slite/index.js new file mode 100644 index 0000000..cd5b37c --- /dev/null +++ b/recipes/slite/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Ferdi => Ferdi; diff --git a/recipes/slite/package.json b/recipes/slite/package.json new file mode 100644 index 0000000..cbe8c0c --- /dev/null +++ b/recipes/slite/package.json @@ -0,0 +1,14 @@ +{ + "id": "slite", + "name": "Slite", + "version": "1.0.0", + "description": "slite", + "main": "index.js", + "author": "Ferdi ", + "license": "MIT", + "config": { + "serviceURL": "https://{teamId}.slite.com", + "hasTeamId": true, + "urlInputSuffix": ".slite.com" + } +} \ No newline at end of file diff --git a/recipes/slite/webview.js b/recipes/slite/webview.js new file mode 100644 index 0000000..6e0fa46 --- /dev/null +++ b/recipes/slite/webview.js @@ -0,0 +1,24 @@ +"use strict"; + +var _path = _interopRequireDefault(require("path")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = Ferdi => { + const getMessages = function getMessages() { + let direct = 0; + + const notificationButton = document.querySelector( + "#app button[data-test-id='notificationsCount'" + ); + + if (notificationButton) { + const notificationCount = parseInt(notificationButton.innerText); + direct = isNaN(notificationCount) ? 0 : notificationCount; + } + + Ferdi.setBadge(direct); + }; + + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2