From 212d5846427ceeacfadf5aac3f381b532f4664a1 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Tue, 17 Aug 2021 10:47:32 +0530 Subject: Cleanup of recipes to remove 'NaN' of badge variables since this is handled in the main program. --- recipes/facebookpages/package.json | 2 +- recipes/facebookpages/webview.js | 4 ---- recipes/fastmail/package.json | 2 +- recipes/fastmail/webview.js | 4 +--- recipes/gmail/package.json | 2 +- recipes/gmail/webview.js | 6 ------ recipes/habitica/package.json | 2 +- recipes/habitica/webview.js | 3 --- recipes/icq/package.json | 2 +- recipes/icq/webview.js | 4 ---- recipes/inoreader/package.json | 2 +- recipes/inoreader/webview.js | 4 +--- recipes/monday/package.json | 2 +- recipes/monday/webview.js | 4 ---- recipes/notion/package.json | 2 +- recipes/notion/webview.js | 3 +-- recipes/proton-mail/package.json | 2 +- recipes/proton-mail/webview.js | 3 --- recipes/telegram/package.json | 2 +- recipes/telegram/webview.js | 14 +++++++++----- recipes/vk/package.json | 2 +- recipes/vk/webview.js | 4 ---- recipes/whatsapp/package.json | 2 +- recipes/whatsapp/webview.js | 4 ++-- 24 files changed, 26 insertions(+), 55 deletions(-) (limited to 'recipes') diff --git a/recipes/facebookpages/package.json b/recipes/facebookpages/package.json index a9b8b08..617e4e2 100644 --- a/recipes/facebookpages/package.json +++ b/recipes/facebookpages/package.json @@ -1,7 +1,7 @@ { "id": "facebookpages", "name": "Facebook Pages", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "config": { "serviceURL": "https://facebook.com/{teamId}/inbox", diff --git a/recipes/facebookpages/webview.js b/recipes/facebookpages/webview.js index 01ac1b6..0c646a9 100644 --- a/recipes/facebookpages/webview.js +++ b/recipes/facebookpages/webview.js @@ -7,10 +7,6 @@ module.exports = (Franz, options) => { messages = parseInt(element.textContent, 10); } - if (isNaN(messages)) { - messages = 0; - } - Franz.setBadge(messages); }; diff --git a/recipes/fastmail/package.json b/recipes/fastmail/package.json index 01da053..b0ded8f 100644 --- a/recipes/fastmail/package.json +++ b/recipes/fastmail/package.json @@ -1,7 +1,7 @@ { "id": "fastmail", "name": "FastMail", - "version": "2.0.1", + "version": "2.0.2", "license": "MIT", "config": { "serviceURL": "https://www.fastmail.com/mail/", diff --git a/recipes/fastmail/webview.js b/recipes/fastmail/webview.js index 48066fe..5355dbe 100644 --- a/recipes/fastmail/webview.js +++ b/recipes/fastmail/webview.js @@ -7,9 +7,7 @@ module.exports = (Franz) => { return; } const messages = Number(inbox.innerText); - if (!Number.isNaN(messages)) { - Franz.setBadge(messages); - } + Franz.setBadge(messages); }; Franz.injectJSUnsafe(path.join(__dirname, 'webview-unsafe.js')); diff --git a/recipes/gmail/package.json b/recipes/gmail/package.json index 27009af..502faff 100644 --- a/recipes/gmail/package.json +++ b/recipes/gmail/package.json @@ -1,7 +1,7 @@ { "id": "gmail", "name": "Gmail", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "config": { "serviceURL": "https://mail.google.com" diff --git a/recipes/gmail/webview.js b/recipes/gmail/webview.js index 681b36e..a26c7cb 100644 --- a/recipes/gmail/webview.js +++ b/recipes/gmail/webview.js @@ -18,12 +18,6 @@ module.exports = (Franz) => { } } - // Just incase we don't end up with a number, set it back to zero (parseInt can return NaN) - count = parseInt(count, 10); - if (isNaN(count)) { - count = 0; - } - // set Franz badge Franz.setBadge(count); }; diff --git a/recipes/habitica/package.json b/recipes/habitica/package.json index c9c593b..86539a4 100755 --- a/recipes/habitica/package.json +++ b/recipes/habitica/package.json @@ -1,7 +1,7 @@ { "id": "habitica", "name": "Habitica", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "repository": "https://github.com/lmnet/franz-recipe-notion", "config": { diff --git a/recipes/habitica/webview.js b/recipes/habitica/webview.js index 02b2e2d..5eb1c1c 100755 --- a/recipes/habitica/webview.js +++ b/recipes/habitica/webview.js @@ -4,9 +4,6 @@ module.exports = (Franz) => { const element = document.querySelector('.message-count'); if (element) { count = Number(element.innerText); - if (Number.isNaN(count)) { - count = 0; - } } Franz.setBadge(count); }; diff --git a/recipes/icq/package.json b/recipes/icq/package.json index f8180f0..13d0f5e 100644 --- a/recipes/icq/package.json +++ b/recipes/icq/package.json @@ -1,7 +1,7 @@ { "id": "icq", "name": "ICQ", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "repository": "https://github.com/meetfranz/recipe-icq", "config": { diff --git a/recipes/icq/webview.js b/recipes/icq/webview.js index 07888c2..9114d24 100644 --- a/recipes/icq/webview.js +++ b/recipes/icq/webview.js @@ -13,10 +13,6 @@ module.exports = Franz => { } } - if (isNaN(directs)) { - directs = 0; - } - Franz.setBadge(directs); }; diff --git a/recipes/inoreader/package.json b/recipes/inoreader/package.json index 6471e1d..2d0e0ed 100644 --- a/recipes/inoreader/package.json +++ b/recipes/inoreader/package.json @@ -1,7 +1,7 @@ { "id": "inoreader", "name": "Inoreader", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "repository": "https://github.com/annagrram/recipe-inoreader", "config": { diff --git a/recipes/inoreader/webview.js b/recipes/inoreader/webview.js index eaf9022..fddee5c 100644 --- a/recipes/inoreader/webview.js +++ b/recipes/inoreader/webview.js @@ -4,9 +4,7 @@ module.exports = (Franz) => { if (!all_articles) return; const unread_articles_cnt = Number(all_articles.textContent.split('+')[0]); - if (!Number.isNaN(unread_articles_cnt)) { - Franz.setBadge(unread_articles_cnt); - } + Franz.setBadge(unread_articles_cnt); }; Franz.loop(getMessages); diff --git a/recipes/monday/package.json b/recipes/monday/package.json index d7495f1..30436b6 100644 --- a/recipes/monday/package.json +++ b/recipes/monday/package.json @@ -1,7 +1,7 @@ { "id": "monday", "name": "Monday", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "config": { "serviceURL": "https://{teamId}.monday.com", diff --git a/recipes/monday/webview.js b/recipes/monday/webview.js index ff83694..e07e784 100755 --- a/recipes/monday/webview.js +++ b/recipes/monday/webview.js @@ -12,10 +12,6 @@ module.exports = Franz => { count += parseInt(counters[i].textContent); } - if (isNaN(count)) { - count = 0; - } - Franz.setBadge(count); }; diff --git a/recipes/notion/package.json b/recipes/notion/package.json index 13e37ee..974142c 100644 --- a/recipes/notion/package.json +++ b/recipes/notion/package.json @@ -1,7 +1,7 @@ { "id": "notion", "name": "Notion", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "repository": "https://github.com/TanZng/ferdi-notion", "config": { diff --git a/recipes/notion/webview.js b/recipes/notion/webview.js index d01434e..f87907e 100644 --- a/recipes/notion/webview.js +++ b/recipes/notion/webview.js @@ -4,8 +4,7 @@ module.exports = (Franz) => { const indirect = 0; const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div'); if (badgeDiv) { - const count = parseInt(badgeDiv.innerText); - direct = isNaN(count) ? 0 : count; + direct = parseInt(badgeDiv.innerText); } Franz.setBadge(direct, indirect); diff --git a/recipes/proton-mail/package.json b/recipes/proton-mail/package.json index 35952fc..da08733 100644 --- a/recipes/proton-mail/package.json +++ b/recipes/proton-mail/package.json @@ -1,7 +1,7 @@ { "id": "proton-mail", "name": "ProtonMail", - "version": "1.2.3", + "version": "1.2.4", "license": "MIT", "config": { "serviceURL": "https://mail.protonmail.com/login" diff --git a/recipes/proton-mail/webview.js b/recipes/proton-mail/webview.js index fd1a865..2417309 100644 --- a/recipes/proton-mail/webview.js +++ b/recipes/proton-mail/webview.js @@ -6,9 +6,6 @@ module.exports = Franz => { } const text = element.innerText; const count = Number(text.substring(1, text.length - 1)); - if (Number.isNaN(count)) { - return; - } Franz.setBadge(count); } diff --git a/recipes/telegram/package.json b/recipes/telegram/package.json index e0a7900..ee90470 100644 --- a/recipes/telegram/package.json +++ b/recipes/telegram/package.json @@ -1,7 +1,7 @@ { "id": "telegram", "name": "Telegram", - "version": "3.1.0", + "version": "3.1.1", "license": "MIT", "config": { "serviceURL": "https://web.telegram.org", diff --git a/recipes/telegram/webview.js b/recipes/telegram/webview.js index 8da63d1..db8c8d7 100644 --- a/recipes/telegram/webview.js +++ b/recipes/telegram/webview.js @@ -8,11 +8,15 @@ module.exports = Franz => { let count_sec = 0; const elements = document.querySelectorAll('.rp'); for (let i = 0; i < elements.length; i += 1) { - if (elements[i].querySelector('.dialog-subtitle-badge') && (!isNaN(parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText)))) { - if (parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText) != '' && (elements[i].dataset.peerId > 0)) { - count = +count + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText); - } else { - count_sec = +count_sec + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText); + const subtitleBadge = elements[i].querySelector('.dialog-subtitle-badge'); + if (subtitleBadge) { + const parsedValue = parseInt(subtitleBadge.innerText); + if (!isNaN(parsedValue)) { + if (elements[i].dataset.peerId > 0) { + count += parsedValue; + } else { + count_sec += parsedValue; + } } } } diff --git a/recipes/vk/package.json b/recipes/vk/package.json index 50a25f6..25e7bb8 100644 --- a/recipes/vk/package.json +++ b/recipes/vk/package.json @@ -1,7 +1,7 @@ { "id": "vk", "name": "VK", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "repository": "https://github.com/meetfranz/recipe-vk", "config": { diff --git a/recipes/vk/webview.js b/recipes/vk/webview.js index fcf0571..ab6c619 100644 --- a/recipes/vk/webview.js +++ b/recipes/vk/webview.js @@ -5,10 +5,6 @@ module.exports = Franz => { directs = parseInt(document.getElementsByClassName('left_count')[0].innerText, 10); } - if (isNaN(directs)) { - directs = 0; - } - Franz.setBadge(directs); }; diff --git a/recipes/whatsapp/package.json b/recipes/whatsapp/package.json index e05d9f6..a2f0bce 100644 --- a/recipes/whatsapp/package.json +++ b/recipes/whatsapp/package.json @@ -1,7 +1,7 @@ { "id": "whatsapp", "name": "WhatsApp", - "version": "3.1.0", + "version": "3.1.1", "license": "MIT", "config": { "serviceURL": "https://web.whatsapp.com", diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index c01b7d1..9050832 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js @@ -27,7 +27,7 @@ window.addEventListener('beforeunload', async () => { module.exports = Franz => { const getMessages = function getMessages() { let count = 0; - let indirectCount = 0; + let indirectCount = 0; const parentChatElem = document.querySelector('#pane-side').children[0].children[0].children[0]; const chatElems = parentChatElem.children; @@ -41,7 +41,7 @@ module.exports = Franz => { count += countValue; } else { indirectCount += countValue; - } + } } Franz.setBadge(count, indirectCount); -- cgit v1.2.3-54-g00ecf