diff --git a/recipes/skiff-mail/icon.svg b/recipes/skiff-mail/icon.svg new file mode 100644 index 000000000..f64997d75 --- /dev/null +++ b/recipes/skiff-mail/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/skiff-mail/index.js b/recipes/skiff-mail/index.js new file mode 100644 index 000000000..dd41f7287 --- /dev/null +++ b/recipes/skiff-mail/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/skiff-mail/package.json b/recipes/skiff-mail/package.json new file mode 100644 index 000000000..1193c8219 --- /dev/null +++ b/recipes/skiff-mail/package.json @@ -0,0 +1,9 @@ +{ + "id": "skiff-mail", + "name": "Skiff Mail", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://app.skiff.com/mail/inbox" + } +} diff --git a/recipes/skiff-mail/webview.js b/recipes/skiff-mail/webview.js new file mode 100644 index 000000000..522b06266 --- /dev/null +++ b/recipes/skiff-mail/webview.js @@ -0,0 +1,17 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = () => { + const element = document.querySelector('div[href="/mail/inbox"]'); + const matches = element.textContent.match(/\d+/); + const unreadCount = Ferdium.safeParseInt(matches ? matches[0] : 0); + Ferdium.setBadge(unreadCount); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +};