aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Bruno Rossetto <brunoccr@gmail.com>2022-02-16 08:37:26 -0300
committerLibravatar GitHub <noreply@github.com>2022-02-16 12:37:26 +0100
commit7e4f479b888e9c47faf074962140eb66803a557b (patch)
tree3912c4e54a04d6c5ed6f498b0a67ef9aeba961db /recipes
parentdocs: add brunoccr as a contributor for code (#835) (diff)
downloadferdium-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>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/feedly/package.json2
-rw-r--r--recipes/feedly/webview.js11
2 files changed, 8 insertions, 5 deletions
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);