From 08a7af9ef2bb0030fd1876674d53b719e91f13e2 Mon Sep 17 00:00:00 2001 From: Carlos SolĂ­s Date: Tue, 21 Jun 2022 09:39:54 -0600 Subject: Add fixes for Nextcloud-related webapps (#66) --- recipes/nextcloud-talk/webview.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'recipes/nextcloud-talk/webview.js') diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js index 1ae3783..77b969b 100644 --- a/recipes/nextcloud-talk/webview.js +++ b/recipes/nextcloud-talk/webview.js @@ -5,21 +5,24 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de module.exports = Ferdium => { const getMessages = () => { let direct = 0; + const notificationWrapper = document.querySelector( '.notifications .notification-wrapper', ); if (notificationWrapper) { - direct = notificationWrapper.querySelectorAll( + const directSelector = notificationWrapper.querySelectorAll( '.notification[object_type="chat"], .notification[object_type="room"]', - ).length; + ); + direct = directSelector ? Ferdium.safeParseInt(directSelector.length) : 0; } let indirect = 0; for (const counter of document.querySelectorAll('.app-navigation-entry__counter')) { - indirect += Number(counter.textContent); - } + const entryCounter = Ferdium.safeParseInt(counter.textContent) : 0; + indirect += entryCounter; + } if (document.title.startsWith("*")) { indirect++; -- cgit v1.2.3-70-g09d2