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/whatsapp/webview-unsafe.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/whatsapp/webview-unsafe.js')
-rw-r--r-- | recipes/whatsapp/webview-unsafe.js | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/recipes/whatsapp/webview-unsafe.js b/recipes/whatsapp/webview-unsafe.js index b6b365b..7382f3d 100644 --- a/recipes/whatsapp/webview-unsafe.js +++ b/recipes/whatsapp/webview-unsafe.js | |||
@@ -5,38 +5,37 @@ const PUSHSTATE_THROTTLE = 1; | |||
5 | const PUSHSTATE_THROTTLE_THRESHOLD = 1; | 5 | const PUSHSTATE_THROTTLE_THRESHOLD = 1; |
6 | 6 | ||
7 | window.shPushState = window.history.pushState; | 7 | window.shPushState = window.history.pushState; |
8 | //window.pushStateBehavior = PUSHSTATE_NORMAL; | 8 | // window.pushStateBehavior = PUSHSTATE_NORMAL; |
9 | window.pushStateBehavior = PUSHSTATE_THROTTLE; | 9 | window.pushStateBehavior = PUSHSTATE_THROTTLE; |
10 | window.pushStateCount = 0; | 10 | window.pushStateCount = 0; |
11 | 11 | ||
12 | function pushStateThrottled() { | 12 | function pushStateThrottled() { |
13 | if (window.pushStateCount < PUSHSTATE_THROTTLE_THRESHOLD) | 13 | if (window.pushStateCount < PUSHSTATE_THROTTLE_THRESHOLD) { |
14 | { | 14 | window.shPushState.apply(window.history, arguments); |
15 | window.shPushState.apply(window.history, arguments); | 15 | window.pushStateCount++; |
16 | window.pushStateCount++; | 16 | |
17 | 17 | if (window.pushStateCount == PUSHSTATE_THROTTLE_THRESHOLD) | |
18 | if (window.pushStateCount == PUSHSTATE_THROTTLE_THRESHOLD) | 18 | setTimeout(() => { |
19 | setTimeout(() => { | 19 | window.pushStateCount = 0; |
20 | window.pushStateCount = 0; | 20 | }, 5000); |
21 | }, | 21 | } else { |
22 | 5000); | 22 | // eslint-disable-next-line no-console |
23 | } | 23 | console.log('Pushstate temporarily blocked!'); |
24 | else | 24 | } |
25 | { | ||
26 | console.log("Pushstate temporarily blocked!"); | ||
27 | } | ||
28 | } | 25 | } |
29 | 26 | ||
30 | function pushStateOneShot() { | 27 | function pushStateOneShot() { |
31 | window.shPushState.apply(window.history, arguments); | 28 | window.shPushState.apply(window.history, arguments); |
32 | 29 | ||
33 | window.history.pushState = function() {}; | 30 | window.history.pushState = function () {}; |
34 | 31 | ||
35 | console.log("Pushstate Disabled!"); | 32 | // eslint-disable-next-line no-console |
33 | console.log('Pushstate Disabled!'); | ||
36 | } | 34 | } |
37 | 35 | ||
38 | if (window.pushStateBehavior != PUSHSTATE_NORMAL) | 36 | if (window.pushStateBehavior != PUSHSTATE_NORMAL) { |
39 | { | 37 | window.history.pushState = |
40 | window.history.pushState = | 38 | window.pushStateBehavior == PUSHSTATE_THROTTLE |
41 | window.pushStateBehavior == PUSHSTATE_THROTTLE ? pushStateThrottled : pushStateOneShot; | 39 | ? pushStateThrottled |
40 | : pushStateOneShot; | ||
42 | } | 41 | } |