aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-17 10:47:32 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-17 10:47:32 +0530
commit212d5846427ceeacfadf5aac3f381b532f4664a1 (patch)
tree7badcbb01930e77a2b2745e189e89323111ef470 /recipes
parentMoved all npm packages to the 'devDependencies' since there is no node-runtim... (diff)
downloadferdium-recipes-212d5846427ceeacfadf5aac3f381b532f4664a1.tar.gz
ferdium-recipes-212d5846427ceeacfadf5aac3f381b532f4664a1.tar.zst
ferdium-recipes-212d5846427ceeacfadf5aac3f381b532f4664a1.zip
Cleanup of recipes to remove 'NaN' of badge variables since this is handled in the main program.
Diffstat (limited to 'recipes')
-rw-r--r--recipes/facebookpages/package.json2
-rw-r--r--recipes/facebookpages/webview.js4
-rw-r--r--recipes/fastmail/package.json2
-rw-r--r--recipes/fastmail/webview.js4
-rw-r--r--recipes/gmail/package.json2
-rw-r--r--recipes/gmail/webview.js6
-rwxr-xr-xrecipes/habitica/package.json2
-rwxr-xr-xrecipes/habitica/webview.js3
-rw-r--r--recipes/icq/package.json2
-rw-r--r--recipes/icq/webview.js4
-rw-r--r--recipes/inoreader/package.json2
-rw-r--r--recipes/inoreader/webview.js4
-rw-r--r--recipes/monday/package.json2
-rwxr-xr-xrecipes/monday/webview.js4
-rw-r--r--recipes/notion/package.json2
-rw-r--r--recipes/notion/webview.js3
-rw-r--r--recipes/proton-mail/package.json2
-rw-r--r--recipes/proton-mail/webview.js3
-rw-r--r--recipes/telegram/package.json2
-rw-r--r--recipes/telegram/webview.js14
-rw-r--r--recipes/vk/package.json2
-rw-r--r--recipes/vk/webview.js4
-rw-r--r--recipes/whatsapp/package.json2
-rw-r--r--recipes/whatsapp/webview.js4
24 files changed, 26 insertions, 55 deletions
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 @@
1{ 1{
2 "id": "facebookpages", 2 "id": "facebookpages",
3 "name": "Facebook Pages", 3 "name": "Facebook Pages",
4 "version": "1.1.1", 4 "version": "1.1.2",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://facebook.com/{teamId}/inbox", 7 "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) => {
7 messages = parseInt(element.textContent, 10); 7 messages = parseInt(element.textContent, 10);
8 } 8 }
9 9
10 if (isNaN(messages)) {
11 messages = 0;
12 }
13
14 Franz.setBadge(messages); 10 Franz.setBadge(messages);
15 }; 11 };
16 12
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 @@
1{ 1{
2 "id": "fastmail", 2 "id": "fastmail",
3 "name": "FastMail", 3 "name": "FastMail",
4 "version": "2.0.1", 4 "version": "2.0.2",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://www.fastmail.com/mail/", 7 "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) => {
7 return; 7 return;
8 } 8 }
9 const messages = Number(inbox.innerText); 9 const messages = Number(inbox.innerText);
10 if (!Number.isNaN(messages)) { 10 Franz.setBadge(messages);
11 Franz.setBadge(messages);
12 }
13 }; 11 };
14 12
15 Franz.injectJSUnsafe(path.join(__dirname, 'webview-unsafe.js')); 13 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 @@
1{ 1{
2 "id": "gmail", 2 "id": "gmail",
3 "name": "Gmail", 3 "name": "Gmail",
4 "version": "1.3.10", 4 "version": "1.3.11",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.google.com" 7 "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) => {
18 } 18 }
19 } 19 }
20 20
21 // Just incase we don't end up with a number, set it back to zero (parseInt can return NaN)
22 count = parseInt(count, 10);
23 if (isNaN(count)) {
24 count = 0;
25 }
26
27 // set Franz badge 21 // set Franz badge
28 Franz.setBadge(count); 22 Franz.setBadge(count);
29 }; 23 };
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 @@
1{ 1{
2 "id": "habitica", 2 "id": "habitica",
3 "name": "Habitica", 3 "name": "Habitica",
4 "version": "1.0.3", 4 "version": "1.0.4",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/lmnet/franz-recipe-notion", 6 "repository": "https://github.com/lmnet/franz-recipe-notion",
7 "config": { 7 "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) => {
4 const element = document.querySelector('.message-count'); 4 const element = document.querySelector('.message-count');
5 if (element) { 5 if (element) {
6 count = Number(element.innerText); 6 count = Number(element.innerText);
7 if (Number.isNaN(count)) {
8 count = 0;
9 }
10 } 7 }
11 Franz.setBadge(count); 8 Franz.setBadge(count);
12 }; 9 };
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 @@
1{ 1{
2 "id": "icq", 2 "id": "icq",
3 "name": "ICQ", 3 "name": "ICQ",
4 "version": "1.0.2", 4 "version": "1.0.3",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/meetfranz/recipe-icq", 6 "repository": "https://github.com/meetfranz/recipe-icq",
7 "config": { 7 "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 => {
13 } 13 }
14 } 14 }
15 15
16 if (isNaN(directs)) {
17 directs = 0;
18 }
19
20 Franz.setBadge(directs); 16 Franz.setBadge(directs);
21 }; 17 };
22 18
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 @@
1{ 1{
2 "id": "inoreader", 2 "id": "inoreader",
3 "name": "Inoreader", 3 "name": "Inoreader",
4 "version": "1.0.2", 4 "version": "1.0.3",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/annagrram/recipe-inoreader", 6 "repository": "https://github.com/annagrram/recipe-inoreader",
7 "config": { 7 "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) => {
4 if (!all_articles) return; 4 if (!all_articles) return;
5 5
6 const unread_articles_cnt = Number(all_articles.textContent.split('+')[0]); 6 const unread_articles_cnt = Number(all_articles.textContent.split('+')[0]);
7 if (!Number.isNaN(unread_articles_cnt)) { 7 Franz.setBadge(unread_articles_cnt);
8 Franz.setBadge(unread_articles_cnt);
9 }
10 }; 8 };
11 9
12 Franz.loop(getMessages); 10 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 @@
1{ 1{
2 "id": "monday", 2 "id": "monday",
3 "name": "Monday", 3 "name": "Monday",
4 "version": "1.0.3", 4 "version": "1.0.4",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://{teamId}.monday.com", 7 "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 => {
12 count += parseInt(counters[i].textContent); 12 count += parseInt(counters[i].textContent);
13 } 13 }
14 14
15 if (isNaN(count)) {
16 count = 0;
17 }
18
19 Franz.setBadge(count); 15 Franz.setBadge(count);
20 }; 16 };
21 17
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 @@
1{ 1{
2 "id": "notion", 2 "id": "notion",
3 "name": "Notion", 3 "name": "Notion",
4 "version": "1.0.3", 4 "version": "1.0.4",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/TanZng/ferdi-notion", 6 "repository": "https://github.com/TanZng/ferdi-notion",
7 "config": { 7 "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) => {
4 const indirect = 0; 4 const indirect = 0;
5 const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div'); 5 const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div');
6 if (badgeDiv) { 6 if (badgeDiv) {
7 const count = parseInt(badgeDiv.innerText); 7 direct = parseInt(badgeDiv.innerText);
8 direct = isNaN(count) ? 0 : count;
9 } 8 }
10 9
11 Franz.setBadge(direct, indirect); 10 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 @@
1{ 1{
2 "id": "proton-mail", 2 "id": "proton-mail",
3 "name": "ProtonMail", 3 "name": "ProtonMail",
4 "version": "1.2.3", 4 "version": "1.2.4",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.protonmail.com/login" 7 "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 => {
6 } 6 }
7 const text = element.innerText; 7 const text = element.innerText;
8 const count = Number(text.substring(1, text.length - 1)); 8 const count = Number(text.substring(1, text.length - 1));
9 if (Number.isNaN(count)) {
10 return;
11 }
12 Franz.setBadge(count); 9 Franz.setBadge(count);
13 } 10 }
14 11
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 @@
1{ 1{
2 "id": "telegram", 2 "id": "telegram",
3 "name": "Telegram", 3 "name": "Telegram",
4 "version": "3.1.0", 4 "version": "3.1.1",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://web.telegram.org", 7 "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 => {
8 let count_sec = 0; 8 let count_sec = 0;
9 const elements = document.querySelectorAll('.rp'); 9 const elements = document.querySelectorAll('.rp');
10 for (let i = 0; i < elements.length; i += 1) { 10 for (let i = 0; i < elements.length; i += 1) {
11 if (elements[i].querySelector('.dialog-subtitle-badge') && (!isNaN(parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText)))) { 11 const subtitleBadge = elements[i].querySelector('.dialog-subtitle-badge');
12 if (parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText) != '' && (elements[i].dataset.peerId > 0)) { 12 if (subtitleBadge) {
13 count = +count + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText); 13 const parsedValue = parseInt(subtitleBadge.innerText);
14 } else { 14 if (!isNaN(parsedValue)) {
15 count_sec = +count_sec + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText); 15 if (elements[i].dataset.peerId > 0) {
16 count += parsedValue;
17 } else {
18 count_sec += parsedValue;
19 }
16 } 20 }
17 } 21 }
18 } 22 }
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 @@
1{ 1{
2 "id": "vk", 2 "id": "vk",
3 "name": "VK", 3 "name": "VK",
4 "version": "1.0.2", 4 "version": "1.0.3",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/meetfranz/recipe-vk", 6 "repository": "https://github.com/meetfranz/recipe-vk",
7 "config": { 7 "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 => {
5 directs = parseInt(document.getElementsByClassName('left_count')[0].innerText, 10); 5 directs = parseInt(document.getElementsByClassName('left_count')[0].innerText, 10);
6 } 6 }
7 7
8 if (isNaN(directs)) {
9 directs = 0;
10 }
11
12 Franz.setBadge(directs); 8 Franz.setBadge(directs);
13 }; 9 };
14 10
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 @@
1{ 1{
2 "id": "whatsapp", 2 "id": "whatsapp",
3 "name": "WhatsApp", 3 "name": "WhatsApp",
4 "version": "3.1.0", 4 "version": "3.1.1",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://web.whatsapp.com", 7 "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 () => {
27module.exports = Franz => { 27module.exports = Franz => {
28 const getMessages = function getMessages() { 28 const getMessages = function getMessages() {
29 let count = 0; 29 let count = 0;
30 let indirectCount = 0; 30 let indirectCount = 0;
31 31
32 const parentChatElem = document.querySelector('#pane-side').children[0].children[0].children[0]; 32 const parentChatElem = document.querySelector('#pane-side').children[0].children[0].children[0];
33 const chatElems = parentChatElem.children; 33 const chatElems = parentChatElem.children;
@@ -41,7 +41,7 @@ module.exports = Franz => {
41 count += countValue; 41 count += countValue;
42 } else { 42 } else {
43 indirectCount += countValue; 43 indirectCount += countValue;
44 } 44 }
45 } 45 }
46 46
47 Franz.setBadge(count, indirectCount); 47 Franz.setBadge(count, indirectCount);