pervert-monkey 1.0.19 → 1.0.21

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 (50) hide show
  1. package/README.md +4 -4
  2. package/dist/core/pervertmonkey.core.es.d.ts +6 -4
  3. package/dist/core/pervertmonkey.core.es.js +20 -14
  4. package/dist/core/pervertmonkey.core.es.js.map +1 -1
  5. package/dist/core/pervertmonkey.core.umd.js +20 -14
  6. package/dist/core/pervertmonkey.core.umd.js.map +1 -1
  7. package/dist/userscripts/3hentai.user.js +2 -2
  8. package/dist/userscripts/camgirlfinder.user.js +2 -2
  9. package/dist/userscripts/camwhores.user.js +2 -2
  10. package/dist/userscripts/e-hentai.user.js +2 -2
  11. package/dist/userscripts/ebalka.user.js +2 -2
  12. package/dist/userscripts/eporner.user.js +2 -2
  13. package/dist/userscripts/erome.user.js +4 -6
  14. package/dist/userscripts/eroprofile.user.js +2 -2
  15. package/dist/userscripts/javhdporn.user.js +2 -2
  16. package/dist/userscripts/missav.user.js +2 -2
  17. package/dist/userscripts/motherless.user.js +2 -2
  18. package/dist/userscripts/namethatporn.user.js +2 -2
  19. package/dist/userscripts/nhentai.user.js +2 -2
  20. package/dist/userscripts/obmenvsem.user.js +2 -2
  21. package/dist/userscripts/pornhub.user.js +3 -3
  22. package/dist/userscripts/spankbang.user.js +2 -2
  23. package/dist/userscripts/thisvid.user.js +2 -2
  24. package/dist/userscripts/xhamster.user.js +2 -2
  25. package/dist/userscripts/xvideos.user.js +2 -2
  26. package/package.json +1 -1
  27. package/src/core/data-handler/data-manager.ts +16 -8
  28. package/src/core/parsers/thumb-data-parser.ts +1 -1
  29. package/src/core/rules/index.ts +6 -4
  30. package/src/userscripts/index.ts +1 -1
  31. package/src/userscripts/scripts/3hentai.ts +1 -1
  32. package/src/userscripts/scripts/camgirlfinder.ts +1 -1
  33. package/src/userscripts/scripts/camwhores.ts +1 -1
  34. package/src/userscripts/scripts/e-hentai.ts +1 -1
  35. package/src/userscripts/scripts/ebalka.ts +1 -1
  36. package/src/userscripts/scripts/eporner.ts +1 -1
  37. package/src/userscripts/scripts/erome.ts +2 -6
  38. package/src/userscripts/scripts/eroprofile.ts +1 -1
  39. package/src/userscripts/scripts/javhdporn.ts +1 -1
  40. package/src/userscripts/scripts/missav.ts +1 -1
  41. package/src/userscripts/scripts/motherless.ts +1 -1
  42. package/src/userscripts/scripts/namethatporn.ts +1 -1
  43. package/src/userscripts/scripts/nhentai.ts +1 -1
  44. package/src/userscripts/scripts/obmenvsem.ts +1 -1
  45. package/src/userscripts/scripts/pornhub.ts +3 -3
  46. package/src/userscripts/scripts/spankbang.ts +1 -1
  47. package/src/userscripts/scripts/thisvid.ts +1 -1
  48. package/src/userscripts/scripts/xhamster.ts +1 -1
  49. package/src/userscripts/scripts/xvideos.ts +1 -1
  50. package/src/utils/dom/index.ts +3 -5
@@ -240,11 +240,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
240
240
  if (e.parentElement) return findNextSibling(e.parentElement);
241
241
  return null;
242
242
  }
243
- function checkHomogenity(a2, b2, options) {
243
+ function areElementsAlike(a2, b2, options) {
244
244
  if (!a2 || !b2) return false;
245
- if (options.id) {
246
- if (a2.id !== b2.id) return false;
247
- }
245
+ if (options.id && a2.id !== b2.id) return false;
248
246
  if (options.className) {
249
247
  const ca2 = a2.className;
250
248
  const cb = b2.className;
@@ -631,7 +629,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
631
629
  f();
632
630
  } else {
633
631
  requestAnimationFrame(() => {
634
- containMutation(parent, f);
632
+ this.optimize(parent, f);
635
633
  });
636
634
  }
637
635
  });
@@ -651,12 +649,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
651
649
  const homogenity = !!this.containerHomogenity;
