diff options
author | 2023-07-26 06:29:03 -0600 | |
---|---|---|
committer | 2023-07-26 17:59:03 +0530 | |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/zoom/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/zoom/webview.js')
-rw-r--r-- | recipes/zoom/webview.js | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js index 45cc5b7..f606ac9 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js | |||
@@ -1,9 +1,9 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | 1 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | 2 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 3 | } |
6 | 4 | ||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = (Ferdium, settings) => { | 7 | module.exports = (Ferdium, settings) => { |
8 | const getMessages = () => { | 8 | const getMessages = () => { |
9 | let directCount = 0; | 9 | let directCount = 0; |
@@ -27,23 +27,29 @@ module.exports = (Ferdium, settings) => { | |||
27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | 27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); |
28 | 28 | ||
29 | // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences | 29 | // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences |
30 | document.addEventListener('click', event => { | 30 | document.addEventListener( |
31 | const link = event.target.closest('a[href^="http"]'); | 31 | 'click', |
32 | const button = event.target.closest('button[title^="http"]'); | 32 | event => { |
33 | 33 | const link = event.target.closest('a[href^="http"]'); | |
34 | if (link || button) { | 34 | const button = event.target.closest('button[title^="http"]'); |
35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 35 | |
36 | 36 | if (link || button) { | |
37 | if (!Ferdium.isImage(link)) { | 37 | const url = link |
38 | event.preventDefault(); | 38 | ? link.getAttribute('href') |
39 | event.stopPropagation(); | 39 | : button.getAttribute('title'); |
40 | 40 | ||
41 | if (settings.trapLinkClicks === true) { | 41 | if (!Ferdium.isImage(link)) { |
42 | window.location.href = url; | 42 | event.preventDefault(); |
43 | } else { | 43 | event.stopPropagation(); |
44 | Ferdium.openNewWindow(url); | 44 | |
45 | if (settings.trapLinkClicks === true) { | ||
46 | window.location.href = url; | ||
47 | } else { | ||
48 | Ferdium.openNewWindow(url); | ||
49 | } | ||
45 | } | 50 | } |
46 | } | 51 | } |
47 | } | 52 | }, |
48 | }, true); | 53 | true, |
54 | ); | ||
49 | }; | 55 | }; |