fhdp-extenders 4.10.401 → 4.10.801

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/Module.ts +84 -84
  2. package/README.md +97 -97
  3. package/cached-package.json +1 -1
  4. package/dist/Module.d.ts +31 -31
  5. package/dist/Module.js +54 -53
  6. package/dist/Module.js.map +1 -1
  7. package/dist/source/RelocatorRules.d.ts +7 -7
  8. package/dist/source/RelocatorRules.js +267 -260
  9. package/dist/source/RelocatorRules.js.map +1 -1
  10. package/dist/source/constants.d.ts +1 -1
  11. package/dist/source/constants.js +4 -3
  12. package/dist/source/constants.js.map +1 -1
  13. package/dist/source/extenders/CookieParser.d.ts +3 -3
  14. package/dist/source/extenders/CookieParser.js +13 -11
  15. package/dist/source/extenders/CookieParser.js.map +1 -1
  16. package/dist/source/extenders/CookiePoliticsHandler.d.ts +6 -6
  17. package/dist/source/extenders/CookiePoliticsHandler.js +82 -79
  18. package/dist/source/extenders/CookiePoliticsHandler.js.map +1 -1
  19. package/dist/source/extenders/DynamicRelocator.d.ts +3 -3
  20. package/dist/source/extenders/DynamicRelocator.js +192 -190
  21. package/dist/source/extenders/DynamicRelocator.js.map +1 -1
  22. package/dist/source/extenders/FHMLExtender.d.ts +1 -1
  23. package/dist/source/extenders/FHMLExtender.js +306 -304
  24. package/dist/source/extenders/FHMLExtender.js.map +1 -1
  25. package/dist/source/extenders/PortalProcessHandler.d.ts +27 -27
  26. package/dist/source/extenders/PortalProcessHandler.js +181 -181
  27. package/dist/source/extenders/PortalProcessHandler.js.map +1 -1
  28. package/package.json +7 -6
  29. package/postpublish.js +15 -15
  30. package/prepublish.js +15 -15
  31. package/source/RelocatorRules.ts +216 -216
  32. package/source/extenders/CookieParser.ts +8 -8
  33. package/source/extenders/CookiePoliticsHandler.ts +101 -101
  34. package/source/extenders/DynamicRelocator.ts +71 -71
  35. package/source/extenders/FHMLExtender.ts +311 -311
  36. package/source/extenders/PortalProcessHandler.ts +177 -177
  37. package/tsconfig.json +18 -18
