From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/producthunt/webview.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'recipes/producthunt') diff --git a/recipes/producthunt/webview.js b/recipes/producthunt/webview.js index c03de9b..7f6c74b 100644 --- a/recipes/producthunt/webview.js +++ b/recipes/producthunt/webview.js @@ -1,7 +1,13 @@ -module.exports = (Ferdi) => { +module.exports = Ferdi => { + const notificationsSelector = document.querySelector( + '[class*=header_] [class*=content_] [class*=actions_] [class*=notificationsButton_]', + ); + const getMessages = () => { - Ferdi.setBadge(document.querySelector('[class*=header_] [class*=content_] [class*=actions_] [class*=notificationsButton_]').innerText) - } + if (notificationsSelector) { + Ferdi.setBadge(notificationsSelector.textContent); + } + }; - Ferdi.loop(getMessages) -} + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2