diff options
author | Bruno Rossetto <brunoccr@gmail.com> | 2022-02-16 08:37:26 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 12:37:26 +0100 |
commit | 7e4f479b888e9c47faf074962140eb66803a557b (patch) | |
tree | 3912c4e54a04d6c5ed6f498b0a67ef9aeba961db | |
parent | docs: add brunoccr as a contributor for code (#835) (diff) | |
download | ferdium-recipes-7e4f479b888e9c47faf074962140eb66803a557b.tar.gz ferdium-recipes-7e4f479b888e9c47faf074962140eb66803a557b.tar.zst ferdium-recipes-7e4f479b888e9c47faf074962140eb66803a557b.zip |
Fix Feedly counter script when no pending article to read (#826)
Co-authored-by: Bruno Rossetto <bruno.rossetto@sottelli.com>
-rw-r--r-- | all.json | 2 | ||||
-rw-r--r-- | recipes/feedly/package.json | 2 | ||||
-rw-r--r-- | recipes/feedly/webview.js | 11 |
3 files changed, 9 insertions, 6 deletions
@@ -454,7 +454,7 @@ | |||
454 | "featured": false, | 454 | "featured": false, |
455 | "id": "feedly", | 455 | "id": "feedly", |
456 | "name": "Feedly", | 456 | "name": "Feedly", |
457 | "version": "1.1.2", | 457 | "version": "1.1.3", |
458 | "icons": { | 458 | "icons": { |
459 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/feedly/icon.svg" | 459 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/feedly/icon.svg" |
460 | } | 460 | } |
diff --git a/recipes/feedly/package.json b/recipes/feedly/package.json index 70442bc..c1fa2ed 100644 --- a/recipes/feedly/package.json +++ b/recipes/feedly/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "feedly", | 2 | "id": "feedly", |
3 | "name": "Feedly", | 3 | "name": "Feedly", |
4 | "version": "1.1.2", | 4 | "version": "1.1.3", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://feedly.com" | 7 | "serviceURL": "https://feedly.com" |
diff --git a/recipes/feedly/webview.js b/recipes/feedly/webview.js index 3e15fd5..c1108ff 100644 --- a/recipes/feedly/webview.js +++ b/recipes/feedly/webview.js | |||
@@ -2,11 +2,14 @@ module.exports = Ferdi => { | |||
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | const newsDOM = document.querySelectorAll( | 3 | const newsDOM = document.querySelectorAll( |
4 | "div[title='All'] > .LeftnavListRow__count", | 4 | "div[title='All'] > .LeftnavListRow__count", |
5 | )[0].textContent; | 5 | ); |
6 | let counter = Ferdi.safeParseInt(newsDOM); | ||
7 | 6 | ||
8 | if (newsDOM && (newsDOM.includes('K') || newsDOM.includes('+'))) { | 7 | let counter = 0; |
9 | counter = `${newsDOM.slice(0, Math.max(0, newsDOM.indexOf('K')))}000`; | 8 | |
9 | if (newsDOM && newsDOM.length > 0) { | ||
10 | const textContent = newsDOM[0].textContent; | ||
11 | |||
12 | counter = textContent.includes('K') || textContent.includes('+') ? `${textContent.slice(0, Math.max(0, textContent.indexOf('K')))}000` : Ferdi.safeParseInt(textContent); | ||
10 | } | 13 | } |
11 | 14 | ||
12 | Ferdi.setBadge(counter); | 15 | Ferdi.setBadge(counter); |