diff options
Diffstat (limited to 'recipes/kiwiirc/webview.js')
-rw-r--r-- | recipes/kiwiirc/webview.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/recipes/kiwiirc/webview.js b/recipes/kiwiirc/webview.js index 0c362f0..ef6c930 100644 --- a/recipes/kiwiirc/webview.js +++ b/recipes/kiwiirc/webview.js | |||
@@ -1,28 +1,33 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | 1 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | 2 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 3 | } |
6 | 4 | ||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
8 | const getMessages = function getMessages() { | 8 | const getMessages = function getMessages() { |
9 | // eslint-disable-next-line no-undef | 9 | // eslint-disable-next-line no-undef |
10 | const unreadChannelsCount = kiwi.state.networks.reduce((count, network) => { | 10 | const unreadChannelsCount = kiwi.state.networks.reduce((count, network) => { |
11 | // eslint-disable-next-line no-param-reassign | ||
11 | return (count += network.buffers.filter(buffer => { | 12 | return (count += network.buffers.filter(buffer => { |
12 | return !buffer.name.startsWith('*') && buffer.flags.unread !== 0; | 13 | return !buffer.name.startsWith('*') && buffer.flags.unread !== 0; |
13 | }).length); | 14 | }).length); |
14 | }, 0); | 15 | }, 0); |
15 | 16 | ||
16 | // eslint-disable-next-line no-undef | 17 | // eslint-disable-next-line no-undef |
17 | const mentionedChannelsCount = kiwi.state.networks.reduce((count, network) => { | 18 | const mentionedChannelsCount = kiwi.state.networks.reduce( |
18 | return (count += network.buffers.filter(buffer => { | 19 | (count, network) => { |
19 | return ( | 20 | // eslint-disable-next-line no-param-reassign |
20 | !buffer.name.startsWith('*') && | 21 | return (count += network.buffers.filter(buffer => { |
21 | buffer.flags.unread !== 0 && | 22 | return ( |
22 | buffer.flags.highlight | 23 | !buffer.name.startsWith('*') && |
23 | ); | 24 | buffer.flags.unread !== 0 && |
24 | }).length); | 25 | buffer.flags.highlight |
25 | }, 0); | 26 | ); |
27 | }).length); | ||
28 | }, | ||
29 | 0, | ||
30 | ); | ||
26 | 31 | ||
27 | // set Ferdium badges | 32 | // set Ferdium badges |
28 | Ferdium.setBadge(mentionedChannelsCount, unreadChannelsCount); | 33 | Ferdium.setBadge(mentionedChannelsCount, unreadChannelsCount); |