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/messenger/webview.js | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'recipes/messenger/webview.js') diff --git a/recipes/messenger/webview.js b/recipes/messenger/webview.js index 7fc8ed6..39ea098 100644 --- a/recipes/messenger/webview.js +++ b/recipes/messenger/webview.js @@ -1,10 +1,16 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + function hideInstallMessage() { const installMessage = document.querySelector('.usczdcwk'); if (installMessage) { installMessage.style.display = - installMessage.style.display != 'none' - ? 'none' - : installMessage.style.display; + installMessage.style.display === 'none' + ? installMessage.style.display + : 'none'; } } @@ -17,7 +23,9 @@ module.exports = Ferdium => { * try the counting with the new UI */ for (let href of ['/', '/requests/', '/marketplace/']) { - const elem = document.querySelector(`a[href^='${href}t/'][role='link'][tabindex='0']`).ariaLabel; + const elem = document.querySelector( + `a[href^='${href}t/'][role='link'][tabindex='0']`, + ).ariaLabel; if (elem) { newMessengerUI = true; const match = elem.match(/(\d+)/g); @@ -31,18 +39,26 @@ module.exports = Ferdium => { * do the old counting if the interface is not the last one */ if (!newMessengerUI) { - count = [...document.querySelectorAll('.bp9cbjyn.j83agx80.owycx6da:not(.btwxx1t3)')] + count = [ + ...document.querySelectorAll( + '.bp9cbjyn.j83agx80.owycx6da:not(.btwxx1t3)', + ), + ] .map(elem => { - const hasPing = !!elem.querySelector('.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa'); - const isMuted = !!elem.querySelector('.a8c37x1j.ms05siws.l3qrxjdp.b7h9ocf4.trssfv1o'); + const hasPing = !!elem.querySelector( + '.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa', + ); + const isMuted = !!elem.querySelector( + '.a8c37x1j.ms05siws.l3qrxjdp.b7h9ocf4.trssfv1o', + ); return hasPing && !isMuted; }) .reduce((prev, curr) => prev + curr, 0); /* - * add count of message requests on top of notification counter - */ + * add count of message requests on top of notification counter + */ const messageRequestsElement = document.querySelector('._5nxf'); if (messageRequestsElement) { count += Ferdium.safeParseInt(messageRequestsElement.textContent); @@ -59,6 +75,8 @@ module.exports = Ferdium => { Ferdium.loop(loopRoutine); + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); + localStorage.setItem( '_cs_desktopNotifsEnabled', JSON.stringify({ -- cgit v1.2.3-54-g00ecf