From 2fff7fe2bbc1697b38cd253223722c2701eab70d Mon Sep 17 00:00:00 2001 From: Vijay A Date: Fri, 8 Jul 2022 21:49:19 +0530 Subject: New recipe: kiwi IRC --- recipes/kiwiirc/icon.svg | 168 +++++++++++++++++++++++++++++++++++++++++++ recipes/kiwiirc/index.js | 1 + recipes/kiwiirc/package.json | 10 +++ recipes/kiwiirc/service.css | 5 ++ recipes/kiwiirc/webview.js | 34 +++++++++ 5 files changed, 218 insertions(+) create mode 100644 recipes/kiwiirc/icon.svg create mode 100644 recipes/kiwiirc/index.js create mode 100644 recipes/kiwiirc/package.json create mode 100644 recipes/kiwiirc/service.css create mode 100644 recipes/kiwiirc/webview.js (limited to 'recipes/kiwiirc') diff --git a/recipes/kiwiirc/icon.svg b/recipes/kiwiirc/icon.svg new file mode 100644 index 0000000..da150b5 --- /dev/null +++ b/recipes/kiwiirc/icon.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/recipes/kiwiirc/index.js b/recipes/kiwiirc/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/kiwiirc/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/kiwiirc/package.json b/recipes/kiwiirc/package.json new file mode 100644 index 0000000..9c0b7b7 --- /dev/null +++ b/recipes/kiwiirc/package.json @@ -0,0 +1,10 @@ +{ + "id": "kiwiirc", + "name": "KiwiIRC", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://kiwiirc.com/nextclient/", + "hasNotificationSound": true + } +} diff --git a/recipes/kiwiirc/service.css b/recipes/kiwiirc/service.css new file mode 100644 index 0000000..2d8c1a6 --- /dev/null +++ b/recipes/kiwiirc/service.css @@ -0,0 +1,5 @@ +.app-wrapper-web .app { + width: 100% !important; + height: 100% !important; + top: 0 !important; +} diff --git a/recipes/kiwiirc/webview.js b/recipes/kiwiirc/webview.js new file mode 100644 index 0000000..0c362f0 --- /dev/null +++ b/recipes/kiwiirc/webview.js @@ -0,0 +1,34 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = function getMessages() { + // eslint-disable-next-line no-undef + const unreadChannelsCount = kiwi.state.networks.reduce((count, network) => { + return (count += network.buffers.filter(buffer => { + return !buffer.name.startsWith('*') && buffer.flags.unread !== 0; + }).length); + }, 0); + + // eslint-disable-next-line no-undef + const mentionedChannelsCount = kiwi.state.networks.reduce((count, network) => { + return (count += network.buffers.filter(buffer => { + return ( + !buffer.name.startsWith('*') && + buffer.flags.unread !== 0 && + buffer.flags.highlight + ); + }).length); + }, 0); + + // set Ferdium badges + Ferdium.setBadge(mentionedChannelsCount, unreadChannelsCount); + }; + + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-54-g00ecf