From 2efcbcac8d055cbf4630813761ee0cdde84645ea Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Fri, 3 Dec 2021 13:16:42 +0100 Subject: chore: upgrade dependencies to latest (#782) * chore: upgrade dependencies to latest - upgrade all dependencies to latest - add --report-unused-disable-directives flag to lint script - remove unused files reported by unicorn/no-empty-file - minor cleanup of circuit recipe - remove webview.js check in package.js --- recipes/circuit/webview.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'recipes/circuit/webview.js') diff --git a/recipes/circuit/webview.js b/recipes/circuit/webview.js index 8cd2e2f..c04022d 100644 --- a/recipes/circuit/webview.js +++ b/recipes/circuit/webview.js @@ -1,11 +1,16 @@ module.exports = Ferdi => { - const getMessages = function getMessages() { + const getMessages = () => { // Get value of tag where in case of new messages the number of messages appear - const titleValue = document.querySelector('title').text; - const match = titleValue.match(/\d+/); - const unread = match != null && match.length > 0 ? match[0] : 0; + const title = document.querySelector('title'); + if (title) { + const titleValue = title.text; + // Extract the number from the tag + const match = titleValue.match(/\d+/); + const unread = match != null && match.length > 0 ? match[0] : 0; - Ferdi.setBadge(Ferdi.safeParseInt(unread)); + // Set unread msgs badge + Ferdi.setBadge(Ferdi.safeParseInt(unread)); + } }; Ferdi.loop(getMessages); -- cgit v1.2.3-54-g00ecf