From 8735813856440acb982db4fb1303e44a443c4298 Mon Sep 17 00:00:00 2001 From: Abdul Hafiz Muhammad <109435420+hafiz-muhammad@users.noreply.github.com> Date: Fri, 26 Aug 2022 23:09:00 -0400 Subject: Added Mailfence recipe. (#160) --- recipes/mailfence/LICENSE | 21 +++++++++++++++++++++ recipes/mailfence/icon.svg | 9 +++++++++ recipes/mailfence/index.js | 1 + recipes/mailfence/package.json | 10 ++++++++++ recipes/mailfence/webview.js | 27 +++++++++++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 recipes/mailfence/LICENSE create mode 100644 recipes/mailfence/icon.svg create mode 100644 recipes/mailfence/index.js create mode 100644 recipes/mailfence/package.json create mode 100644 recipes/mailfence/webview.js (limited to 'recipes') diff --git a/recipes/mailfence/LICENSE b/recipes/mailfence/LICENSE new file mode 100644 index 0000000..d4c6c0b --- /dev/null +++ b/recipes/mailfence/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Abdul Hafiz Muhammad + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/recipes/mailfence/icon.svg b/recipes/mailfence/icon.svg new file mode 100644 index 0000000..b6a384b --- /dev/null +++ b/recipes/mailfence/icon.svg @@ -0,0 +1,9 @@ + + index + + + + + + \ No newline at end of file diff --git a/recipes/mailfence/index.js b/recipes/mailfence/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/mailfence/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/mailfence/package.json b/recipes/mailfence/package.json new file mode 100644 index 0000000..7c9e98d --- /dev/null +++ b/recipes/mailfence/package.json @@ -0,0 +1,10 @@ +{ + "id": "mailfence", + "name": "Mailfence", + "version": "1.0.0", + "license": "MIT", + "repository": "https://github.com/hafiz-muhammad/ferdium-recipes", + "config": { + "serviceURL": "https://mailfence.com" + } +} diff --git a/recipes/mailfence/webview.js b/recipes/mailfence/webview.js new file mode 100644 index 0000000..309f4e8 --- /dev/null +++ b/recipes/mailfence/webview.js @@ -0,0 +1,27 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) +{ + return obj && obj.__esModule ? obj : + { + default: obj + }; +} + +module.exports = Ferdium => +{ + const getMessages = () => + { + let unreadCount = 0; + for (const counterElement of document.querySelectorAll('.GCSDBRWBMXB')) + { + const unreadCounter = Ferdium.safeParseInt(counterElement.textContent); + unreadCount = Math.max(unreadCount, unreadCounter); + } + + Ferdium.setBadge(unreadCount); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; \ No newline at end of file -- cgit v1.2.3-54-g00ecf