From c3e65335dd85250f3d65c30b1d74d050c42b9918 Mon Sep 17 00:00:00 2001 From: Alexandre <32882826+Mralexandresys@users.noreply.github.com> Date: Sat, 25 Nov 2023 23:18:11 +0100 Subject: [PATCH] Upgrade version and fix If not notification on instagram element html as null, set 0 if not notification --- recipes/instagram-direct-messages/package.json | 2 +- recipes/instagram-direct-messages/webview.js | 2 +- recipes/instagram/package.json | 2 +- recipes/instagram/webview.js | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/recipes/instagram-direct-messages/package.json b/recipes/instagram-direct-messages/package.json index 41aa129f4..ab94fae76 100644 --- a/recipes/instagram-direct-messages/package.json +++ b/recipes/instagram-direct-messages/package.json @@ -1,7 +1,7 @@ { "id": "instagram-direct-messages", "name": "Instagram Direct Messages", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "config": { "serviceURL": "https://www.instagram.com/direct/inbox/", diff --git a/recipes/instagram-direct-messages/webview.js b/recipes/instagram-direct-messages/webview.js index e3cc241d9..d297ac50a 100644 --- a/recipes/instagram-direct-messages/webview.js +++ b/recipes/instagram-direct-messages/webview.js @@ -14,7 +14,7 @@ module.exports = Ferdium => { const getMessages = () => { const element = document.querySelector('a[href^="/direct/inbox"] span'); Ferdium.setBadge( - element.textContent ? Ferdium.safeParseInt(element.textContent) : 0, + element && element.textContent ? Ferdium.safeParseInt(element.textContent) : 0, ); }; diff --git a/recipes/instagram/package.json b/recipes/instagram/package.json index e0449bb7c..742516424 100644 --- a/recipes/instagram/package.json +++ b/recipes/instagram/package.json @@ -1,7 +1,7 @@ { "id": "instagram", "name": "Instagram", - "version": "2.5.2", + "version": "2.5.3", "license": "MIT", "config": { "serviceURL": "https://instagram.com/", diff --git a/recipes/instagram/webview.js b/recipes/instagram/webview.js index dcf9d5b1d..290aea62b 100644 --- a/recipes/instagram/webview.js +++ b/recipes/instagram/webview.js @@ -41,11 +41,10 @@ module.exports = (Ferdium, settings) => { const getMessages = () => { const element = document.querySelector('a[href^="/direct/inbox"] span'); - if (element) { - Ferdium.setBadge( - element.textContent ? Ferdium.safeParseInt(element.textContent) : 0, - ); - } + Ferdium.setBadge( + element && element.textContent ? Ferdium.safeParseInt(element.textContent) : 0, + ); + }; Ferdium.loop(getMessages);