aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/chatwork/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/chatwork/webview.js')
-rw-r--r--recipes/chatwork/webview.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/recipes/chatwork/webview.js b/recipes/chatwork/webview.js
index e131093..cc40834 100644
--- a/recipes/chatwork/webview.js
+++ b/recipes/chatwork/webview.js
@@ -1,7 +1,5 @@
1module.exports = (Ferdi) => { 1module.exports = (Ferdi) => {
2 function getMessages() { 2 function getMessages() {
3 let groupCount = 0;
4 let individualCount = 0;
5 let directCount = 0; 3 let directCount = 0;
6 let indirectCount = 0; 4 let indirectCount = 0;
7 const roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq'); 5 const roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq');
@@ -11,20 +9,17 @@ module.exports = (Ferdi) => {
11 const unreadBadgeHasMention = room.querySelector('li._unreadBadge.sc-cSHVUG'); 9 const unreadBadgeHasMention = room.querySelector('li._unreadBadge.sc-cSHVUG');
12 10
13 if (unreadBadge && unreadBadge.innerText) { 11 if (unreadBadge && unreadBadge.innerText) {
14 count = parseInt(unreadBadge.innerText); 12 count = Ferdi.safeParseInt(unreadBadge.innerText);
15 } 13 }
16 14
17 if (count > 0) { 15 if (count > 0) {
18 if (room.querySelector('img.sc-gqjmRU').getAttribute('src').indexOf('avatar') < 0) { 16 if (room.querySelector('img.sc-gqjmRU').getAttribute('src').indexOf('avatar') < 0) {
19 groupCount += count;
20
21 if (unreadBadgeHasMention) { 17 if (unreadBadgeHasMention) {
22 directCount++; 18 directCount++;
23 } else { 19 } else {
24 indirectCount++; 20 indirectCount++;
25 } 21 }
26 } else { 22 } else {
27 individualCount += count;
28 directCount++; 23 directCount++;
29 } 24 }
30 } 25 }