aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/zalo
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-26 06:29:03 -0600
committerLibravatar GitHub <noreply@github.com>2023-07-26 17:59:03 +0530
commit9b8f01716774a960073e944823ab727cc867a8f6 (patch)
tree732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/zalo
parentAdd Excalidraw recipe (#393) (diff)
downloadferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.gz
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.zst
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.zip
chore: improve lint setup (#397)
- update eslint config to closely mirror the ones from ferdium-app - add .eslintignore - opt in to eslint `reportUnusedDisableDirectives` config option - remove `trailingComma: all` from `prettier` config which is default in `prettier` v3 - autofix or disable a lot of lint issues throughout codebase - add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions - upgrade all `eslint` and `prettier` related dependencies to latest - update lint:fix npm script - reformat touched files with prettier - bumped up minor version for all recipes that have changes - introduced injection of 'service.css' where it was missing in many recipes --------- Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'recipes/zalo')
-rw-r--r--recipes/zalo/package.json2
-rw-r--r--recipes/zalo/webview.js63
2 files changed, 43 insertions, 22 deletions
diff --git a/recipes/zalo/package.json b/recipes/zalo/package.json
index 41b60cd..76cef76 100644
--- a/recipes/zalo/package.json
+++ b/recipes/zalo/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "zalo", 2 "id": "zalo",
3 "name": "Zalo", 3 "name": "Zalo",
4 "version": "1.4.0", 4 "version": "1.5.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://chat.zalo.me/", 7 "serviceURL": "https://chat.zalo.me/",
diff --git a/recipes/zalo/webview.js b/recipes/zalo/webview.js
index 8e4c3cd..3c432a6 100644
--- a/recipes/zalo/webview.js
+++ b/recipes/zalo/webview.js
@@ -1,3 +1,9 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
1module.exports = Ferdium => { 7module.exports = Ferdium => {
2 const getMessages = () => { 8 const getMessages = () => {
3 let count = 0; 9 let count = 0;
@@ -5,46 +11,59 @@ module.exports = Ferdium => {
5 const unreadRed = document.querySelector('.unread-red'); 11 const unreadRed = document.querySelector('.unread-red');
6 if (unreadRed !== null) { 12 if (unreadRed !== null) {
7 switch (unreadRed.classList[1]) { 13 switch (unreadRed.classList[1]) {
8 case 'fa-num1': 14 case 'fa-num1': {
9 count = 1; 15 count = 1;
10 break; 16 break;
11 case 'fa-num2': 17 }
18 case 'fa-num2': {
12 count = 2; 19 count = 2;
13 break; 20 break;
14 case 'fa-num3': 21 }
22 case 'fa-num3': {
15 count = 3; 23 count = 3;
16 break; 24 break;
17 case 'fa-num4': 25 }
26 case 'fa-num4': {
18 count = 4; 27 count = 4;
19 break; 28 break;
20 case 'fa-num5': 29 }
30 case 'fa-num5': {
21 count = 5; 31 count = 5;
22 break; 32 break;
33 }
23 default: { 34 default: {
24 // fa-num5plus 35 // fa-num5plus
25 const convUnread = document.querySelectorAll('.conv-unread:not(.func-unread__muted)'); 36 const convUnread = document.querySelectorAll(
26 if (convUnread.length === 0) 37 '.conv-unread:not(.func-unread__muted)',
27 count = 6; // 5+ 38 );
39 if (convUnread.length === 0) count = 6; // 5+
28 else 40 else
29 for (const convUnreadItem of convUnread) { 41 for (const convUnreadItem of convUnread) {
30 switch (convUnreadItem.classList[1]) { 42 switch (convUnreadItem.classList[1]) {
31 case 'fa-1_24_Line': 43 case 'fa-1_24_Line': {
32 count = count + 1; 44 count += 1;
33 break; 45 break;
34 case 'fa-2_24_Line': 46 }
35 count = count + 2; 47 case 'fa-2_24_Line': {
48 count += 2;
36 break; 49 break;
37 case 'fa-3_24_Line': 50 }
38 count = count + 3; 51 case 'fa-3_24_Line': {
52 count += 3;
39 break; 53 break;
40 case 'fa-4_24_Line': 54 }
41 count = count + 4; 55 case 'fa-4_24_Line': {
56 count += 4;
42 break; 57 break;
43 case 'fa-5_24_Line': 58 }
44 count = count + 5; 59 case 'fa-5_24_Line': {
60 count += 5;
45 break; 61 break;
46 default: // fa-5plus_24_Line 62 }
47 count = count + 6; 63 default: {
64 // fa-5plus_24_Line
65 count += 6;
66 }
48 } 67 }
49 } 68 }
50 } 69 }
@@ -53,4 +72,6 @@ module.exports = Ferdium => {
53 Ferdium.setBadge(count); 72 Ferdium.setBadge(count);
54 }; 73 };
55 Ferdium.loop(getMessages); 74 Ferdium.loop(getMessages);
56}; \ No newline at end of file 75
76 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
77};