652
650
  for (const thumbElement of thumbs) {
653
651
  const url = this.rules.thumbDataParser.getUrl(thumbElement);
654
- const isHomogenic = homogenity && !checkHomogenity(
652
+ const isNotHomogenic = homogenity && !areElementsAlike(
655
653
  parent,
656
654
  thumbElement.parentElement,
657
655
  this.containerHomogenity
658
656
  );
659
- if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) || isHomogenic) {
657
+ if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) || isNotHomogenic) {
660
658
  if (removeDuplicates) thumbElement.remove();
661
659
  continue;
662
660
  }
@@ -670,7 +668,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
670
668
  }
671
669
  await this.filterAll(dataOffset);
672
670
  if (!parent) return;
673
- containMutation(parent, () => parent == null ? void 0 : parent.appendChild(fragment));
671
+ this.optimize(parent, () => parent == null ? void 0 : parent.appendChild(fragment));
672
+ }
673
+ optimize(container, mutation) {
674
+ if (this.rules.containMutationEnabled) {
675
+ containMutation(container, mutation);
676
+ } else {
677
+ mutation();
678
+ }
674
679
  }
675
680
  sortBy(key, direction = true) {
676
681
  if (this.data.size < 2) return;
@@ -680,7 +685,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
680
685
  for (const [container, items] of byContainers) {
681
686
  items.sort((a2, b2) => (a2[key] - b2[key]) * dir);
682
687
  const children = items.map((e) => e.element);
683
- containMutation(container, () => container.replaceChildren(...children));
688
+ this.optimize(container, () => container.replaceChildren(...children));
684
689
  }
685
690
  }
686
691
  }
@@ -3081,7 +3086,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3081
3086
  return { title, duration };
3082
3087
  }
3083
3088
  getUrl(thumb) {
3084
- return (thumb.querySelector("a[href]") || thumb).href;
3089
+ return querySelectorOrSelf(thumb, "a[href]").href;
3085
3090
  }
3086
3091
  preprocessCustomThumbDataSelectors() {
3087
3092
  if (!this.selectors) return;
@@ -9864,12 +9869,12 @@ Expected function or array of functions, received type ${typeof t}.`
9864
9869
  }
9865
9870
  class Rules {
9866
9871
  constructor(options) {
9872
+ __publicField(this, "thumbs", {});
9873
+ __publicField(this, "thumbsParser");
9867
9874
  __publicField(this, "thumb", {});
9868
9875
  __publicField(this, "thumbDataParser");
9869
9876
  __publicField(this, "thumbImg", {});
9870
9877
  __publicField(this, "thumbImgParser");
9871
- __publicField(this, "thumbs", {});
9872
- __publicField(this, "thumbsParser");
9873
9878
  __publicField(this, "containerSelector", ".container");
9874
9879
  __publicField(this, "containerSelectorLast");
9875
9880
  __publicField(this, "intersectionObservableSelector");
@@ -9888,14 +9893,15 @@ Expected function or array of functions, received type ${typeof t}.`
9888
9893
  __publicField(this, "infiniteScroller");
9889
9894
  __publicField(this, "getPaginationData");
9890
9895
  __publicField(this, "gropeStrategy", "all-in-one");
9896
+ __publicField(this, "containMutationEnabled", true);
9891
9897
  __publicField(this, "mutationObservers", []);
9892
9898
  __publicField(this, "resetOnPaginationOrContainerDeath", true);
9893
9899
  __publicField(this, "onResetCallback");
9894
9900
  if (this.isEmbedded) throw Error("Embedded is not supported");
9895
9901
  Object.assign(this, options);
9902
+ this.thumbsParser = ThumbsParser.create(this.thumbs);
9896
9903
  this.thumbDataParser = ThumbDataParser.create(this.thumb);
9897
9904
  this.thumbImgParser = ThumbImgParser.create(this.thumbImg);
9898
- this.thumbsParser = ThumbsParser.create(this.thumbs);
9899
9905
  this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
9900
9906
  this.store = this.createStore();
9901
9907
  this.gui = this.createGui();
@@ -10008,7 +10014,7 @@ Expected function or array of functions, received type ${typeof t}.`
10008
10014
  exports2.ThumbImgParser = ThumbImgParser;
10009
10015
  exports2.ThumbsParser = ThumbsParser;
10010
10016
  exports2.Tick = Tick;
10011
- exports2.checkHomogenity = checkHomogenity;
10017
+ exports2.areElementsAlike = areElementsAlike;
10012
10018
  exports2.chunks = chunks;
10013
10019
  exports2.circularShift = circularShift;
10014
10020
  exports2.containMutation = containMutation;