diff options
Diffstat (limited to 'recipes/feedly/webview.js')
-rw-r--r-- | recipes/feedly/webview.js | 11 |
1 files changed, 7 insertions, 4 deletions
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); |