diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2023-07-26 06:29:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 17:59:03 +0530 |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/zalo/webview.js | |
parent | Add Excalidraw recipe (#393) (diff) | |
download | ferdium-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/webview.js')
-rw-r--r-- | recipes/zalo/webview.js | 63 |
1 files changed, 42 insertions, 21 deletions
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 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
1 | module.exports = Ferdium => { | 7 | module.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 | }; | ||