diff options
author | 2023-07-26 06:29:03 -0600 | |
---|---|---|
committer | 2023-07-26 17:59:03 +0530 | |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/facebookpages | |
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/facebookpages')
-rw-r--r-- | recipes/facebookpages/package.json | 2 | ||||
-rw-r--r-- | recipes/facebookpages/webview.js | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/recipes/facebookpages/package.json b/recipes/facebookpages/package.json index 750264a..1727384 100644 --- a/recipes/facebookpages/package.json +++ b/recipes/facebookpages/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "facebookpages", | 2 | "id": "facebookpages", |
3 | "name": "Facebook Pages", | 3 | "name": "Facebook Pages", |
4 | "version": "1.3.0", | 4 | "version": "1.4.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://facebook.com/{teamId}/", | 7 | "serviceURL": "https://facebook.com/{teamId}/", |
diff --git a/recipes/facebookpages/webview.js b/recipes/facebookpages/webview.js index d624017..f1310e9 100644 --- a/recipes/facebookpages/webview.js +++ b/recipes/facebookpages/webview.js | |||
@@ -1,7 +1,15 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
1 | module.exports = (Ferdium, options) => { | 7 | module.exports = (Ferdium, options) => { |
2 | const getMessages = () => { | 8 | const getMessages = () => { |
3 | let messages = 0; | 9 | let messages = 0; |
4 | const element = document.querySelector('[data-testid="message_count"] span'); | 10 | const element = document.querySelector( |
11 | '[data-testid="message_count"] span', | ||
12 | ); | ||
5 | 13 | ||
6 | if (element) { | 14 | if (element) { |
7 | messages = Ferdium.safeParseInt(element.textContent); | 15 | messages = Ferdium.safeParseInt(element.textContent); |
@@ -13,7 +21,10 @@ module.exports = (Ferdium, options) => { | |||
13 | Ferdium.loop(getMessages); | 21 | Ferdium.loop(getMessages); |
14 | 22 | ||
15 | setTimeout(() => { | 23 | setTimeout(() => { |
16 | if (document.body && !document.body.classList.contains('UIPage_LoggedOut')) { | 24 | if ( |
25 | document.body && | ||
26 | !document.body.classList.contains('UIPage_LoggedOut') | ||
27 | ) { | ||
17 | if (localStorage.getItem('franz-needsRedirect')) { | 28 | if (localStorage.getItem('franz-needsRedirect')) { |
18 | window.location.href = `https://facebook.com/${options.team}/inbox`; | 29 | window.location.href = `https://facebook.com/${options.team}/inbox`; |
19 | localStorage.removeItem('franz-needsRedirect'); | 30 | localStorage.removeItem('franz-needsRedirect'); |
@@ -22,4 +33,6 @@ module.exports = (Ferdium, options) => { | |||
22 | localStorage.setItem('franz-needsRedirect', 'true'); | 33 | localStorage.setItem('franz-needsRedirect', 'true'); |
23 | } | 34 | } |
24 | }, 500); | 35 | }, 500); |
36 | |||
37 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
25 | }; | 38 | }; |