Skip to content

Commit

Permalink
fix badge for Instagram (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mralexandresys authored Nov 26, 2023
1 parent dfac5cb commit 681f58e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion recipes/instagram-direct-messages/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
6 changes: 4 additions & 2 deletions recipes/instagram-direct-messages/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ setInterval(() => {

module.exports = Ferdium => {
const getMessages = () => {
const element = document.querySelector('a[href^="/direct/inbox"]');
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,
);
};

Expand Down
2 changes: 1 addition & 1 deletion recipes/instagram/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "instagram",
"name": "Instagram",
"version": "2.5.2",
"version": "2.5.3",
"license": "MIT",
"config": {
"serviceURL": "https://instagram.com/",
Expand Down
12 changes: 6 additions & 6 deletions recipes/instagram/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ module.exports = (Ferdium, settings) => {
);

const getMessages = () => {
const element = document.querySelector('a[href^="/direct/inbox"]');
if (element) {
Ferdium.setBadge(
element.textContent ? Ferdium.safeParseInt(element.textContent) : 0,
);
}
const element = document.querySelector('a[href^="/direct/inbox"] span');
Ferdium.setBadge(
element && element.textContent
? Ferdium.safeParseInt(element.textContent)
: 0,
);
};

Ferdium.loop(getMessages);
Expand Down

0 comments on commit 681f58e

Please sign in to comment.