From a7674ffb0f3f1c38adddfcdcefbe0851bcf25acb Mon Sep 17 00:00:00 2001 From: Edmundo Sanchez Date: Tue, 13 Sep 2022 01:40:26 -0500 Subject: Add service OnMail (#174) --- recipes/onmail/icon.svg | 69 +++++++++++++++++++++++++++++++++++++++++++++ recipes/onmail/index.js | 1 + recipes/onmail/package.json | 9 ++++++ recipes/onmail/webview.js | 22 +++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 recipes/onmail/icon.svg create mode 100644 recipes/onmail/index.js create mode 100644 recipes/onmail/package.json create mode 100644 recipes/onmail/webview.js (limited to 'recipes/onmail') diff --git a/recipes/onmail/icon.svg b/recipes/onmail/icon.svg new file mode 100644 index 0000000..8e61b0e --- /dev/null +++ b/recipes/onmail/icon.svg @@ -0,0 +1,69 @@ + + diff --git a/recipes/onmail/index.js b/recipes/onmail/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/onmail/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/onmail/package.json b/recipes/onmail/package.json new file mode 100644 index 0000000..70b7e11 --- /dev/null +++ b/recipes/onmail/package.json @@ -0,0 +1,9 @@ +{ + "id": "onmail", + "name": "onMail", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://mail.onmail.com" + } +} diff --git a/recipes/onmail/webview.js b/recipes/onmail/webview.js new file mode 100644 index 0000000..8565d76 --- /dev/null +++ b/recipes/onmail/webview.js @@ -0,0 +1,22 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = () => { + let countImportant = 0; + const inboxLinks = document.querySelectorAll('p.truncate'); + for (const label of inboxLinks){ + if (label.textContent) { + countImportant = Ferdium.safeParseInt(label.nextSibling.textContent); + break; + } + } + Ferdium.setBadge(countImportant, 0); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-70-g09d2