@@ -1,71 +1,71 @@
1
- const rules = [];
2
- const exclusion = [];
3
-
4
- (window as any).getRules = () => rules;
5
- (window as any).getExclustions = () => exclusion;
6
-
7
- const callback = async (mutationsList, observer) => {
8
- for (const rule of rules) {
9
- for(const mutation of mutationsList) {
10
- try {
11
- const exclustions = await Promise.all(exclusion.map(async ex => await ex.condition(mutation)));
12
- const excluded = exclustions.indexOf(true) > -1;
13
- if (!excluded) {
14
- if ((mutation.type === 'childList' || mutation.type === 'attributes') && await rule.condition(mutation)) {
15
- await rule.mutator(mutation);
16
- }
17
- }
18
- } catch (e) {
19
- console.error(e.message, `\n on rule: `, rule, '\n on mutator: ', mutation);
20
- }
21
- }
22
- }
23
- };
24
-
25
- export const dynamicRelocator = (elQuery: string) => {
26
- if (!document.querySelector(elQuery)) {
27
- return;
28
- }
29
- const config = { attributes: true, childList: true, subtree: true };
30
- const targetNode = document.querySelector(elQuery);
31
- const observer = new MutationObserver(callback);
32
- observer.observe(targetNode, config);
33
-
34
- window.onresize = async () => {
35
- const f = async () => {
36
- for (const rule of rules) {
37
- const mutation = {target: document.querySelector(rule.selector)}
38
- try {
39
- if (!!mutation.target) {
40
- const excluded = exclusion.map(ex => ex.condition(mutation)).indexOf(true) > -1;
41
- if (!excluded) {
42
- if (await rule.condition(mutation)) {
43
- await rule.mutator(mutation);
44
- }
45
- }
46
- }
47
- } catch (e) {
48
- console.error(e.message, `\n on rule: `, rule, '\n on mutator: ', mutation);
49
- }
50
- clearTimeout((window as any).resizeTimer);
51
- (window as any).resizeTimer = undefined;
52
- }
53
- }
54
- if ((window as any).resizeTimer) {
55
- clearTimeout((window as any).resizeTimer);
56
- (window as any).resizeTimer = undefined;
57
- }
58
- (window as any).resizeTimer = setTimeout(f, 200);
59
- };
60
- return observer;
61
- }
62
-
63
- export const addRule = (selector: string, condition: (mutation) => Promise<boolean>, mutator: (mutation) => Promise<void>) => {
64
- const executor = dynamicRelocator(selector);
65
- rules.push({selector, condition, mutator, executor});
66
- }
67
-
68
- export const excludeRule = (selector: string, condition: (mutation) => Promise<boolean>) => {
69
- exclusion.push({selector, condition});
70
- }
71
-
1
+ const rules = [];
2
+ const exclusion = [];
3
+
4
+ (window as any).getRules = () => rules;
5
+ (window as any).getExclustions = () => exclusion;
6
+
7
+ const callback = async (mutationsList, observer) => {
8
+ for (const rule of rules) {
9
+ for(const mutation of mutationsList) {
10
+ try {
11
+ const exclustions = await Promise.all(exclusion.map(async ex => await ex.condition(mutation)));
12
+ const excluded = exclustions.indexOf(true) > -1;
13
+ if (!excluded) {
14
+ if ((mutation.type === 'childList' || mutation.type === 'attributes') && await rule.condition(mutation)) {
15
+ await rule.mutator(mutation);
16
+ }
17
+ }
18
+ } catch (e) {
19
+ console.error(e.message, `\n on rule: `, rule, '\n on mutator: ', mutation);
20
+ }
21
+ }
22
+ }
23
+ };
24
+
25
+ export const dynamicRelocator = (elQuery: string) => {
26
+ if (!document.querySelector(elQuery)) {
27
+ return;
28
+ }
29
+ const config = { attributes: true, childList: true, subtree: true };
30
+ const targetNode = document.querySelector(elQuery);
31
+ const observer = new MutationObserver(callback);
32
+ observer.observe(targetNode, config);
33
+
34
+ window.onresize = async () => {
35
+ const f = async () => {
36
+ for (const rule of rules) {
37
+ const mutation = {target: document.querySelector(rule.selector)}
38
+ try {
39
+ if (!!mutation.target) {
40
+ const excluded = exclusion.map(ex => ex.condition(mutation)).indexOf(true) > -1;
41
+ if (!excluded) {
42
+ if (await rule.condition(mutation)) {
43
+ await rule.mutator(mutation);
44
+ }
45
+ }
46
+ }
47
+ } catch (e) {
48
+ console.error(e.message, `\n on rule: `, rule, '\n on mutator: ', mutation);
49
+ }
50
+ clearTimeout((window as any).resizeTimer);
51
+ (window as any).resizeTimer = undefined;
52
+ }
53
+ }
54
+ if ((window as any).resizeTimer) {
55
+ clearTimeout((window as any).resizeTimer);
56
+ (window as any).resizeTimer = undefined;
57
+ }
58
+ (window as any).resizeTimer = setTimeout(f, 200);
59
+ };
60
+ return observer;
61
+ }
62
+
63
+ export const addRule = (selector: string, condition: (mutation) => Promise<boolean>, mutator: (mutation) => Promise<void>) => {
64
+ const executor = dynamicRelocator(selector);
65
+ rules.push({selector, condition, mutator, executor});
66
+ }
67
+
68
+ export const excludeRule = (selector: string, condition: (mutation) => Promise<boolean>) => {
69
+ exclusion.push({selector, condition});
70
+ }
71
+