From dfae2d231e39c81827d08fd8834d736c5b3005b1 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Tue, 31 Aug 2021 16:25:57 +0530 Subject: refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes. --- recipes/chatwork/webview.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'recipes/chatwork/webview.js') 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 @@ module.exports = (Ferdi) => { function getMessages() { - let groupCount = 0; - let individualCount = 0; let directCount = 0; let indirectCount = 0; const roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq'); @@ -11,20 +9,17 @@ module.exports = (Ferdi) => { const unreadBadgeHasMention = room.querySelector('li._unreadBadge.sc-cSHVUG'); if (unreadBadge && unreadBadge.innerText) { - count = parseInt(unreadBadge.innerText); + count = Ferdi.safeParseInt(unreadBadge.innerText); } if (count > 0) { if (room.querySelector('img.sc-gqjmRU').getAttribute('src').indexOf('avatar') < 0) { - groupCount += count; - if (unreadBadgeHasMention) { directCount++; } else { indirectCount++; } } else { - individualCount += count; directCount++; } } -- cgit v1.2.3-70-g09d2