From 57ba0c384871f14c27428f4b07b233e0fd2f4733 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 12 Sep 2021 07:07:08 +0530 Subject: New service: 'whereby' (#683) --- recipes/whereby/icon.svg | 18 ++++++++++++++++++ recipes/whereby/index.js | 1 + recipes/whereby/package.json | 12 ++++++++++++ recipes/whereby/service.css | 5 +++++ recipes/whereby/webview.js | 25 +++++++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 recipes/whereby/icon.svg create mode 100644 recipes/whereby/index.js create mode 100644 recipes/whereby/package.json create mode 100644 recipes/whereby/service.css create mode 100644 recipes/whereby/webview.js (limited to 'recipes') diff --git a/recipes/whereby/icon.svg b/recipes/whereby/icon.svg new file mode 100644 index 0000000..02c850b --- /dev/null +++ b/recipes/whereby/icon.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/recipes/whereby/index.js b/recipes/whereby/index.js new file mode 100644 index 0000000..23607bd --- /dev/null +++ b/recipes/whereby/index.js @@ -0,0 +1 @@ +module.exports = Ferdi => Ferdi; diff --git a/recipes/whereby/package.json b/recipes/whereby/package.json new file mode 100644 index 0000000..5ca5c17 --- /dev/null +++ b/recipes/whereby/package.json @@ -0,0 +1,12 @@ +{ + "id": "whereby", + "name": "whereby.com", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://whereby.com/{teamId}", + "hasNotificationSound": true, + "hasTeamId": true, + "urlInputPrefix": "https://whereby.com/" + } +} diff --git a/recipes/whereby/service.css b/recipes/whereby/service.css new file mode 100644 index 0000000..b453fd4 --- /dev/null +++ b/recipes/whereby/service.css @@ -0,0 +1,5 @@ +.app-wrapper-web .app { + width: 100% !important; + height: 100% !important; + top: 0 !important; +} diff --git a/recipes/whereby/webview.js b/recipes/whereby/webview.js new file mode 100644 index 0000000..0e5529e --- /dev/null +++ b/recipes/whereby/webview.js @@ -0,0 +1,25 @@ +var _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = Ferdi => { + const getMessages = function getMessages() { + const elements = document.querySelectorAll('.CxUIE, .unread'); + let count = 0; + + for (let i = 0; i < elements.length; i += 1) { + if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { + count += 1; + } + } + + // set Ferdi badge + Ferdi.setBadge(count); + }; + + // check for new messages every second and update Ferdi badge + Ferdi.loop(getMessages); + + // inject Ferdi.css stylesheet + Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-54-g00ecf