pervert-monkey 1.0.20 → 1.0.22

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 (48) hide show
  1. package/dist/core/pervertmonkey.core.es.d.ts +3 -1
  2. package/dist/core/pervertmonkey.core.es.js +13 -5
  3. package/dist/core/pervertmonkey.core.es.js.map +1 -1
  4. package/dist/core/pervertmonkey.core.umd.js +13 -5
  5. package/dist/core/pervertmonkey.core.umd.js.map +1 -1
  6. package/dist/userscripts/3hentai.user.js +2 -2
  7. package/dist/userscripts/camgirlfinder.user.js +2 -2
  8. package/dist/userscripts/camwhores.user.js +2 -2
  9. package/dist/userscripts/e-hentai.user.js +2 -2
  10. package/dist/userscripts/ebalka.user.js +6 -5
  11. package/dist/userscripts/eporner.user.js +2 -2
  12. package/dist/userscripts/erome.user.js +4 -6
  13. package/dist/userscripts/eroprofile.user.js +2 -2
  14. package/dist/userscripts/javhdporn.user.js +2 -2
  15. package/dist/userscripts/missav.user.js +2 -2
  16. package/dist/userscripts/motherless.user.js +2 -2
  17. package/dist/userscripts/namethatporn.user.js +2 -2
  18. package/dist/userscripts/nhentai.user.js +2 -2
  19. package/dist/userscripts/obmenvsem.user.js +2 -2
  20. package/dist/userscripts/pornhub.user.js +2 -2
  21. package/dist/userscripts/spankbang.user.js +2 -2
  22. package/dist/userscripts/thisvid.user.js +2 -2
  23. package/dist/userscripts/xhamster.user.js +2 -2
  24. package/dist/userscripts/xvideos.user.js +2 -2
  25. package/package.json +1 -1
  26. package/src/core/data-handler/data-manager.ts +11 -3
  27. package/src/core/rules/index.ts +2 -0
  28. package/src/userscripts/index.ts +1 -1
  29. package/src/userscripts/scripts/3hentai.ts +1 -1
  30. package/src/userscripts/scripts/camgirlfinder.ts +1 -1
  31. package/src/userscripts/scripts/camwhores.ts +1 -1
  32. package/src/userscripts/scripts/e-hentai.ts +1 -1
  33. package/src/userscripts/scripts/ebalka.ts +6 -4
  34. package/src/userscripts/scripts/eporner.ts +1 -1
  35. package/src/userscripts/scripts/erome.ts +2 -6
  36. package/src/userscripts/scripts/eroprofile.ts +1 -1
  37. package/src/userscripts/scripts/javhdporn.ts +1 -1
  38. package/src/userscripts/scripts/missav.ts +1 -1
  39. package/src/userscripts/scripts/motherless.ts +1 -1
  40. package/src/userscripts/scripts/namethatporn.ts +1 -1
  41. package/src/userscripts/scripts/nhentai.ts +1 -1
  42. package/src/userscripts/scripts/obmenvsem.ts +1 -1
  43. package/src/userscripts/scripts/pornhub.ts +1 -1
  44. package/src/userscripts/scripts/spankbang.ts +1 -1
  45. package/src/userscripts/scripts/thisvid.ts +1 -1
  46. package/src/userscripts/scripts/xhamster.ts +1 -1
  47. package/src/userscripts/scripts/xvideos.ts +1 -1
  48. package/src/utils/performance/index.ts +2 -2
@@ -16,7 +16,7 @@ export declare function chunks<T>(arr: T[], size: number): T[][];
16
16
 
17
17
  export declare function circularShift(n: number, c?: number, s?: number): number;
18
18
 
19
- export declare function containMutation(container: HTMLElement, callback: () => void): void;
19
+ export declare function containMutation(container: HTMLElement, mutation: () => void): void;
20
20
 
21
21
  export declare function copyAttributes<T extends Element = HTMLElement>(target: T, source: T): void;
22
22
 
@@ -73,6 +73,7 @@ export declare class DataManager {
73
73
  applyFilters(filters?: Record<string, boolean>, offset?: number): Promise<void>;
74
74
  filterAll(offset?: number): Promise<void>;
75
75
  parseData(html: HTMLElement, container?: HTMLElement, removeDuplicates?: boolean, shouldLazify?: boolean): Promise<void>;
76
+ private optimize;
76
77
  sortBy<K extends keyof DataElement>(key: K, direction?: boolean): void;
77
78
  }
78
79
 
@@ -440,6 +441,7 @@ export declare class Rules {
440
441
  gropeStrategy: 'all-in-one' | 'all-in-all';
441
442
  gropeInit(): void;
442
443
  get isEmbedded(): boolean;
444
+ containMutationEnabled: boolean;
443
445
  private mutationObservers;
444
446
  resetOnPaginationOrContainerDeath: boolean;
445
447
  private resetOn;
@@ -497,10 +497,10 @@ function runIdleJob(iterator2, job) {
497
497
  scheduler(runBatch);
498
498
  });
499
499
  }
500
- function containMutation(container, callback) {
500
+ function containMutation(container, mutation) {
501
501
  container.style.contain = "content";
502
502
  try {
503
- callback();
503
+ mutation();
504
504
  } finally {
505
505
  requestAnimationFrame(() => {
506
506
  requestAnimationFrame(() => {
@@ -626,7 +626,7 @@ class DataManager {
626
626
  f();
627
627
  } else {
628
628
  requestAnimationFrame(() => {
629
- containMutation(parent, f);
629
+ this.optimize(parent, f);
630
630
  });
631
631
  }
632
632
  });
@@ -665,7 +665,14 @@ class DataManager {
665
665
  }
666
666
  await this.filterAll(dataOffset);
667
667
  if (!parent) return;
668
- containMutation(parent, () => parent == null ? void 0 : parent.appendChild(fragment));
668
+ this.optimize(parent, () => parent == null ? void 0 : parent.appendChild(fragment));
669
+ }
670
+ optimize(container, mutation) {
671
+ if (this.rules.containMutationEnabled) {
672
+ containMutation(container, mutation);
673
+ } else {
674
+ mutation();
675
+ }
669
676
  }
670
677
  sortBy(key, direction = true) {
671
678
  if (this.data.size < 2) return;
@@ -675,7 +682,7 @@ class DataManager {
675
682
  for (const [container, items] of byContainers) {
676
683
  items.sort((a2, b2) => (a2[key] - b2[key]) * dir);
677
684
  const children = items.map((e) => e.element);
678
- containMutation(container, () => container.replaceChildren(...children));
685
+ this.optimize(container, () => container.replaceChildren(...children));
679
686
  }
680
687
  }
681
688
  }
@@ -9883,6 +9890,7 @@ class Rules {
9883
9890
  __publicField(this, "infiniteScroller");
9884
9891
  __publicField(this, "getPaginationData");
9885
9892
  __publicField(this, "gropeStrategy", "all-in-one");
9893
+ __publicField(this, "containMutationEnabled", true);
9886
9894
  __publicField(this, "mutationObservers", []);
9887
9895
  __publicField(this, "resetOnPaginationOrContainerDeath", true);
9888
9896
  __publicField(this, "onResetCallback");