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/franz-custom-website/webview.js | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'recipes/franz-custom-website/webview.js') diff --git a/recipes/franz-custom-website/webview.js b/recipes/franz-custom-website/webview.js index 072fed5..18f16a3 100644 --- a/recipes/franz-custom-website/webview.js +++ b/recipes/franz-custom-website/webview.js @@ -1,30 +1,36 @@ -const _path = _interopRequireDefault(require('path')); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const _path = _interopRequireDefault(require('path')); + module.exports = (Ferdium, settings) => { Ferdium.injectCSS(_path.default.join(__dirname, 'style.css')); // 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 - document.addEventListener('click', event => { - const link = event.target.closest('a[href^="http"]'); - const button = event.target.closest('button[title^="http"]'); + document.addEventListener( + 'click', + event => { + const link = event.target.closest('a[href^="http"]'); + const button = event.target.closest('button[title^="http"]'); - if (link || button) { - const url = link ? link.getAttribute('href') : button.getAttribute('title'); + if (link || button) { + const url = link + ? link.getAttribute('href') + : button.getAttribute('title'); - if (!Ferdium.isImage(link)) { - event.preventDefault(); - event.stopPropagation(); + if (!Ferdium.isImage(link)) { + event.preventDefault(); + event.stopPropagation(); - if (settings.trapLinkClicks === true) { - window.location.href = url; - } else { - Ferdium.openNewWindow(url); + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { + Ferdium.openNewWindow(url); + } } } - } - }, true); + }, + true, + ); }; -- cgit v1.2.3-70-g09d2