aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/kiwiirc/webview.js
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2022-07-08 21:49:19 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-07-08 22:40:13 +0530
commit2fff7fe2bbc1697b38cd253223722c2701eab70d (patch)
tree93f55712b4c6c48c907df1a25949743894f0a1d3 /recipes/kiwiirc/webview.js
parentFix indirect notification count in github recipe (fixes #108) (diff)
downloadferdium-recipes-2fff7fe2bbc1697b38cd253223722c2701eab70d.tar.gz
ferdium-recipes-2fff7fe2bbc1697b38cd253223722c2701eab70d.tar.zst
ferdium-recipes-2fff7fe2bbc1697b38cd253223722c2701eab70d.zip
New recipe: kiwi IRC
Diffstat (limited to 'recipes/kiwiirc/webview.js')
-rw-r--r--recipes/kiwiirc/webview.js34
1 files changed, 34 insertions, 0 deletions
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 @@
1const _path = _interopRequireDefault(require('path'));
2
3function _interopRequireDefault(obj) {
4 return obj && obj.__esModule ? obj : { default: obj };
5}
6
7module.exports = Ferdium => {
8 const getMessages = function getMessages() {
9 // eslint-disable-next-line no-undef
10 const unreadChannelsCount = kiwi.state.networks.reduce((count, network) => {
11 return (count += network.buffers.filter(buffer => {
12 return !buffer.name.startsWith('*') && buffer.flags.unread !== 0;
13 }).length);
14 }, 0);
15
16 // eslint-disable-next-line no-undef
17 const mentionedChannelsCount = kiwi.state.networks.reduce((count, network) => {
18 return (count += network.buffers.filter(buffer => {
19 return (
20 !buffer.name.startsWith('*') &&
21 buffer.flags.unread !== 0 &&
22 buffer.flags.highlight
23 );
24 }).length);
25 }, 0);
26
27 // set Ferdium badges
28 Ferdium.setBadge(mentionedChannelsCount, unreadChannelsCount);
29 };
30
31 Ferdium.loop(getMessages);
32
33 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
34};