From dfae2d231e39c81827d08fd8834d736c5b3005b1 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Tue, 31 Aug 2021 16:25:57 +0530 Subject: refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes. --- all.json | 130 ++++++++++++++++----------------- recipes/anydo/package.json | 2 +- recipes/anydo/webview.js | 2 +- recipes/aws-workmail/package.json | 2 +- recipes/aws-workmail/webview.js | 3 +- recipes/bip/package.json | 2 +- recipes/bip/webview.js | 3 +- recipes/campuswire/package.json | 2 +- recipes/campuswire/webview.js | 2 +- recipes/chatwork/package.json | 2 +- recipes/chatwork/webview.js | 7 +- recipes/ciscospark/package.json | 2 +- recipes/ciscospark/webview.js | 6 +- recipes/discord/package.json | 2 +- recipes/discord/webview.js | 4 +- recipes/disqus/package.json | 2 +- recipes/disqus/webview.js | 2 +- recipes/element/package.json | 2 +- recipes/element/webview.js | 14 ++-- recipes/erepublik/package.json | 2 +- recipes/erepublik/webview.js | 11 +-- recipes/facebook/package.json | 2 +- recipes/facebook/webview.js | 4 +- recipes/facebookpages/package.json | 2 +- recipes/facebookpages/webview.js | 2 +- recipes/feedly/package.json | 2 +- recipes/feedly/webview.js | 2 +- recipes/gadugadu/package.json | 2 +- recipes/gadugadu/webview.js | 13 +--- recipes/github/package.json | 2 +- recipes/github/webview.js | 13 ++-- recipes/glowing-bear/package.json | 2 +- recipes/glowing-bear/webview.js | 6 +- recipes/gmail/package.json | 2 +- recipes/gmail/webview.js | 5 +- recipes/google-voice/package.json | 2 +- recipes/google-voice/webview.js | 4 +- recipes/googleclassroom/package.json | 2 +- recipes/googleclassroom/webview.js | 2 +- recipes/guilded/package.json | 2 +- recipes/guilded/webview.js | 2 +- recipes/icq/package.json | 2 +- recipes/icq/webview.js | 13 +--- recipes/instagram/package.json | 2 +- recipes/instagram/webview.js | 2 +- recipes/intercom/package.json | 2 +- recipes/intercom/webview.js | 4 +- recipes/jira/package.json | 2 +- recipes/jira/webview.js | 5 +- recipes/lark/package.json | 2 +- recipes/lark/webview.js | 3 +- recipes/linkedin/package.json | 2 +- recipes/linkedin/webview.js | 3 +- recipes/messenger/package.json | 2 +- recipes/messenger/webview.js | 4 +- recipes/monday/package.json | 2 +- recipes/monday/webview.js | 2 +- recipes/msteams/package.json | 2 +- recipes/msteams/webview.js | 5 +- recipes/mysms/package.json | 2 +- recipes/mysms/webview.js | 3 +- recipes/nextdoor/package.json | 2 +- recipes/nextdoor/webview.js | 2 +- recipes/notion/package.json | 2 +- recipes/notion/webview.js | 5 +- recipes/office365-owa/package.json | 2 +- recipes/office365-owa/webview.js | 11 +-- recipes/pivotal-tracker/package.json | 2 +- recipes/pivotal-tracker/webview.js | 5 +- recipes/pleroma/package.json | 2 +- recipes/pleroma/webview.js | 4 +- recipes/plurk/package.json | 2 +- recipes/plurk/webview.js | 7 +- recipes/protonet/package.json | 2 +- recipes/protonet/webview.js | 4 +- recipes/rainloop/package.json | 2 +- recipes/rainloop/webview.js | 4 +- recipes/reddit/package.json | 2 +- recipes/reddit/webview.js | 3 +- recipes/riseup/package.json | 2 +- recipes/riseup/webview.js | 2 +- recipes/rocketchat/package.json | 2 +- recipes/rocketchat/webview.js | 2 +- recipes/roundcube/package.json | 2 +- recipes/roundcube/webview.js | 3 +- recipes/simplenote/package.json | 2 +- recipes/simplenote/webview.js | 3 +- recipes/skype/package.json | 2 +- recipes/skype/webview.js | 4 +- recipes/slite/package.json | 2 +- recipes/slite/webview.js | 12 +-- recipes/steamchat/package.json | 2 +- recipes/steamchat/webview.js | 2 +- recipes/teamleader/package.json | 2 +- recipes/teamleader/webview.js | 3 +- recipes/teamwork-projects/package.json | 2 +- recipes/teamwork-projects/webview.js | 2 +- recipes/telegram-react/package.json | 2 +- recipes/telegram-react/webview.js | 2 +- recipes/telegram/package.json | 2 +- recipes/telegram/webview.js | 12 ++- recipes/thelounge/package.json | 2 +- recipes/thelounge/webview.js | 5 +- recipes/threema/package.json | 2 +- recipes/threema/webview.js | 2 +- recipes/todoist/package.json | 2 +- recipes/todoist/webview.js | 4 +- recipes/tweetdeck/package.json | 2 +- recipes/tweetdeck/webview.js | 2 +- recipes/twitter-dm/package.json | 2 +- recipes/twitter-dm/webview.js | 3 +- recipes/vk/package.json | 2 +- recipes/vk/webview.js | 5 +- recipes/webex-teams/package.json | 2 +- recipes/webex-teams/webview.js | 6 +- recipes/wechat/package.json | 2 +- recipes/wechat/webview.js | 4 +- recipes/whatsapp/package.json | 2 +- recipes/whatsapp/webview.js | 2 +- recipes/wire/package.json | 2 +- recipes/wire/webview.js | 9 +-- recipes/workplace/package.json | 2 +- recipes/workplace/webview.js | 4 +- recipes/wrike/package.json | 2 +- recipes/wrike/webview.js | 5 +- recipes/xing/package.json | 2 +- recipes/xing/webview.js | 5 +- recipes/yammer/package.json | 2 +- recipes/yammer/webview.js | 8 +- recipes/zendesk/package.json | 2 +- recipes/zendesk/webview.js | 7 +- 131 files changed, 261 insertions(+), 313 deletions(-) diff --git a/all.json b/all.json index c779344..9753695 100644 --- a/all.json +++ b/all.json @@ -33,7 +33,7 @@ "featured": false, "id": "amazon-work-mail", "name": "Amazon WorkMail", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/amazon-work-mail/icon.svg" } @@ -60,7 +60,7 @@ "featured": false, "id": "anydo", "name": "Any.do", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/anydo/icon.svg" } @@ -117,7 +117,7 @@ "featured": false, "id": "bip", "name": "BiP", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/bip/icon.svg" } @@ -162,7 +162,7 @@ "featured": false, "id": "campuswire", "name": "Campuswire", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/campuswire/icon.svg" } @@ -189,7 +189,7 @@ "featured": false, "id": "chatwork", "name": "ChatWork", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/chatwork/icon.svg" } @@ -198,7 +198,7 @@ "featured": false, "id": "ciscospark", "name": "Cisco Spark", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/ciscospark/icon.svg" } @@ -252,7 +252,7 @@ "featured": true, "id": "discord", "name": "Discord", - "version": "1.3.0", + "version": "1.3.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/discord/icon.svg" } @@ -261,7 +261,7 @@ "featured": false, "id": "disqus", "name": "Disqus", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/disqus/icon.svg" } @@ -288,7 +288,7 @@ "featured": false, "id": "element", "name": "Element", - "version": "1.1.0", + "version": "1.1.1", "aliases": [ "Riot.im", "Matrix" @@ -310,7 +310,7 @@ "featured": false, "id": "erepublik", "name": "eRepublik", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/erepublik/icon.svg" } @@ -328,7 +328,7 @@ "featured": false, "id": "facebook", "name": "Facebook", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/facebook/icon.svg" } @@ -337,7 +337,7 @@ "featured": false, "id": "facebookpages", "name": "Facebook Pages", - "version": "1.2.1", + "version": "1.2.2", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/facebookpages/icon.svg" } @@ -364,7 +364,7 @@ "featured": false, "id": "feedly", "name": "Feedly", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/feedly/icon.svg" } @@ -409,7 +409,7 @@ "featured": false, "id": "gadugadu", "name": "Gadu-Gadu", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/gadugadu/icon.svg" } @@ -418,7 +418,7 @@ "featured": false, "id": "github", "name": "GitHub", - "version": "2.1.0", + "version": "2.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/github/icon.svg" } @@ -454,7 +454,7 @@ "featured": false, "id": "glowing-bear", "name": "glowing-bear", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/glowing-bear/icon.svg" } @@ -463,7 +463,7 @@ "featured": true, "id": "gmail", "name": "Gmail", - "version": "1.4.0", + "version": "1.4.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/gmail/icon.svg" } @@ -499,7 +499,7 @@ "featured": false, "id": "google-voice", "name": "google-voice", - "version": "0.4.0", + "version": "0.4.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/google-voice/icon.svg" } @@ -521,7 +521,7 @@ "featured": false, "id": "googleclassroom", "name": "Google Classroom", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/googleclassroom/icon.svg" } @@ -593,7 +593,7 @@ "featured": false, "id": "guilded", "name": "Guilded", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/guilded/icon.svg" } @@ -678,7 +678,7 @@ "featured": false, "id": "icq", "name": "ICQ", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/icq/icon.svg" } @@ -714,7 +714,7 @@ "featured": false, "id": "instagram", "name": "Instagram", - "version": "2.2.0", + "version": "2.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/instagram/icon.svg" } @@ -723,7 +723,7 @@ "featured": false, "id": "intercom", "name": "Intercom", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/intercom/icon.svg" } @@ -741,7 +741,7 @@ "featured": false, "id": "jira", "name": "Jira", - "version": "1.3.0", + "version": "1.3.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/jira/icon.svg" } @@ -795,7 +795,7 @@ "featured": false, "id": "lark", "name": "Lark", - "version": "0.1.0", + "version": "0.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/lark/icon.svg" } @@ -822,7 +822,7 @@ "featured": false, "id": "linkedin", "name": "LinkedIn", - "version": "1.2.0", + "version": "1.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/linkedin/icon.svg" } @@ -858,7 +858,7 @@ "featured": true, "id": "messenger", "name": "Messenger", - "version": "1.3.0", + "version": "1.3.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/messenger/icon.svg" } @@ -867,7 +867,7 @@ "featured": false, "id": "monday", "name": "Monday", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/monday/icon.svg" } @@ -885,7 +885,7 @@ "featured": false, "id": "msteams", "name": "Microsoft Teams", - "version": "3.1.0", + "version": "3.1.1", "aliases": [ "teamsChat" ], @@ -906,7 +906,7 @@ "featured": false, "id": "mysms", "name": "MySMS", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/mysms/icon.svg" } @@ -987,7 +987,7 @@ "featured": false, "id": "nextdoor", "name": "Nextdoor", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/nextdoor/icon.svg" } @@ -1014,7 +1014,7 @@ "featured": false, "id": "notion", "name": "Notion", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/notion/icon.svg" } @@ -1032,7 +1032,7 @@ "featured": false, "id": "office365-owa", "name": "Office 365 Outlook", - "version": "1.4.1", + "version": "1.4.2", "aliases": [ "live.com" ], @@ -1080,7 +1080,7 @@ "featured": false, "id": "pivotal-tracker", "name": "pivotal-tracker", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/pivotal-tracker/icon.svg" } @@ -1098,7 +1098,7 @@ "featured": false, "id": "pleroma", "name": "Pleroma", - "version": "1.1.1", + "version": "1.1.2", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/pleroma/icon.svg" } @@ -1107,7 +1107,7 @@ "featured": false, "id": "plurk", "name": "Plurk", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/plurk/icon.svg" } @@ -1161,7 +1161,7 @@ "featured": false, "id": "protonet", "name": "protonet", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/protonet/icon.svg" } @@ -1188,7 +1188,7 @@ "featured": false, "id": "rainloop", "name": "RainLoop", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/rainloop/icon.svg" } @@ -1197,7 +1197,7 @@ "featured": false, "id": "reddit", "name": "Reddit", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/reddit/icon.svg" } @@ -1215,7 +1215,7 @@ "featured": false, "id": "riseup", "name": "Riseup.net", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/riseup/icon.svg" } @@ -1224,7 +1224,7 @@ "featured": false, "id": "rocketchat", "name": "Rocket.Chat", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/rocketchat/icon.svg" } @@ -1233,7 +1233,7 @@ "featured": false, "id": "roundcube", "name": "Roundcube", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/roundcube/icon.svg" } @@ -1260,7 +1260,7 @@ "featured": false, "id": "simplenote", "name": "Simplenote", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/simplenote/icon.svg" } @@ -1269,7 +1269,7 @@ "featured": false, "id": "skype", "name": "Skype", - "version": "3.1.0", + "version": "3.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/skype/icon.svg" } @@ -1287,7 +1287,7 @@ "featured": false, "id": "slite", "name": "Slite", - "version": "1.0.3", + "version": "1.0.4", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/slite/icon.svg" } @@ -1323,7 +1323,7 @@ "featured": false, "id": "steamchat", "name": "SteamChat", - "version": "1.2.0", + "version": "1.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/steamchat/icon.svg" } @@ -1368,7 +1368,7 @@ "featured": false, "id": "teamleader", "name": "teamleader", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/teamleader/icon.svg" } @@ -1377,7 +1377,7 @@ "featured": false, "id": "teamwork-projects", "name": "Teamwork Projects", - "version": "0.2.0", + "version": "0.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/teamwork-projects/icon.svg" } @@ -1386,7 +1386,7 @@ "featured": true, "id": "telegram", "name": "Telegram", - "version": "3.2.0", + "version": "3.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/telegram/icon.svg" } @@ -1395,7 +1395,7 @@ "featured": false, "id": "telegram-react", "name": "Telegram React", - "version": "1.2.0", + "version": "1.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/telegram-react/icon.svg" } @@ -1404,7 +1404,7 @@ "featured": false, "id": "thelounge", "name": "The Lounge", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/thelounge/icon.svg" } @@ -1413,7 +1413,7 @@ "featured": false, "id": "threema", "name": "Threema", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/threema/icon.svg" } @@ -1440,7 +1440,7 @@ "featured": false, "id": "todoist", "name": "Todoist", - "version": "1.3.0", + "version": "1.3.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/todoist/icon.svg" } @@ -1476,7 +1476,7 @@ "featured": true, "id": "tweetdeck", "name": "Tweetdeck", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/tweetdeck/icon.svg" } @@ -1512,7 +1512,7 @@ "featured": false, "id": "twitter-dm", "name": "Twitter DM", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/twitter-dm/icon.svg" } @@ -1530,7 +1530,7 @@ "featured": false, "id": "vk", "name": "VK", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/vk/icon.svg" } @@ -1548,7 +1548,7 @@ "featured": false, "id": "webex-teams", "name": "Webex Teams", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/webex-teams/icon.svg" } @@ -1557,7 +1557,7 @@ "featured": false, "id": "wechat", "name": "WeChat", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/wechat/icon.svg" } @@ -1566,7 +1566,7 @@ "featured": true, "id": "whatsapp", "name": "WhatsApp", - "version": "3.2.0", + "version": "3.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/whatsapp/icon.svg" } @@ -1575,7 +1575,7 @@ "featured": false, "id": "wire", "name": "Wire", - "version": "1.0.2", + "version": "1.0.3", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/wire/icon.svg" } @@ -1593,7 +1593,7 @@ "featured": false, "id": "workplace", "name": "Workplace", - "version": "1.3.0", + "version": "1.3.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/workplace/icon.svg" } @@ -1602,7 +1602,7 @@ "featured": false, "id": "wrike", "name": "Wrike", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/wrike/icon.svg" } @@ -1611,7 +1611,7 @@ "featured": false, "id": "xing", "name": "XING", - "version": "1.2.0", + "version": "1.2.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/xing/icon.svg" } @@ -1629,7 +1629,7 @@ "featured": false, "id": "yammer", "name": "Yammer", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/yammer/icon.svg" } @@ -1665,7 +1665,7 @@ "featured": false, "id": "zendesk", "name": "zendesk", - "version": "1.1.0", + "version": "1.1.1", "icons": { "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/zendesk/icon.svg" } diff --git a/recipes/anydo/package.json b/recipes/anydo/package.json index e015aee..eb6d8d4 100644 --- a/recipes/anydo/package.json +++ b/recipes/anydo/package.json @@ -1,7 +1,7 @@ { "id": "anydo", "name": "Any.do", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/chappy84/recipe-anydo", "config": { diff --git a/recipes/anydo/webview.js b/recipes/anydo/webview.js index cdb7e4f..4f4749b 100644 --- a/recipes/anydo/webview.js +++ b/recipes/anydo/webview.js @@ -6,7 +6,7 @@ module.exports = (Ferdi) => { if (countEls.length) { Array.from(countEls).forEach((el) => { - incompleteCount += parseInt(el.innerHTML, 10); + incompleteCount += Ferdi.safeParseInt(el.innerHTML); }); } diff --git a/recipes/aws-workmail/package.json b/recipes/aws-workmail/package.json index 5641f43..e407dd2 100644 --- a/recipes/aws-workmail/package.json +++ b/recipes/aws-workmail/package.json @@ -1,7 +1,7 @@ { "id": "amazon-work-mail", "name": "Amazon WorkMail", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamID}.awsapps.com/mail", diff --git a/recipes/aws-workmail/webview.js b/recipes/aws-workmail/webview.js index 5c77d79..944a15c 100644 --- a/recipes/aws-workmail/webview.js +++ b/recipes/aws-workmail/webview.js @@ -16,8 +16,7 @@ module.exports = (Ferdi) => { let counter = 0; for (let i = 0; i < nodes.length; i++) { - const node = parseInt(nodes[i].innerText); - counter += (node > 0) ? node : 0; + counter += Ferdi.safeParseInt(nodes[i].innerText); } Ferdi.setBadge(counter); diff --git a/recipes/bip/package.json b/recipes/bip/package.json index 8898d1d..3bc6898 100644 --- a/recipes/bip/package.json +++ b/recipes/bip/package.json @@ -1,7 +1,7 @@ { "id": "bip", "name": "BiP", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://web.bip.com/", diff --git a/recipes/bip/webview.js b/recipes/bip/webview.js index 87a7c0a..89668d7 100644 --- a/recipes/bip/webview.js +++ b/recipes/bip/webview.js @@ -7,8 +7,7 @@ module.exports = Ferdi => { const elements = document.querySelectorAll('.contact-list__message__unread-badge-counter'); let count = 0; for (let i = 0; i < elements.length; i++) { - const countValue = parseInt(elements[i].textContent || '0', 10); - count += countValue; + count += Ferdi.safeParseInt(elements[i].textContent); } Ferdi.setBadge(count, 0); }; diff --git a/recipes/campuswire/package.json b/recipes/campuswire/package.json index e305ef1..334061f 100644 --- a/recipes/campuswire/package.json +++ b/recipes/campuswire/package.json @@ -1,7 +1,7 @@ { "id": "campuswire", "name": "Campuswire", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://campuswire.com/c", diff --git a/recipes/campuswire/webview.js b/recipes/campuswire/webview.js index 5f43cbb..34878f3 100644 --- a/recipes/campuswire/webview.js +++ b/recipes/campuswire/webview.js @@ -4,7 +4,7 @@ module.exports = Ferdi => { const messageRequestsElement = document.querySelector('._5nxf'); if (messageRequestsElement) { - count += parseInt(messageRequestsElement.innerHTML, 10); + count += Ferdi.safeParseInt(messageRequestsElement.innerHTML); } Ferdi.setBadge(count); diff --git a/recipes/chatwork/package.json b/recipes/chatwork/package.json index eb6eaf8..52cbf02 100644 --- a/recipes/chatwork/package.json +++ b/recipes/chatwork/package.json @@ -1,7 +1,7 @@ { "id": "chatwork", "name": "ChatWork", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/hideosasaki/recipe-chatwork", "config": { diff --git a/recipes/chatwork/webview.js b/recipes/chatwork/webview.js index e131093..cc40834 100644 --- a/recipes/chatwork/webview.js +++ b/recipes/chatwork/webview.js @@ -1,7 +1,5 @@ module.exports = (Ferdi) => { function getMessages() { - let groupCount = 0; - let individualCount = 0; let directCount = 0; let indirectCount = 0; const roomInfoContainer = document.querySelectorAll('li.sc-dnqmqq'); @@ -11,20 +9,17 @@ module.exports = (Ferdi) => { const unreadBadgeHasMention = room.querySelector('li._unreadBadge.sc-cSHVUG'); if (unreadBadge && unreadBadge.innerText) { - count = parseInt(unreadBadge.innerText); + count = Ferdi.safeParseInt(unreadBadge.innerText); } if (count > 0) { if (room.querySelector('img.sc-gqjmRU').getAttribute('src').indexOf('avatar') < 0) { - groupCount += count; - if (unreadBadgeHasMention) { directCount++; } else { indirectCount++; } } else { - individualCount += count; directCount++; } } diff --git a/recipes/ciscospark/package.json b/recipes/ciscospark/package.json index ec9f3c8..dbf031e 100644 --- a/recipes/ciscospark/package.json +++ b/recipes/ciscospark/package.json @@ -1,7 +1,7 @@ { "id": "ciscospark", "name": "Cisco Spark", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://web.ciscospark.com", diff --git a/recipes/ciscospark/webview.js b/recipes/ciscospark/webview.js index 4de3fb1..8de5b8d 100644 --- a/recipes/ciscospark/webview.js +++ b/recipes/ciscospark/webview.js @@ -11,10 +11,10 @@ module.exports = Ferdi => { const elements = document.querySelectorAll('.navigation-bar-list .listItemWrapper'); if (elements.length > 0 && elements[1].querySelector(UNREAD_BADGE_SELECTOR)) { - directCount = parseInt(elements[1].querySelector(UNREAD_BADGE_SELECTOR).textContent, 10); + directCount = Ferdi.safeParseInt(elements[1].querySelector(UNREAD_BADGE_SELECTOR).textContent); } - if (elements.length > 0 && elements[2].querySelector(UNREAD_BADGE_SELECTOR)) { - indirectCount = parseInt(elements[2].querySelector(UNREAD_BADGE_SELECTOR).textContent, 10); + if (elements.length > 1 && elements[2].querySelector(UNREAD_BADGE_SELECTOR)) { + indirectCount = Ferdi.safeParseInt(elements[2].querySelector(UNREAD_BADGE_SELECTOR).textContent); } Ferdi.setBadge(directCount, indirectCount); diff --git a/recipes/discord/package.json b/recipes/discord/package.json index 85069d9..7a2ec50 100644 --- a/recipes/discord/package.json +++ b/recipes/discord/package.json @@ -1,7 +1,7 @@ { "id": "discord", "name": "Discord", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://discordapp.com/login", diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 88a5c50..0559612 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -75,7 +75,9 @@ module.exports = (Ferdi, settings) => { if (elementContainer) { const element = elementContainer.querySelector('[data-text-as-pseudo-element]'); - count = parseInt(element.dataset.textAsPseudoElement, 10); + if (element && element.dataset) { + count = Ferdi.safeParseInt(element.dataset.textAsPseudoElement); + } } } } diff --git a/recipes/disqus/package.json b/recipes/disqus/package.json index f9a48df..73f9a24 100644 --- a/recipes/disqus/package.json +++ b/recipes/disqus/package.json @@ -1,7 +1,7 @@ { "id": "disqus", "name": "Disqus", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://disqus.com/home/" diff --git a/recipes/disqus/webview.js b/recipes/disqus/webview.js index c1e315c..b5c1902 100644 --- a/recipes/disqus/webview.js +++ b/recipes/disqus/webview.js @@ -1,6 +1,6 @@ const getInnerInt = selector => { const element = document.querySelector(selector); - return element && parseInt(element.innerText); + return element && Ferdi.safeParseInt(element.innerText); }; module.exports = Ferdi => { diff --git a/recipes/element/package.json b/recipes/element/package.json index 528e167..d4cf96d 100644 --- a/recipes/element/package.json +++ b/recipes/element/package.json @@ -1,7 +1,7 @@ { "id": "element", "name": "Element", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "aliases": [ "Riot.im", diff --git a/recipes/element/webview.js b/recipes/element/webview.js index 18bb7ad..c1fdea3 100644 --- a/recipes/element/webview.js +++ b/recipes/element/webview.js @@ -3,19 +3,19 @@ module.exports = Ferdi => { const badges = document.querySelectorAll('.mx_RoomSublist:not(.mx_RoomSublist_hidden) .mx_RoomSublist_badgeContainer'); // Number of messages from People - let direct_count = 0; - if (badges.length > 0 && badges[0].children.length > 0) { - direct_count = parseInt(badges[0].textContent); + let directCount = 0; + if (badges.length > 0) { + directCount = Ferdi.safeParseInt(badges[0].textContent); } // Number of messages from Rooms - let indirect_count = 0; - if (badges.length > 1 && badges[1].children.length > 0) { - indirect_count = parseInt(badges[1].textContent); + let indirectCount = 0; + if (badges.length > 1) { + indirectCount = Ferdi.safeParseInt(badges[1].textContent); } // set Ferdi badge - Ferdi.setBadge(direct_count, indirect_count); + Ferdi.setBadge(directCount, indirectCount); } Ferdi.loop(getMessages); diff --git a/recipes/erepublik/package.json b/recipes/erepublik/package.json index 77781ee..c8efaab 100644 --- a/recipes/erepublik/package.json +++ b/recipes/erepublik/package.json @@ -1,7 +1,7 @@ { "id": "erepublik", "name": "eRepublik", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://erepublik.com" diff --git a/recipes/erepublik/webview.js b/recipes/erepublik/webview.js index 3056d1b..7c24532 100644 --- a/recipes/erepublik/webview.js +++ b/recipes/erepublik/webview.js @@ -12,20 +12,13 @@ module.exports = Ferdi => { for (let i = 0; i < elementNotify.length; i++) { const splitText = elementNotify[i].title.split(':'); - const badgeNumber = parseInt(splitText[1], 10); - if (badgeNumber) { - countNotify += badgeNumber; - } + countNotify += Ferdi.safeParseInt(splitText[1]); } for (let i = 0; i < elementFeed.length; i++) { - const feedNumber = parseInt(elementFeed[i].textContent, 10); - if (feedNumber) { - countFeed += feedNumber; - } + countFeed += Ferdi.safeParseInt(elementFeed[i].textContent); } - console.log(countNotify, countFeed); Ferdi.setBadge(countNotify, countFeed); }; diff --git a/recipes/facebook/package.json b/recipes/facebook/package.json index 3bd9eb2..2f5a54a 100755 --- a/recipes/facebook/package.json +++ b/recipes/facebook/package.json @@ -1,7 +1,7 @@ { "id": "facebook", "name": "Facebook", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.facebook.com/login" diff --git a/recipes/facebook/webview.js b/recipes/facebook/webview.js index f1e24f9..43de149 100755 --- a/recipes/facebook/webview.js +++ b/recipes/facebook/webview.js @@ -10,8 +10,8 @@ module.exports = (Ferdi) => { ]; elements.forEach((element) => { - if (element !== null && parseInt(element.innerHTML, 10)) { - count += parseInt(element.innerHTML, 10); + if (element !== null) { + count += Ferdi.safeParseInt(element.innerHTML); } }); diff --git a/recipes/facebookpages/package.json b/recipes/facebookpages/package.json index 717876f..28f06ec 100644 --- a/recipes/facebookpages/package.json +++ b/recipes/facebookpages/package.json @@ -1,7 +1,7 @@ { "id": "facebookpages", "name": "Facebook Pages", - "version": "1.2.1", + "version": "1.2.2", "license": "MIT", "config": { "serviceURL": "https://facebook.com/{teamId}/", diff --git a/recipes/facebookpages/webview.js b/recipes/facebookpages/webview.js index 539b227..1cc75c6 100644 --- a/recipes/facebookpages/webview.js +++ b/recipes/facebookpages/webview.js @@ -4,7 +4,7 @@ module.exports = (Ferdi, options) => { const element = document.querySelector('[data-testid="message_count"] span'); if (element) { - messages = parseInt(element.textContent, 10); + messages = Ferdi.safeParseInt(element.textContent); } Ferdi.setBadge(messages); diff --git a/recipes/feedly/package.json b/recipes/feedly/package.json index 4bb6d10..0ff3f70 100644 --- a/recipes/feedly/package.json +++ b/recipes/feedly/package.json @@ -1,7 +1,7 @@ { "id": "feedly", "name": "Feedly", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://feedly.com" diff --git a/recipes/feedly/webview.js b/recipes/feedly/webview.js index 4e5a5c8..09f4209 100644 --- a/recipes/feedly/webview.js +++ b/recipes/feedly/webview.js @@ -1,7 +1,7 @@ module.exports = Ferdi => { getMessages = () => { const newsDOM = document.querySelectorAll("div[title='All'] > .LeftnavListRow__count")[0].innerHTML; - let counter = parseInt(newsDOM); + let counter = Ferdi.safeParseInt(newsDOM); if (newsDOM.indexOf('K') !== -1 || newsDOM.indexOf('+') !== -1) { counter = `${newsDOM.substring(0, newsDOM.indexOf('K'))}000`; diff --git a/recipes/gadugadu/package.json b/recipes/gadugadu/package.json index 5579a41..42600d7 100644 --- a/recipes/gadugadu/package.json +++ b/recipes/gadugadu/package.json @@ -1,7 +1,7 @@ { "id": "gadugadu", "name": "Gadu-Gadu", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.gg.pl", diff --git a/recipes/gadugadu/webview.js b/recipes/gadugadu/webview.js index e1c7a2a..a3c1ee2 100644 --- a/recipes/gadugadu/webview.js +++ b/recipes/gadugadu/webview.js @@ -4,16 +4,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de module.exports = Ferdi => { const getMessages = () => { - const updates = parseInt(document.querySelector('i#sr-last-counter').textContent, 10); + const updates = Ferdi.safeParseInt(document.querySelector('i#sr-last-counter').textContent); let messages = 0; - - const conversations = document.querySelectorAll('.chat-counter:not(.d-none)').length; - if (conversations === 0) { - messages = 0; - } else { - for (let i = 0; i < conversations; i + 1) { - messages += parseInt(document.querySelectorAll('.chat-counter:not(.d-none)')[i].textContent, 10); - } + const elements = document.querySelectorAll('.chat-counter:not(.d-none)'); + for (let i = 0; i < elements.length; i++) { + messages += Ferdi.safeParseInt(elements[i].textContent); } Ferdi.setBadge(messages, updates); diff --git a/recipes/github/package.json b/recipes/github/package.json index 4454c97..2ed611e 100644 --- a/recipes/github/package.json +++ b/recipes/github/package.json @@ -1,7 +1,7 @@ { "id": "github", "name": "GitHub", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "config": { "serviceURL": "https://github.com/notifications", diff --git a/recipes/github/webview.js b/recipes/github/webview.js index 9f35b5e..fdc65a8 100644 --- a/recipes/github/webview.js +++ b/recipes/github/webview.js @@ -1,14 +1,17 @@ module.exports = Ferdi => { const getMessages = function getMessages() { const directCountElement = document.querySelector('.filter-list .count'); - const indirectCountElement = document.querySelector('[class*="mail-status unread"]'); - let directCount; - let indirectCount; + let directCount = 0; if (directCountElement) { - directCount = parseInt(directCountElement.innerHTML, 10); - } else if (indirectCountElement) { + directCount = Ferdi.safeParseInt(directCountElement.innerHTML); + } + + const indirectCountElement = document.querySelector('[class*="mail-status unread"]'); + let indirectCount = 0; + if (indirectCountElement) { indirectCount = 1; } + Ferdi.setBadge(directCount, indirectCount); }; diff --git a/recipes/glowing-bear/package.json b/recipes/glowing-bear/package.json index 250cb57..b586117 100644 --- a/recipes/glowing-bear/package.json +++ b/recipes/glowing-bear/package.json @@ -1,7 +1,7 @@ { "id": "glowing-bear", "name": "glowing-bear", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.glowing-bear.org", diff --git a/recipes/glowing-bear/webview.js b/recipes/glowing-bear/webview.js index d974836..0780357 100644 --- a/recipes/glowing-bear/webview.js +++ b/recipes/glowing-bear/webview.js @@ -4,9 +4,11 @@ module.exports = Ferdi => { const direct = document.querySelectorAll('.badge.danger').length - 1; let indirect = -1; for (let i = 0; i < indirectElements.length; i += 1) { - if (indirectElements[i].innerHTML.length > 0) indirect++; + if (indirectElements[i].innerHTML.length > 0) { + indirect++; + } } - Ferdi.setBadge(Math.max(direct, 0), Math.max(indirect, 0)); + Ferdi.setBadge(direct, indirect); }; Ferdi.loop(getMessages); diff --git a/recipes/gmail/package.json b/recipes/gmail/package.json index 49fc89f..97029b4 100644 --- a/recipes/gmail/package.json +++ b/recipes/gmail/package.json @@ -1,7 +1,7 @@ { "id": "gmail", "name": "Gmail", - "version": "1.4.0", + "version": "1.4.1", "license": "MIT", "config": { "serviceURL": "https://mail.google.com" diff --git a/recipes/gmail/webview.js b/recipes/gmail/webview.js index 9a09c87..8c78bb6 100644 --- a/recipes/gmail/webview.js +++ b/recipes/gmail/webview.js @@ -13,10 +13,9 @@ module.exports = (Ferdi) => { const inboxLinks = document.getElementsByClassName('J-Ke n0'); if (inboxLinks.length > 0) { - const inboxLink = inboxLinks[0]; - const unreadCounts = inboxLink.parentNode.parentNode.getElementsByClassName('bsU'); + const unreadCounts = inboxLinks[0].parentNode.parentNode.getElementsByClassName('bsU'); if (unreadCounts.length > 0) { - count = parseInt(unreadCounts[0].innerHTML.trim(), 10); + count = Ferdi.safeParseInt(unreadCounts[0].innerHTML); } } diff --git a/recipes/google-voice/package.json b/recipes/google-voice/package.json index 84eac14..20661e3 100644 --- a/recipes/google-voice/package.json +++ b/recipes/google-voice/package.json @@ -1,7 +1,7 @@ { "id": "google-voice", "name": "google-voice", - "version": "0.4.0", + "version": "0.4.1", "license": "MIT", "repository": "https://github.com/BehindTheMath/franz-recipe-google-voice", "config": { diff --git a/recipes/google-voice/webview.js b/recipes/google-voice/webview.js index 7d9602c..53d34a1 100644 --- a/recipes/google-voice/webview.js +++ b/recipes/google-voice/webview.js @@ -1,7 +1,7 @@ module.exports = Ferdi => { function parseQuery(query) { const el = document.querySelector(query); - return el && parseInt(el.innerHTML) || 0; + return el && Ferdi.safeParseInt(el.innerHTML); } function getMessages() { @@ -9,7 +9,7 @@ module.exports = Ferdi => { let count; if (el) { - count = parseInt(el.innerHTML.replace(/[\(\) ]/gi, '')) || 0; + count = Ferdi.safeParseInt(el.innerHTML.replace(/[\(\) ]/gi, '')); } else { const count_messages = parseQuery('gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]'); const count_calls = parseQuery('gv-nav-tab[tooltip="Calls"] div[aria-label="Unread count"]'); diff --git a/recipes/googleclassroom/package.json b/recipes/googleclassroom/package.json index de9c318..84c7e24 100644 --- a/recipes/googleclassroom/package.json +++ b/recipes/googleclassroom/package.json @@ -1,7 +1,7 @@ { "id": "googleclassroom", "name": "Google Classroom", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/TanZng/ferdi-googleclassroom", "config": { diff --git a/recipes/googleclassroom/webview.js b/recipes/googleclassroom/webview.js index 6431df8..c634b35 100644 --- a/recipes/googleclassroom/webview.js +++ b/recipes/googleclassroom/webview.js @@ -8,7 +8,7 @@ module.exports = Ferdi => { homework += upcomingAssignment[i].childElementCount; } } - Ferdi.setBadge(parseInt(homework, 10)); + Ferdi.setBadge(homework); }; Ferdi.loop(getMessages); diff --git a/recipes/guilded/package.json b/recipes/guilded/package.json index 7366a6e..7cef02e 100644 --- a/recipes/guilded/package.json +++ b/recipes/guilded/package.json @@ -1,7 +1,7 @@ { "id": "guilded", "name": "Guilded", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.guilded.gg/", diff --git a/recipes/guilded/webview.js b/recipes/guilded/webview.js index ccace71..5d56d39 100644 --- a/recipes/guilded/webview.js +++ b/recipes/guilded/webview.js @@ -6,7 +6,7 @@ module.exports = Ferdi => { const innerBadge = notificationBadge.getElementsByClassName('BadgeV2-count')[0]; unread = innerBadge.innerText; } - Ferdi.setBadge(parseInt(unread, 10)); + Ferdi.setBadge(unread); }; Ferdi.loop(getMessages); diff --git a/recipes/icq/package.json b/recipes/icq/package.json index 1ce61eb..35de4bb 100644 --- a/recipes/icq/package.json +++ b/recipes/icq/package.json @@ -1,7 +1,7 @@ { "id": "icq", "name": "ICQ", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/meetfranz/recipe-icq", "config": { diff --git a/recipes/icq/webview.js b/recipes/icq/webview.js index 24271d8..653dc69 100644 --- a/recipes/icq/webview.js +++ b/recipes/icq/webview.js @@ -1,15 +1,10 @@ module.exports = Ferdi => { const getMessages = function getMessages() { let directs = 0; - - if (document.getElementsByClassName('nwa-msg-counter icq-recent_state-read').length > 0) { - const elements = document.getElementsByClassName('nwa-msg-counter icq-recent_state-read'); - for (let i = 0; i < elements.length; i++) { - const countLine = parseInt(elements[i].innerText.replace(/[^0-9.]/g, ''), 10); - if (!isNaN(directs) && countLine > 0) { - // directs += count_line; // count every message - directs += 1; // count 1 per channel with messages - } + const elements = document.getElementsByClassName('nwa-msg-counter icq-recent_state-read'); + for (let i = 0; i < elements.length; i++) { + if (Ferdi.safeParseInt(elements[i].innerText.replace(/[^0-9.]/g, '')) > 0) { + directs += 1; // count 1 per channel with messages } } diff --git a/recipes/instagram/package.json b/recipes/instagram/package.json index 80391bc..8396da4 100644 --- a/recipes/instagram/package.json +++ b/recipes/instagram/package.json @@ -1,7 +1,7 @@ { "id": "instagram", "name": "Instagram", - "version": "2.2.0", + "version": "2.2.1", "license": "MIT", "config": { "serviceURL": "https://instagram.com/direct/inbox", diff --git a/recipes/instagram/webview.js b/recipes/instagram/webview.js index b6d9aa3..8db5852 100644 --- a/recipes/instagram/webview.js +++ b/recipes/instagram/webview.js @@ -5,7 +5,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de module.exports = (Ferdi) => { const getMessages = function getMessages() { const element = document.querySelector('a[href^="/direct/inbox"]'); - Ferdi.setBadge(element ? parseInt(element.innerText, 10) : 0); + Ferdi.setBadge(element ? Ferdi.safeParseInt(element.innerText) : 0); }; Ferdi.loop(getMessages); diff --git a/recipes/intercom/package.json b/recipes/intercom/package.json index fbe3871..e599308 100644 --- a/recipes/intercom/package.json +++ b/recipes/intercom/package.json @@ -1,7 +1,7 @@ { "id": "intercom", "name": "Intercom", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://app.intercom.io/", diff --git a/recipes/intercom/webview.js b/recipes/intercom/webview.js index 18445d8..a29db21 100644 --- a/recipes/intercom/webview.js +++ b/recipes/intercom/webview.js @@ -1,7 +1,7 @@ module.exports = (Ferdi) => { function getMessages() { - const numMessages = parseInt(document.querySelector('.left-nav [data-content="Inbox"] .unread__container .unread').innerHTML.trim()); - Ferdi.setBadge(numMessages >= 0 ? numMessages : 0, 0); + const numMessages = Ferdi.safeParseInt(document.querySelector('.left-nav [data-content="Inbox"] .unread__container .unread').innerHTML); + Ferdi.setBadge(numMessages); } Ferdi.loop(getMessages); diff --git a/recipes/jira/package.json b/recipes/jira/package.json index 09ace99..23d77a1 100644 --- a/recipes/jira/package.json +++ b/recipes/jira/package.json @@ -1,7 +1,7 @@ { "id": "jira", "name": "Jira", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.atlassian.net", diff --git a/recipes/jira/webview.js b/recipes/jira/webview.js index f52235d..d39f91e 100644 --- a/recipes/jira/webview.js +++ b/recipes/jira/webview.js @@ -2,10 +2,7 @@ module.exports = (Ferdi) => { const getMessages = function getMessages() { // get unread messages const element = document.querySelector('#atlassian-navigation-notification-count span'); - let count = element ? element.innerText : 0; - count = parseInt(count, 10); - - Ferdi.setBadge(count); + Ferdi.setBadge(element ? element.innerText : 0); }; Ferdi.loop(getMessages); diff --git a/recipes/lark/package.json b/recipes/lark/package.json index 81c2a37..a1144e3 100644 --- a/recipes/lark/package.json +++ b/recipes/lark/package.json @@ -1,7 +1,7 @@ { "id": "lark", "name": "Lark", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.larksuite.com/messenger/", diff --git a/recipes/lark/webview.js b/recipes/lark/webview.js index 5e32219..33d0fc9 100644 --- a/recipes/lark/webview.js +++ b/recipes/lark/webview.js @@ -9,8 +9,7 @@ module.exports = (Ferdi) => { Ferdi.setBadge(0); return; } - const messages = parseInt(ele[0].innerHTML, 10); - Ferdi.setBadge(messages); + Ferdi.setBadge(ele[0].innerHTML); }; Ferdi.loop(getMessages); diff --git a/recipes/linkedin/package.json b/recipes/linkedin/package.json index e595182..2c9bdd2 100644 --- a/recipes/linkedin/package.json +++ b/recipes/linkedin/package.json @@ -1,7 +1,7 @@ { "id": "linkedin", "name": "LinkedIn", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://www.linkedin.com/messaging" diff --git a/recipes/linkedin/webview.js b/recipes/linkedin/webview.js index f109b0d..1017d26 100644 --- a/recipes/linkedin/webview.js +++ b/recipes/linkedin/webview.js @@ -6,9 +6,8 @@ module.exports = Ferdi => { count = document.querySelectorAll('.msg-conversation-card__unread-count').length; } else { const element = document.querySelector('.nav-item--messaging .nav-item__badge-count'); - if (element) { - count = parseInt(element.innerHTML, 10); + count = Ferdi.safeParseInt(element.innerHTML); } } diff --git a/recipes/messenger/package.json b/recipes/messenger/package.json index ba84ed5..6165ed1 100644 --- a/recipes/messenger/package.json +++ b/recipes/messenger/package.json @@ -1,7 +1,7 @@ { "id": "messenger", "name": "Messenger", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://messenger.com", diff --git a/recipes/messenger/webview.js b/recipes/messenger/webview.js index 098c6f5..c147df8 100644 --- a/recipes/messenger/webview.js +++ b/recipes/messenger/webview.js @@ -9,7 +9,7 @@ module.exports = Ferdi => { * see https://github.com/getferdi/ferdi/issues/1113#issuecomment-783409154 */ if (isNotification) { - count = parseInt(/^\((\d+)\)/.exec(document.title)[1]); + count = Ferdi.safeParseInt(/^\((\d+)\)/.exec(document.title)[1]); } else { /* * Notification case for direct messages, workaround by manavortex @@ -28,7 +28,7 @@ module.exports = Ferdi => { */ const messageRequestsElement = document.querySelector('._5nxf'); if (messageRequestsElement) { - count += parseInt(messageRequestsElement.innerHTML, 10); + count += Ferdi.safeParseInt(messageRequestsElement.innerHTML); } Ferdi.setBadge(count); diff --git a/recipes/monday/package.json b/recipes/monday/package.json index 35556a8..5b6af2f 100644 --- a/recipes/monday/package.json +++ b/recipes/monday/package.json @@ -1,7 +1,7 @@ { "id": "monday", "name": "Monday", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.monday.com", diff --git a/recipes/monday/webview.js b/recipes/monday/webview.js index bdd73ca..924c071 100755 --- a/recipes/monday/webview.js +++ b/recipes/monday/webview.js @@ -9,7 +9,7 @@ module.exports = Ferdi => { const counters = document.querySelectorAll('.surface-control-component .item-counter, .surface-control-component .view-item-counter'); for (let i = 0; i < counters.length; i++) { - count += parseInt(counters[i].textContent); + count += Ferdi.safeParseInt(counters[i].textContent); } Ferdi.setBadge(count); diff --git a/recipes/msteams/package.json b/recipes/msteams/package.json index 9ccc53a..c79276f 100644 --- a/recipes/msteams/package.json +++ b/recipes/msteams/package.json @@ -1,7 +1,7 @@ { "id": "msteams", "name": "Microsoft Teams", - "version": "3.1.0", + "version": "3.1.1", "license": "MIT", "aliases": [ "teamsChat" diff --git a/recipes/msteams/webview.js b/recipes/msteams/webview.js index 8e971ec..bf25562 100644 --- a/recipes/msteams/webview.js +++ b/recipes/msteams/webview.js @@ -7,10 +7,7 @@ module.exports = Ferdi => { let messages = 0; const badge = document.querySelector('.activity-badge.dot-activity-badge .activity-badge'); if (badge) { - const value = parseInt(badge.innerHTML, 10); - if (!isNaN(value)) { - messages = value; - } + messages = Ferdi.safeParseInt(badge.innerHTML); } const indirectMessages = document.querySelectorAll('[class*=channel-anchor][class*=ts-unread-channel]').length; diff --git a/recipes/mysms/package.json b/recipes/mysms/package.json index 29cff0b..9030285 100644 --- a/recipes/mysms/package.json +++ b/recipes/mysms/package.json @@ -1,7 +1,7 @@ { "id": "mysms", "name": "MySMS", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://app.mysms.com" diff --git a/recipes/mysms/webview.js b/recipes/mysms/webview.js index f8660ee..a0b4ea6 100644 --- a/recipes/mysms/webview.js +++ b/recipes/mysms/webview.js @@ -4,8 +4,7 @@ module.exports = Ferdi => { let count = 0; for (let i = 0; i < elements.length; i++) { - const count_line = parseInt(elements[i].innerText.replace(/[^0-9.]/g, '')); - if (count_line > 0) { + if (Ferdi.safeParseInt(elements[i].innerText.replace(/[^0-9.]/g, '')) > 0) { count++; // count 1 per channel with messages } } diff --git a/recipes/nextdoor/package.json b/recipes/nextdoor/package.json index 1e5c75a..2b40f9d 100644 --- a/recipes/nextdoor/package.json +++ b/recipes/nextdoor/package.json @@ -1,7 +1,7 @@ { "id": "nextdoor", "name": "Nextdoor", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://nextdoor.co.uk/inbox/" diff --git a/recipes/nextdoor/webview.js b/recipes/nextdoor/webview.js index 0ea8f57..fbac111 100644 --- a/recipes/nextdoor/webview.js +++ b/recipes/nextdoor/webview.js @@ -5,7 +5,7 @@ module.exports = Ferdi => { if (notificationBadge != undefined) { unread = notificationBadge.innerText; } - Ferdi.setBadge(parseInt(unread, 10)); + Ferdi.setBadge(unread); }; Ferdi.loop(getMessages); diff --git a/recipes/notion/package.json b/recipes/notion/package.json index d5d504c..1cefed4 100644 --- a/recipes/notion/package.json +++ b/recipes/notion/package.json @@ -1,7 +1,7 @@ { "id": "notion", "name": "Notion", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/TanZng/ferdi-notion", "config": { diff --git a/recipes/notion/webview.js b/recipes/notion/webview.js index 8ef9ff2..aa8eaec 100644 --- a/recipes/notion/webview.js +++ b/recipes/notion/webview.js @@ -1,13 +1,12 @@ module.exports = (Ferdi) => { function getMessages() { let direct = 0; - 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) { - direct = parseInt(badgeDiv.innerText); + direct = Ferdi.safeParseInt(badgeDiv.innerText); } - Ferdi.setBadge(direct, indirect); + Ferdi.setBadge(direct); } Ferdi.loop(getMessages); diff --git a/recipes/office365-owa/package.json b/recipes/office365-owa/package.json index e4dce4c..0bd1afd 100644 --- a/recipes/office365-owa/package.json +++ b/recipes/office365-owa/package.json @@ -1,7 +1,7 @@ { "id": "office365-owa", "name": "Office 365 Outlook", - "version": "1.4.1", + "version": "1.4.2", "license": "MIT", "aliases": [ "live.com" diff --git a/recipes/office365-owa/webview.js b/recipes/office365-owa/webview.js index 0309488..1a04132 100644 --- a/recipes/office365-owa/webview.js +++ b/recipes/office365-owa/webview.js @@ -5,12 +5,7 @@ module.exports = Ferdi => { if (location.pathname.match(/\/owa/)) { // classic app - directUnreadCount = parseInt( - jQuery("span[title*='Inbox'] + div > span") - .first() - .text(), - 10, - ); + directUnreadCount = Ferdi.safeParseInt(jQuery("span[title*='Inbox'] + div > span").first().text()); } else { // new app const foldersElement = document.querySelector('div[role=tree]:nth-child(3)'); @@ -18,7 +13,7 @@ module.exports = Ferdi => { const allScreenReaders = foldersElement.querySelectorAll('span.screenReaderOnly'); for (const child of allScreenReaders) { if ((child.innerText === 'unread' || child.innerText === 'item') && child.previousSibling) { - directUnreadCount += parseInt(child.previousSibling.innerText, 10); + directUnreadCount += Ferdi.safeParseInt(child.previousSibling.innerText); } } } @@ -28,7 +23,7 @@ module.exports = Ferdi => { const allScreenReaders = groupsElement.querySelectorAll('span.screenReaderOnly'); for (const child of allScreenReaders) { if ((child.innerText === 'unread' || child.innerText === 'item') && child.previousSibling) { - indirectUnreadCount += parseInt(child.previousSibling.innerText, 10); + indirectUnreadCount += Ferdi.safeParseInt(child.previousSibling.innerText); } } } diff --git a/recipes/pivotal-tracker/package.json b/recipes/pivotal-tracker/package.json index 0cc6134..b9164e1 100644 --- a/recipes/pivotal-tracker/package.json +++ b/recipes/pivotal-tracker/package.json @@ -1,7 +1,7 @@ { "id": "pivotal-tracker", "name": "pivotal-tracker", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.pivotaltracker.com/signin", diff --git a/recipes/pivotal-tracker/webview.js b/recipes/pivotal-tracker/webview.js index ef1c8f1..cfc2ae4 100644 --- a/recipes/pivotal-tracker/webview.js +++ b/recipes/pivotal-tracker/webview.js @@ -1,8 +1,9 @@ module.exports = (Ferdi) => { function getMessages() { const bell = document.querySelectorAll('#view65 > span')[0]; - counter = parseInt(bell.innerText); - Ferdi.setBadge(counter); + if (bell) { + Ferdi.setBadge(bell.innerText); + } } Ferdi.loop(getMessages); diff --git a/recipes/pleroma/package.json b/recipes/pleroma/package.json index 3993249..5a4fdf9 100644 --- a/recipes/pleroma/package.json +++ b/recipes/pleroma/package.json @@ -1,7 +1,7 @@ { "id": "pleroma", "name": "Pleroma", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "config": { "hasCustomUrl": true diff --git a/recipes/pleroma/webview.js b/recipes/pleroma/webview.js index 07f2dc0..2c97ab3 100644 --- a/recipes/pleroma/webview.js +++ b/recipes/pleroma/webview.js @@ -143,9 +143,9 @@ module.exports = Ferdi => { let directCount = 0; const matchArr = document.title.match(titleRegex); if (matchArr) { - directCount = parseInt(matchArr[1], 10); + directCount = Ferdi.safeParseInt(matchArr[1]); } - Ferdi.setBadge(directCount, 0); + Ferdi.setBadge(directCount); }; getInstanceLogo().then(({ logo, logoMask }) => { diff --git a/recipes/plurk/package.json b/recipes/plurk/package.json index 717c64e..6167c53 100644 --- a/recipes/plurk/package.json +++ b/recipes/plurk/package.json @@ -1,7 +1,7 @@ { "id": "plurk", "name": "Plurk", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.plurk.com" diff --git a/recipes/plurk/webview.js b/recipes/plurk/webview.js index 6f20458..0136c24 100644 --- a/recipes/plurk/webview.js +++ b/recipes/plurk/webview.js @@ -5,8 +5,11 @@ module.exports = Ferdi => { const np = document.querySelector('#noti_np_count'); const re = document.querySelector('#noti_re_count'); - if (np || re) { - direct = parseInt(np.innerHTML) + parseInt(re.innerHTML); + if (np) { + direct += Ferdi.safeParseInt(np.innerHTML); + } + if (re) { + direct += Ferdi.safeParseInt(re.innerHTML); } Ferdi.setBadge(direct); diff --git a/recipes/protonet/package.json b/recipes/protonet/package.json index bc4554d..80923de 100755 --- a/recipes/protonet/package.json +++ b/recipes/protonet/package.json @@ -1,7 +1,7 @@ { "id": "protonet", "name": "protonet", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamID}.protonet.info", diff --git a/recipes/protonet/webview.js b/recipes/protonet/webview.js index 9ada45a..497ee8c 100755 --- a/recipes/protonet/webview.js +++ b/recipes/protonet/webview.js @@ -1,7 +1,7 @@ module.exports = (Ferdi) => { const getMessages = () => { - const unreadPrivateMessages = parseInt($('.messages .unread-meeps').text()); - const unreadGroupMessages = parseInt($('.today .unread-meeps').text()); + const unreadPrivateMessages = Ferdi.safeParseInt($('.messages .unread-meeps').text()); + const unreadGroupMessages = Ferdi.safeParseInt($('.today .unread-meeps').text()); Ferdi.setBadge(unreadPrivateMessages + unreadGroupMessages); }; diff --git a/recipes/rainloop/package.json b/recipes/rainloop/package.json index fad246a..04b6674 100644 --- a/recipes/rainloop/package.json +++ b/recipes/rainloop/package.json @@ -1,7 +1,7 @@ { "id": "rainloop", "name": "RainLoop", - "version": "1.1.0", + "version": "1.1.1", "repository": "https://github.com/promarcel/franz-recipe-rainloop", "license": "MIT", "config": { diff --git a/recipes/rainloop/webview.js b/recipes/rainloop/webview.js index e5052b8..346e51f 100644 --- a/recipes/rainloop/webview.js +++ b/recipes/rainloop/webview.js @@ -9,10 +9,10 @@ module.exports = Ferdi => { if (typeof countText === 'string' && countText !== '') { if ($(obj).hasClass('system')) { if ($(obj).hasClass('i-am-inbox')) { - inbox += parseInt(countText); + inbox += Ferdi.safeParseInt(countText); } } else { - updates += parseInt(countText); + updates += Ferdi.safeParseInt(countText); } } }); diff --git a/recipes/reddit/package.json b/recipes/reddit/package.json index 7dd62e2..b1e9399 100644 --- a/recipes/reddit/package.json +++ b/recipes/reddit/package.json @@ -1,7 +1,7 @@ { "id": "reddit", "name": "Reddit", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/getferdi/recipes", "config": { diff --git a/recipes/reddit/webview.js b/recipes/reddit/webview.js index dc83d3d..ad2c83e 100644 --- a/recipes/reddit/webview.js +++ b/recipes/reddit/webview.js @@ -8,10 +8,9 @@ module.exports = (Ferdi) => { let count = 0; if (elements[0]) { - count = parseInt(elements[0].innerHTML, 10); + count = Ferdi.safeParseInt(elements[0].innerHTML); } - console.log(count); Ferdi.setBadge(count); }; diff --git a/recipes/riseup/package.json b/recipes/riseup/package.json index 73f3234..82689aa 100644 --- a/recipes/riseup/package.json +++ b/recipes/riseup/package.json @@ -1,7 +1,7 @@ { "id": "riseup", "name": "Riseup.net", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://mail.riseup.net" diff --git a/recipes/riseup/webview.js b/recipes/riseup/webview.js index 2a5f91f..7cbb736 100644 --- a/recipes/riseup/webview.js +++ b/recipes/riseup/webview.js @@ -5,7 +5,7 @@ module.exports = Ferdi => { if (notificationBadge != undefined) { unread = notificationBadge.innerText; } - Ferdi.setBadge(parseInt(unread, 10)); + Ferdi.setBadge(unread); }; Ferdi.loop(getMessages); diff --git a/recipes/rocketchat/package.json b/recipes/rocketchat/package.json index f4dedcf..111efbd 100644 --- a/recipes/rocketchat/package.json +++ b/recipes/rocketchat/package.json @@ -1,7 +1,7 @@ { "id": "rocketchat", "name": "Rocket.Chat", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.rocket.chat", diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js index 1702c74..d3d0a27 100644 --- a/recipes/rocketchat/webview.js +++ b/recipes/rocketchat/webview.js @@ -41,7 +41,7 @@ module.exports = Ferdi => { let directMessagesCount = 0; for (const directMessage of directMessages) { - directMessagesCount += parseInt(directMessage.textContent, 10); + directMessagesCount += Ferdi.safeParseInt(directMessage.textContent); } const indirectMessagesCount = Math.round( diff --git a/recipes/roundcube/package.json b/recipes/roundcube/package.json index 2bd8dba..d36a816 100644 --- a/recipes/roundcube/package.json +++ b/recipes/roundcube/package.json @@ -1,7 +1,7 @@ { "id": "roundcube", "name": "Roundcube", - "version": "1.1.0", + "version": "1.1.1", "repository": "https://github.com/jonathanjuursema/franz-roundcube", "license": "MIT", "config": { diff --git a/recipes/roundcube/webview.js b/recipes/roundcube/webview.js index 8a2ffef..ce9872a 100644 --- a/recipes/roundcube/webview.js +++ b/recipes/roundcube/webview.js @@ -3,8 +3,7 @@ module.exports = Ferdi => { const directElements = document.querySelectorAll('.unreadcount'); let direct = 0; for (let i = 0; i < directElements.length; i += 1) { - const n = parseInt(directElements[i].innerHTML); - direct += isNaN(n) ? 0 : n; + direct += Ferdi.safeParseInt(directElements[i].innerHTML); } Ferdi.setBadge(direct); }; diff --git a/recipes/simplenote/package.json b/recipes/simplenote/package.json index cb07e51..a4867b9 100644 --- a/recipes/simplenote/package.json +++ b/recipes/simplenote/package.json @@ -1,7 +1,7 @@ { "id": "simplenote", "name": "Simplenote", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://app.simplenote.com/" diff --git a/recipes/simplenote/webview.js b/recipes/simplenote/webview.js index f109b0d..1017d26 100644 --- a/recipes/simplenote/webview.js +++ b/recipes/simplenote/webview.js @@ -6,9 +6,8 @@ module.exports = Ferdi => { count = document.querySelectorAll('.msg-conversation-card__unread-count').length; } else { const element = document.querySelector('.nav-item--messaging .nav-item__badge-count'); - if (element) { - count = parseInt(element.innerHTML, 10); + count = Ferdi.safeParseInt(element.innerHTML); } } diff --git a/recipes/skype/package.json b/recipes/skype/package.json index 57f4d87..342621c 100644 --- a/recipes/skype/package.json +++ b/recipes/skype/package.json @@ -1,7 +1,7 @@ { "id": "skype", "name": "Skype", - "version": "3.1.0", + "version": "3.1.1", "license": "MIT", "config": { "serviceURL": "https://web.skype.com/", diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js index 9af7c2b..6e84d78 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js @@ -17,7 +17,9 @@ module.exports = (Ferdi, settings) => { if (elementContainer) { const element = elementContainer.querySelector('[data-text-as-pseudo-element]'); - count = parseInt(element.dataset.textAsPseudoElement, 10); + if (element && element.dataset) { + count = Ferdi.safeParseInt(element.dataset.textAsPseudoElement); + } } } } diff --git a/recipes/slite/package.json b/recipes/slite/package.json index 5c38982..44ec123 100644 --- a/recipes/slite/package.json +++ b/recipes/slite/package.json @@ -1,7 +1,7 @@ { "id": "slite", "name": "Slite", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "config": { "serviceURL": "https://{teamId}.slite.com", diff --git a/recipes/slite/webview.js b/recipes/slite/webview.js index d892c3c..a044399 100644 --- a/recipes/slite/webview.js +++ b/recipes/slite/webview.js @@ -1,15 +1,7 @@ -const getInnerInt = selector => { - const element = document.querySelector(selector); - return element && parseInt(element.innerText); -}; - module.exports = Ferdi => { const getMessages = function getMessages() { - const direct = ( - getInnerInt("#app button[data-test-id='notificationsCount']") || 0 - ); - - Ferdi.setBadge(direct); + const element = document.querySelector("#app button[data-test-id='notificationsCount']"); + Ferdi.setBadge(element ? Ferdi.safeParseInt(element.innerText) : 0); }; Ferdi.loop(getMessages); diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json index 5899cc8..4edbb82 100644 --- a/recipes/steamchat/package.json +++ b/recipes/steamchat/package.json @@ -1,7 +1,7 @@ { "id": "steamchat", "name": "SteamChat", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://steamcommunity.com/chat", diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js index b35cc6b..93e68ba 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js @@ -7,7 +7,7 @@ module.exports = Ferdi => { const counters = document.querySelectorAll('[class*=FriendMessageCount]'); [].filter.call(counters, countValue => { if (countValue) { - count += parseInt(countValue.innerHTML); + count += Ferdi.safeParseInt(countValue.innerHTML); } }); diff --git a/recipes/teamleader/package.json b/recipes/teamleader/package.json index 332f28f..83a8521 100644 --- a/recipes/teamleader/package.json +++ b/recipes/teamleader/package.json @@ -1,7 +1,7 @@ { "id": "teamleader", "name": "teamleader", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://app.teamleader.eu/?gotologin", diff --git a/recipes/teamleader/webview.js b/recipes/teamleader/webview.js index 3041463..7eff414 100644 --- a/recipes/teamleader/webview.js +++ b/recipes/teamleader/webview.js @@ -4,8 +4,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de module.exports = (Ferdi) => { const getMessages = () => { - const unreadNotifications = parseInt(document.getElementById('notifications_amount').innerHTML); - Ferdi.setBadge(unreadNotifications); + Ferdi.setBadge(document.getElementById('notifications_amount').innerHTML); }; Ferdi.loop(getMessages); diff --git a/recipes/teamwork-projects/package.json b/recipes/teamwork-projects/package.json index 573de82..50810b0 100644 --- a/recipes/teamwork-projects/package.json +++ b/recipes/teamwork-projects/package.json @@ -1,7 +1,7 @@ { "id": "teamwork-projects", "name": "Teamwork Projects", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.teamwork.com/", diff --git a/recipes/teamwork-projects/webview.js b/recipes/teamwork-projects/webview.js index 94e8dd0..734eb4f 100644 --- a/recipes/teamwork-projects/webview.js +++ b/recipes/teamwork-projects/webview.js @@ -4,7 +4,7 @@ module.exports = (Ferdi) => { const badge = document.getElementById('numNotifs2'); if (badge && badge.innerText) { - indirectCount = parseInt(badge.innerText); + indirectCount = Ferdi.safeParseInt(badge.innerText); } Ferdi.setBadge(0, indirectCount); diff --git a/recipes/telegram-react/package.json b/recipes/telegram-react/package.json index ae8e451..b3dbde6 100644 --- a/recipes/telegram-react/package.json +++ b/recipes/telegram-react/package.json @@ -1,7 +1,7 @@ { "id": "telegram-react", "name": "Telegram React", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://webk.telegram.org", diff --git a/recipes/telegram-react/webview.js b/recipes/telegram-react/webview.js index b6240ff..c6111ee 100644 --- a/recipes/telegram-react/webview.js +++ b/recipes/telegram-react/webview.js @@ -5,7 +5,7 @@ module.exports = Ferdi => { if (elements) { for (let i = 0; i < elements.length; i += 1) { if (elements[i].querySelector('.unread') && elements[i].querySelector('.unread').innerHTML !== 0) { - count += parseInt(elements[i].querySelector('.unread').innerHTML); + count += Ferdi.safeParseInt(elements[i].querySelector('.unread').innerHTML); } } } diff --git a/recipes/telegram/package.json b/recipes/telegram/package.json index 47e53f0..024190f 100644 --- a/recipes/telegram/package.json +++ b/recipes/telegram/package.json @@ -1,7 +1,7 @@ { "id": "telegram", "name": "Telegram", - "version": "3.2.0", + "version": "3.2.1", "license": "MIT", "config": { "serviceURL": "https://web.telegram.org", diff --git a/recipes/telegram/webview.js b/recipes/telegram/webview.js index bf9ffec..a2be19b 100644 --- a/recipes/telegram/webview.js +++ b/recipes/telegram/webview.js @@ -12,13 +12,11 @@ module.exports = Ferdi => { for (let i = 0; i < elements.length; i += 1) { 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; - } + const parsedValue = Ferdi.safeParseInt(subtitleBadge.innerText); + if (elements[i].dataset.peerId > 0) { + count += parsedValue; + } else { + count_sec += parsedValue; } } } diff --git a/recipes/thelounge/package.json b/recipes/thelounge/package.json index 816a4b1..a954b43 100644 --- a/recipes/thelounge/package.json +++ b/recipes/thelounge/package.json @@ -1,7 +1,7 @@ { "id": "thelounge", "name": "The Lounge", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "hasCustomUrl": true, diff --git a/recipes/thelounge/webview.js b/recipes/thelounge/webview.js index e993264..7174749 100644 --- a/recipes/thelounge/webview.js +++ b/recipes/thelounge/webview.js @@ -4,9 +4,10 @@ module.exports = Ferdi => { const direct = document.querySelectorAll('.badge.highlight').length; let indirect = 0; for (let i = 0; i < indirectElements.length; i += 1) { - if (indirectElements[i].innerHTML.length > 0) indirect++; + if (indirectElements[i].innerHTML.length > 0) { + indirect++; + } } - console.log(direct, indirect); Ferdi.setBadge(direct, indirect); }; diff --git a/recipes/threema/package.json b/recipes/threema/package.json index 00f3343..365c1d8 100644 --- a/recipes/threema/package.json +++ b/recipes/threema/package.json @@ -1,7 +1,7 @@ { "id": "threema", "name": "Threema", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/Arany/franz-recipe-threema", "config": { diff --git a/recipes/threema/webview.js b/recipes/threema/webview.js index 8c7c137..d303b1b 100644 --- a/recipes/threema/webview.js +++ b/recipes/threema/webview.js @@ -9,7 +9,7 @@ module.exports = Ferdi => { for (let i = 0; i < elements.length; i += 1) { try { - count += parseInt(elements[i].innerHTML.trim(), 10); + count += Ferdi.safeParseInt(elements[i].innerHTML); } catch (e) { console.error(e); } diff --git a/recipes/todoist/package.json b/recipes/todoist/package.json index ddcf188..dda30c8 100644 --- a/recipes/todoist/package.json +++ b/recipes/todoist/package.json @@ -1,7 +1,7 @@ { "id": "todoist", "name": "Todoist", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "repository": "https://github.com/meetfranz/recipe-todoist", "config": { diff --git a/recipes/todoist/webview.js b/recipes/todoist/webview.js index a65be91..b548184 100644 --- a/recipes/todoist/webview.js +++ b/recipes/todoist/webview.js @@ -6,11 +6,11 @@ module.exports = (Ferdi) => { const inboxElement = document.querySelector('#filter_inbox .item_counter'); if (todayElement) { - todayCount = parseInt(todayElement.innerHTML, 10); + todayCount = Ferdi.safeParseInt(todayElement.innerHTML); } if (inboxElement) { - inboxCount = parseInt(inboxElement.innerHTML, 10); + inboxCount = Ferdi.safeParseInt(inboxElement.innerHTML); } Ferdi.setBadge(inboxCount, todayCount); diff --git a/recipes/tweetdeck/package.json b/recipes/tweetdeck/package.json index d564962..dd103f8 100644 --- a/recipes/tweetdeck/package.json +++ b/recipes/tweetdeck/package.json @@ -1,7 +1,7 @@ { "id": "tweetdeck", "name": "Tweetdeck", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://tweetdeck.twitter.com/", diff --git a/recipes/tweetdeck/webview.js b/recipes/tweetdeck/webview.js index 158f767..6de7d75 100644 --- a/recipes/tweetdeck/webview.js +++ b/recipes/tweetdeck/webview.js @@ -10,7 +10,7 @@ module.exports = Ferdi => { const elements = document.querySelectorAll('.msg-unread-count'); let count = 0; if (elements[0]) { - count = parseInt(elements[0].innerHTML, 10); + count = Ferdi.safeParseInt(elements[0].innerHTML); } Ferdi.setBadge(count); diff --git a/recipes/twitter-dm/package.json b/recipes/twitter-dm/package.json index 34b7aa2..066e699 100644 --- a/recipes/twitter-dm/package.json +++ b/recipes/twitter-dm/package.json @@ -1,7 +1,7 @@ { "id": "twitter-dm", "name": "Twitter DM", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://mobile.twitter.com/messages", diff --git a/recipes/twitter-dm/webview.js b/recipes/twitter-dm/webview.js index 25f9baa..d255ae9 100644 --- a/recipes/twitter-dm/webview.js +++ b/recipes/twitter-dm/webview.js @@ -2,9 +2,8 @@ module.exports = Ferdi => { const getMessages = function getMessages() { let count = 0; const elem = document.querySelector('a[href="/messages"] div div'); - if (elem) { - count = parseInt(elem.innerText, 10); + count = Ferdi.safeParseInt(elem.innerText); } Ferdi.setBadge(count); diff --git a/recipes/vk/package.json b/recipes/vk/package.json index 19b4225..b46622d 100644 --- a/recipes/vk/package.json +++ b/recipes/vk/package.json @@ -1,7 +1,7 @@ { "id": "vk", "name": "VK", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/meetfranz/recipe-vk", "config": { diff --git a/recipes/vk/webview.js b/recipes/vk/webview.js index e48866f..05d703e 100644 --- a/recipes/vk/webview.js +++ b/recipes/vk/webview.js @@ -1,8 +1,9 @@ module.exports = Ferdi => { const getMessages = function getMessages() { let directs = 0; - if (document.getElementsByClassName('left_count').length > 0) { - directs = parseInt(document.getElementsByClassName('left_count')[0].innerText, 10); + const element = document.getElementsByClassName('left_count'); + if (element.length > 0) { + directs = Ferdi.safeParseInt(element[0].innerText); } Ferdi.setBadge(directs); diff --git a/recipes/webex-teams/package.json b/recipes/webex-teams/package.json index 0b8c3ee..d39962f 100644 --- a/recipes/webex-teams/package.json +++ b/recipes/webex-teams/package.json @@ -1,7 +1,7 @@ { "id": "webex-teams", "name": "Webex Teams", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://web.webex.com", diff --git a/recipes/webex-teams/webview.js b/recipes/webex-teams/webview.js index 3880fd2..4b66233 100644 --- a/recipes/webex-teams/webview.js +++ b/recipes/webex-teams/webview.js @@ -9,11 +9,7 @@ module.exports = (Ferdi) => { } if (span.length > 0) { - count = parseInt(span[0].innerText, 10); - } - - if (Number.isNaN(count)) { - count = 0; + count = Ferdi.safeParseInt(span[0].innerText); } Ferdi.setBadge(count); diff --git a/recipes/wechat/package.json b/recipes/wechat/package.json index ec29d19..b8af764 100644 --- a/recipes/wechat/package.json +++ b/recipes/wechat/package.json @@ -1,7 +1,7 @@ { "id": "wechat", "name": "WeChat", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/koma-private/recipe-wechat", "config": { diff --git a/recipes/wechat/webview.js b/recipes/wechat/webview.js index 874ab55..b1d8e31 100644 --- a/recipes/wechat/webview.js +++ b/recipes/wechat/webview.js @@ -13,8 +13,8 @@ module.exports = (Ferdi) => { const reddot = item.querySelector('i.web_wechat_reddot_middle'); const avatarImage = item.querySelector('img.img'); - if (reddot && reddot.innerText) { - count = parseInt(reddot.innerText); + if (reddot) { + count = Ferdi.safeParseInt(reddot.innerText); } if (avatarImage && avatarImage.getAttribute('src').search('webwxgeticon') != -1) { diff --git a/recipes/whatsapp/package.json b/recipes/whatsapp/package.json index 360cc47..6d2a93e 100644 --- a/recipes/whatsapp/package.json +++ b/recipes/whatsapp/package.json @@ -1,7 +1,7 @@ { "id": "whatsapp", "name": "WhatsApp", - "version": "3.2.0", + "version": "3.2.1", "license": "MIT", "config": { "serviceURL": "https://web.whatsapp.com", diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index 773caa8..9b979d2 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js @@ -36,7 +36,7 @@ module.exports = Ferdi => { const chatElem = chatElems[i]; const unreadElem = chatElem.children[0].children[0].children[1].children[1].children[1]; - const countValue = parseInt(unreadElem.textContent) || 0; // Returns 0 in case of isNaN + const countValue = Ferdi.safeParseInt(unreadElem.textContent); if (unreadElem.querySelectorAll('[data-icon=muted]').length === 0) { count += countValue; diff --git a/recipes/wire/package.json b/recipes/wire/package.json index fdd8616..4a85ade 100644 --- a/recipes/wire/package.json +++ b/recipes/wire/package.json @@ -1,7 +1,7 @@ { "id": "wire", "name": "Wire", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "config": { "serviceURL": "https://app.wire.com/", diff --git a/recipes/wire/webview.js b/recipes/wire/webview.js index efd37f3..b099eee 100644 --- a/recipes/wire/webview.js +++ b/recipes/wire/webview.js @@ -7,10 +7,7 @@ module.exports = (Ferdi) => { const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); if (conversationElems) { for (const conversationElem of conversationElems) { - const count = parseInt(conversationElem.innerText); - if (count) { - direct += count; - } + direct += Ferdi.safeParseInt(conversationElem.innerText); } } @@ -18,8 +15,8 @@ module.exports = (Ferdi) => { const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); if (pendingElem) { const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); - if (matches && matches.length > 0) { - indirect += parseInt(matches[1]); + if (matches && matches.length > 1) { + indirect += Ferdi.safeParseInt(matches[1]); } } diff --git a/recipes/workplace/package.json b/recipes/workplace/package.json index 61e317c..f730dd8 100644 --- a/recipes/workplace/package.json +++ b/recipes/workplace/package.json @@ -1,7 +1,7 @@ { "id": "workplace", "name": "Workplace", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.workplace.com/chat", diff --git a/recipes/workplace/webview.js b/recipes/workplace/webview.js index e10c449..efa5e2a 100644 --- a/recipes/workplace/webview.js +++ b/recipes/workplace/webview.js @@ -10,7 +10,7 @@ module.exports = Ferdi => { const notifications = document.querySelector('#notifications span span'); if (notifications) { - indirect = parseInt(notifications.innerText, 10); + indirect = Ferdi.safeParseInt(notifications.innerText); } if (chatsElement) { @@ -18,7 +18,7 @@ module.exports = Ferdi => { const chatMessages = chatsElement.querySelector('span'); if (chatMessages) { - direct = parseInt(chatMessages.innerText, 10); + direct = Ferdi.safeParseInt(chatMessages.innerText); } } else { direct = document.querySelectorAll('[data-pagelet="WorkGalahadChannel"] .uiList [role="gridcell"] [role="button"] .oxk9n0fw').length; diff --git a/recipes/wrike/package.json b/recipes/wrike/package.json index 3d151a3..5eb0f04 100644 --- a/recipes/wrike/package.json +++ b/recipes/wrike/package.json @@ -1,7 +1,7 @@ { "id": "wrike", "name": "Wrike", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "repository": "https://github.com/koma-private/recipe-wrike", "config": { diff --git a/recipes/wrike/webview.js b/recipes/wrike/webview.js index be80318..39e293d 100644 --- a/recipes/wrike/webview.js +++ b/recipes/wrike/webview.js @@ -2,9 +2,8 @@ module.exports = (Ferdi) => { function getMessages() { let directCount = 0; const element = document.querySelector('.ws-navigation-button__indicator.ws-navigation-button-indicator'); - - if (element && element.innerText) { - directCount = parseInt(element.innerText); + if (element) { + directCount = Ferdi.safeParseInt(element.innerText); } Ferdi.setBadge(directCount); diff --git a/recipes/xing/package.json b/recipes/xing/package.json index 0e3637d..12a2c6f 100644 --- a/recipes/xing/package.json +++ b/recipes/xing/package.json @@ -1,7 +1,7 @@ { "id": "xing", "name": "XING", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "config": { "serviceURL": "https://www.xing.com/messenger/global" diff --git a/recipes/xing/webview.js b/recipes/xing/webview.js index 97daed2..9effe95 100644 --- a/recipes/xing/webview.js +++ b/recipes/xing/webview.js @@ -1,9 +1,6 @@ module.exports = Ferdi => { function getUnreadConversations() { - let unreadConversations = 0; - unreadConversations = parseInt(document.querySelector('#unread-conversations').innerHTML, 10); - - Ferdi.setBadge(unreadConversations); + Ferdi.setBadge(document.querySelector('#unread-conversations').innerHTML); } Ferdi.loop(getUnreadConversations); diff --git a/recipes/yammer/package.json b/recipes/yammer/package.json index 86b5bc6..f0a20d6 100644 --- a/recipes/yammer/package.json +++ b/recipes/yammer/package.json @@ -1,7 +1,7 @@ { "id": "yammer", "name": "Yammer", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.yammer.com/login", diff --git a/recipes/yammer/webview.js b/recipes/yammer/webview.js index 91daba6..79d428f 100644 --- a/recipes/yammer/webview.js +++ b/recipes/yammer/webview.js @@ -5,12 +5,12 @@ module.exports = Ferdi => { const notificationElement = document.querySelector('.yj-notifications-indicator-count'); const newMessagesElement = document.querySelector('.yj-thread-list--new-messages-notice:not(.is-hidden) .yj-thread-list--new-message-text'); - if (notificationElement && notificationElement.innerHTML.length) { - directMessages = parseInt(notificationElement.innerHTML, 10); + if (notificationElement) { + directMessages = Ferdi.safeParseInt(notificationElement.innerHTML); } - if (newMessagesElement && newMessagesElement.innerHTML.length) { - indirectMessages = parseInt(newMessagesElement.innerHTML.match(/\d+/)[0], 10); + if (newMessagesElement) { + indirectMessages = Ferdi.safeParseInt(newMessagesElement.innerHTML.match(/\d+/)[0]); } Ferdi.setBadge(directMessages, indirectMessages); diff --git a/recipes/zendesk/package.json b/recipes/zendesk/package.json index 922195b..18e11e0 100644 --- a/recipes/zendesk/package.json +++ b/recipes/zendesk/package.json @@ -1,7 +1,7 @@ { "id": "zendesk", "name": "zendesk", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://{teamId}.zendesk.com/agent", diff --git a/recipes/zendesk/webview.js b/recipes/zendesk/webview.js index 8bc58ac..b781121 100644 --- a/recipes/zendesk/webview.js +++ b/recipes/zendesk/webview.js @@ -5,10 +5,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de module.exports = Ferdi => { const getMessages = () => { let count = 0; - const el = document.querySelector('.dashboard-top-panel .indicators .stats-group .cell-value'); - - if (el) { - count = parseInt(el.innerHTML, 10); + const element = document.querySelector('.dashboard-top-panel .indicators .stats-group .cell-value'); + if (element) { + count = Ferdi.safeParseInt(element.innerHTML); } Ferdi.setBadge(count); -- cgit v1.2.3-54-g00ecf