diff options
Diffstat (limited to 'recipes/chatwork')
-rw-r--r-- | recipes/chatwork/index.js | 4 | ||||
-rw-r--r-- | recipes/chatwork/webview.js | 16 |
2 files changed, 8 insertions, 12 deletions
diff --git a/recipes/chatwork/index.js b/recipes/chatwork/index.js index a409287..258da41 100644 --- a/recipes/chatwork/index.js +++ b/recipes/chatwork/index.js | |||
@@ -1,3 +1 @@ | |||
1 | 'use strict'; | module.exports = Franz => Franz; | |
2 | |||
3 | module.exports = Franz => Franz; \ No newline at end of file | ||
diff --git a/recipes/chatwork/webview.js b/recipes/chatwork/webview.js index 48a3fbf..c6465ec 100644 --- a/recipes/chatwork/webview.js +++ b/recipes/chatwork/webview.js | |||
@@ -1,23 +1,21 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | module.exports = (Franz, options) => { | 1 | module.exports = (Franz, options) => { |
4 | function getMessages() { | 2 | function getMessages() { |
5 | let groupCount = 0; | 3 | let groupCount = 0; |
6 | let individualCount = 0; | 4 | let individualCount = 0; |
7 | let directCount = 0; | 5 | let directCount = 0; |
8 | let indirectCount = 0; | 6 | let indirectCount = 0; |
9 | let roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq'); | 7 | const roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq'); |
10 | Array.prototype.forEach.call(roomInfoContainer, function (room) { | 8 | Array.prototype.forEach.call(roomInfoContainer, (room) => { |
11 | let count = 0; | 9 | let count = 0; |
12 | let unreadBadge = room.querySelector("span.sc-kAzzGY"); | 10 | const unreadBadge = room.querySelector('span.sc-kAzzGY'); |
13 | let unreadBadgeHasMention = room.querySelector("li._unreadBadge.sc-cSHVUG"); | 11 | const unreadBadgeHasMention = room.querySelector('li._unreadBadge.sc-cSHVUG'); |
14 | 12 | ||
15 | if (unreadBadge && unreadBadge.innerText) { | 13 | if (unreadBadge && unreadBadge.innerText) { |
16 | count = parseInt(unreadBadge.innerText); | 14 | count = parseInt(unreadBadge.innerText); |
17 | } | 15 | } |
18 | 16 | ||
19 | if (0 < count) { | 17 | if (count > 0) { |
20 | if (room.querySelector("img.sc-gqjmRU").getAttribute('src').indexOf('avatar') < 0) { | 18 | if (room.querySelector('img.sc-gqjmRU').getAttribute('src').indexOf('avatar') < 0) { |
21 | groupCount += count; | 19 | groupCount += count; |
22 | 20 | ||
23 | if (unreadBadgeHasMention) { | 21 | if (unreadBadgeHasMention) { |
@@ -35,4 +33,4 @@ module.exports = (Franz, options) => { | |||
35 | } | 33 | } |
36 | 34 | ||
37 | Franz.loop(getMessages); | 35 | Franz.loop(getMessages); |
38 | }; \ No newline at end of file | 36 | }; |