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/skype | |
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/skype')
-rw-r--r-- | recipes/skype/index.js | 13 | ||||
-rw-r--r-- | recipes/skype/package.json | 2 | ||||
-rw-r--r-- | recipes/skype/webview-unsafe.js | 5 | ||||
-rw-r--r-- | recipes/skype/webview.js | 51 |
4 files changed, 44 insertions, 27 deletions
diff --git a/recipes/skype/index.js b/recipes/skype/index.js index 425683a..0f18b4f 100644 --- a/recipes/skype/index.js +++ b/recipes/skype/index.js | |||
@@ -1,5 +1,8 @@ | |||
1 | module.exports = (Ferdium) => class Messenger extends Ferdium { | 1 | module.exports = Ferdium => |
2 | overrideUserAgent() { | 2 | class Messenger extends Ferdium { |
3 | return window.navigator.userAgent.replace(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '').trim(); | 3 | overrideUserAgent() { |
4 | } | 4 | return window.navigator.userAgent |
5 | }; | 5 | .replaceAll(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '') |
6 | .trim(); | ||
7 | } | ||
8 | }; | ||
diff --git a/recipes/skype/package.json b/recipes/skype/package.json index 18d5b37..32fcef9 100644 --- a/recipes/skype/package.json +++ b/recipes/skype/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "skype", | 2 | "id": "skype", |
3 | "name": "Skype", | 3 | "name": "Skype", |
4 | "version": "3.5.4", | 4 | "version": "3.6.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://web.skype.com/", | 7 | "serviceURL": "https://web.skype.com/", |
diff --git a/recipes/skype/webview-unsafe.js b/recipes/skype/webview-unsafe.js index 28f5e0e..a782464 100644 --- a/recipes/skype/webview-unsafe.js +++ b/recipes/skype/webview-unsafe.js | |||
@@ -1,4 +1,7 @@ | |||
1 | const nameDescriptor = Object.getOwnPropertyDescriptor(Plugin.prototype, 'name'); | 1 | const nameDescriptor = Object.getOwnPropertyDescriptor( |
2 | Plugin.prototype, | ||
3 | 'name', | ||
4 | ); | ||
2 | const getName = nameDescriptor.get; | 5 | const getName = nameDescriptor.get; |
3 | Object.defineProperty(Plugin.prototype, 'name', { | 6 | Object.defineProperty(Plugin.prototype, 'name', { |
4 | ...nameDescriptor, | 7 | ...nameDescriptor, |
diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js index db97d98..45bc005 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js | |||
@@ -1,6 +1,8 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | 1 | function _interopRequireDefault(obj) { |
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
2 | 4 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 5 | const _path = _interopRequireDefault(require('path')); |
4 | 6 | ||
5 | module.exports = (Ferdium, settings) => { | 7 | module.exports = (Ferdium, settings) => { |
6 | const getMessages = () => { | 8 | const getMessages = () => { |
@@ -8,13 +10,16 @@ module.exports = (Ferdium, settings) => { | |||
8 | const container = document.querySelector('[role="tablist"] > button > div'); | 10 | const container = document.querySelector('[role="tablist"] > button > div'); |
9 | 11 | ||
10 | if (container) { | 12 | if (container) { |
11 | const children = container.children; | 13 | const { children } = container; |
12 | 14 | ||
13 | if (children.length === 3) { | 15 | if (children.length === 3) { |
16 | // eslint-disable-next-line unicorn/prefer-at | ||
14 | const elementContainer = children[children.length - 1]; | 17 | const elementContainer = children[children.length - 1]; |
15 | 18 | ||
16 | if (elementContainer) { | 19 | if (elementContainer) { |
17 | const element = elementContainer.querySelector('[data-text-as-pseudo-element]'); | 20 | const element = elementContainer.querySelector( |
21 | '[data-text-as-pseudo-element]', | ||
22 | ); | ||
18 | if (element && element.dataset) { | 23 | if (element && element.dataset) { |
19 | count = Ferdium.safeParseInt(element.dataset.textAsPseudoElement); | 24 | count = Ferdium.safeParseInt(element.dataset.textAsPseudoElement); |
20 | } | 25 | } |
@@ -31,21 +36,27 @@ module.exports = (Ferdium, settings) => { | |||
31 | Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); | 36 | Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); |
32 | 37 | ||
33 | // 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 | 38 | // 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 |
34 | document.addEventListener('click', event => { | 39 | document.addEventListener( |
35 | const link = event.target.closest('a[href^="http"]'); | 40 | 'click', |
36 | const button = event.target.closest('button[title^="http"]'); | 41 | event => { |
37 | 42 | const link = event.target.closest('a[href^="http"]'); | |
38 | if (link || button) { | 43 | const button = event.target.closest('button[title^="http"]'); |
39 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 44 | |
40 | 45 | if (link || button) { | |
41 | event.preventDefault(); | 46 | const url = link |
42 | event.stopPropagation(); | 47 | ? link.getAttribute('href') |
43 | 48 | : button.getAttribute('title'); | |
44 | if (settings.trapLinkClicks === true) { | 49 | |
45 | window.location.href = url; | 50 | event.preventDefault(); |
46 | } else { | 51 | event.stopPropagation(); |
47 | Ferdium.openNewWindow(url); | 52 | |
53 | if (settings.trapLinkClicks === true) { | ||
54 | window.location.href = url; | ||
55 | } else { | ||
56 | Ferdium.openNewWindow(url); | ||
57 | } | ||
48 | } | 58 | } |
49 | } | 59 | }, |
50 | }, true); | 60 | true, |
61 | ); | ||
51 | }; | 62 | }; |