diff --git a/recipes/hackernews/LICENSE b/recipes/hackernews/LICENSE new file mode 100644 index 000000000..77c148e06 --- /dev/null +++ b/recipes/hackernews/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Yuriy Badalyantc + +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/hackernews/icon.svg b/recipes/hackernews/icon.svg new file mode 100644 index 000000000..c8a4b2793 --- /dev/null +++ b/recipes/hackernews/icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/recipes/hackernews/index.js b/recipes/hackernews/index.js new file mode 100644 index 000000000..dd41f7287 --- /dev/null +++ b/recipes/hackernews/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/hackernews/package.json b/recipes/hackernews/package.json new file mode 100644 index 000000000..272e23584 --- /dev/null +++ b/recipes/hackernews/package.json @@ -0,0 +1,9 @@ +{ + "id": "hackernews", + "name": "Hacker News", + "version": "1.3.0", + "license": "MIT", + "config": { + "serviceURL": "https://news.ycombinator.com/" + } +} diff --git a/recipes/hackernews/webview.js b/recipes/hackernews/webview.js new file mode 100644 index 000000000..5c472fb35 --- /dev/null +++ b/recipes/hackernews/webview.js @@ -0,0 +1,20 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + +module.exports = Ferdium => { + const getMessages = () => { + // get unread messages + const count = document.querySelectorAll('.guilds-wrapper .badge').length; + + // set Ferdium badge + Ferdium.setBadge(count); + }; + + Ferdium.loop(getMessages); + + // Hide download message + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +};