From 9b8f01716774a960073e944823ab727cc867a8f6 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Wed, 26 Jul 2023 06:29:03 -0600 Subject: 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 --- recipes/zalo/package.json | 2 +- recipes/zalo/webview.js | 63 +++++++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 22 deletions(-) (limited to 'recipes/zalo') 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 @@ { "id": "zalo", "name": "Zalo", - "version": "1.4.0", + "version": "1.5.0", "license": "MIT", "config": { "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 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + module.exports = Ferdium => { const getMessages = () => { let count = 0; @@ -5,46 +11,59 @@ module.exports = Ferdium => { const unreadRed = document.querySelector('.unread-red'); if (unreadRed !== null) { switch (unreadRed.classList[1]) { - case 'fa-num1': + case 'fa-num1': { count = 1; break; - case 'fa-num2': + } + case 'fa-num2': { count = 2; break; - case 'fa-num3': + } + case 'fa-num3': { count = 3; break; - case 'fa-num4': + } + case 'fa-num4': { count = 4; break; - case 'fa-num5': + } + case 'fa-num5': { count = 5; break; + } default: { // fa-num5plus - const convUnread = document.querySelectorAll('.conv-unread:not(.func-unread__muted)'); - if (convUnread.length === 0) - count = 6; // 5+ + const convUnread = document.querySelectorAll( + '.conv-unread:not(.func-unread__muted)', + ); + if (convUnread.length === 0) count = 6; // 5+ else for (const convUnreadItem of convUnread) { switch (convUnreadItem.classList[1]) { - case 'fa-1_24_Line': - count = count + 1; + case 'fa-1_24_Line': { + count += 1; break; - case 'fa-2_24_Line': - count = count + 2; + } + case 'fa-2_24_Line': { + count += 2; break; - case 'fa-3_24_Line': - count = count + 3; + } + case 'fa-3_24_Line': { + count += 3; break; - case 'fa-4_24_Line': - count = count + 4; + } + case 'fa-4_24_Line': { + count += 4; break; - case 'fa-5_24_Line': - count = count + 5; + } + case 'fa-5_24_Line': { + count += 5; break; - default: // fa-5plus_24_Line - count = count + 6; + } + default: { + // fa-5plus_24_Line + count += 6; + } } } } @@ -53,4 +72,6 @@ module.exports = Ferdium => { Ferdium.setBadge(count); }; Ferdium.loop(getMessages); -}; \ No newline at end of file + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-70-g09d2