pervert-monkey 1.0.15 → 1.0.17

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 (51) hide show
  1. package/dist/core/pervertmonkey.core.es.d.ts +9 -8
  2. package/dist/core/pervertmonkey.core.es.js +57 -46
  3. package/dist/core/pervertmonkey.core.es.js.map +1 -1
  4. package/dist/core/pervertmonkey.core.umd.js +57 -46
  5. package/dist/core/pervertmonkey.core.umd.js.map +1 -1
  6. package/dist/userscripts/3hentai.user.js +9 -3
  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 +7 -6
  10. package/dist/userscripts/ebalka.user.js +7 -7
  11. package/dist/userscripts/eporner.user.js +5 -2
  12. package/dist/userscripts/erome.user.js +7 -11
  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 +3 -3
  17. package/dist/userscripts/namethatporn.user.js +4 -4
  18. package/dist/userscripts/nhentai.user.js +2 -2
  19. package/dist/userscripts/obmenvsem.user.js +3 -2
  20. package/dist/userscripts/pornhub.user.js +2 -2
  21. package/dist/userscripts/spankbang.user.js +5 -5
  22. package/dist/userscripts/thisvid.user.js +5 -5
  23. package/dist/userscripts/xhamster.user.js +6 -6
  24. package/dist/userscripts/xvideos.user.js +8 -8
  25. package/package.json +1 -1
  26. package/src/core/data-handler/data-filter-fn-defaults.ts +8 -8
  27. package/src/core/data-handler/data-filter-fn.ts +10 -8
  28. package/src/core/data-handler/data-filter.ts +10 -8
  29. package/src/core/data-handler/data-manager.ts +29 -15
  30. package/src/core/parsers/thumb-data-parser.ts +11 -4
  31. package/src/userscripts/scripts/3hentai.ts +4 -2
  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 +9 -7
  35. package/src/userscripts/scripts/ebalka.ts +6 -6
  36. package/src/userscripts/scripts/eporner.ts +4 -1
  37. package/src/userscripts/scripts/erome.ts +6 -12
  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 +4 -3
  42. package/src/userscripts/scripts/namethatporn.ts +3 -3
  43. package/src/userscripts/scripts/nhentai.ts +1 -1
  44. package/src/userscripts/scripts/obmenvsem.ts +6 -2
  45. package/src/userscripts/scripts/pornhub.ts +1 -1
  46. package/src/userscripts/scripts/spankbang.ts +4 -4
  47. package/src/userscripts/scripts/thisvid.ts +3 -3
  48. package/src/userscripts/scripts/xhamster.ts +5 -5
  49. package/src/userscripts/scripts/xvideos.ts +7 -7
  50. package/src/utils/dom/dom-observers.ts +3 -3
  51. package/src/utils/dom/index.ts +1 -1
@@ -14,21 +14,23 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
 
16
16
  var _i2, _n2, _t, _e2, _s2, _l2, _o2, _d, _p2, _g, _C_instances, r_fn, R_fn, b_fn, u_fn, m_fn, a_fn, P_fn, E_fn, S_fn, O_fn, k_fn, x_fn, h_fn, f_fn, T_fn, A_fn, y_fn, w_fn, c_fn, C_fn, _a2, _i3, _n3, _t2, _e3, _s3, _l3, _b;
17
- class DataFilterFn {
17
+ const _DataFilterFn = class _DataFilterFn {
18
18
  constructor(handle, deps = [], name, $preDefine) {
19
- __publicField(this, "tag");
20
19
  this.handle = handle;
21
20
  this.deps = deps;
22
21
  this.name = name;
23
22
  this.$preDefine = $preDefine;
24
- this.tag = `filter-${name}`;
23
+ this.name = _DataFilterFn.setPrefix(name);
24
+ }
25
+ static setPrefix(name) {
26
+ return `${_DataFilterFn.prefix}${name}`;
25
27
  }
26
28
  static from(options, name) {
27
29
  if (typeof options === "function") {
28
30
  const deps = [name];
29
- return new DataFilterFn(options, deps, name);
31
+ return new _DataFilterFn(options, deps, name);
30
32
  }
31
- return new DataFilterFn(
33
+ return new _DataFilterFn(
32
34
  options.handle,
33
35
  options.deps,
34
36
  name,
@@ -36,20 +38,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
36
38
  );
37
39
  }
38
40
  renderFn(state) {
39
- const tag = this.tag;
41
+ const name = this.name;
40
42
  return () => {
41
43
  var _a3;
42
44
  const preDefined = (_a3 = this.$preDefine) == null ? void 0 : _a3.call(this, state);
43
45
  return (a2) => {
44
46
  const condition = this.handle(a2, state, preDefined);
45
- return {
46
- condition,
47
- tag
48
- };
47
+ return { condition, name };
49
48
  };
50
49
  };
51
50
  }
52
- }
51
+ };
52
+ __publicField(_DataFilterFn, "prefix", "filter-");
53
+ let DataFilterFn = _DataFilterFn;
53
54
  function chunks(arr, size) {
54
55
  return Array.from(
55
56
  { length: Math.ceil(arr.length / size) },
@@ -120,10 +121,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
120
121
  }
121
122
  function waitForElementToAppear(parent, selector, callback) {
122
123
  const observer = new MutationObserver((_mutations) => {
123
- const el2 = parent.querySelector(selector);
124
- if (el2) {
124
+ const e = parent.querySelector(selector);
125
+ if (e) {
125
126
  observer.disconnect();
126
- callback(el2);
127
+ callback(e);
127
128
  }
128
129
  });
129
130
  observer.observe(document.body, { childList: true, subtree: true });
@@ -222,7 +223,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
222
223
  });
223
224
  }
224
225
  function getCommonParents(elements) {
225
- const parents = Array.from(elements).map((el2) => el2.parentElement).filter((parent) => parent !== null);
226
+ const parents = Array.from(elements).map((e) => e.parentElement).filter((parent) => parent !== null);
226
227
  return [...new Set(parents)];
227
228
  }
228
229
  function findNextSibling(e) {
@@ -471,9 +472,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
471
472
  function createTextFilter(filterName, dataPropName, positive) {
472
473
  const filterNameValue = `${filterName}Words`;
473
474
  return {
474
- handle(el2, state, searchFilter) {
475
+ handle(e, state, searchFilter) {
475
476
  if (!Object.hasOwn(state, filterName) || !state[filterName]) return false;
476
- return !(searchFilter == null ? void 0 : searchFilter(el2[dataPropName]));
477
+ return !(searchFilter == null ? void 0 : searchFilter(e[dataPropName]));
477
478
  },
478
479
  $preDefine: (state) => {
479
480
  const r = new RegexFilter(state[filterNameValue]);
@@ -484,9 +485,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
484
485
  };
485
486
  }
486
487
  const filterDuration = {
487
- handle(el2, state, notInRange) {
488
+ handle(e, state, notInRange) {
488
489
  if (!state.filterDuration) return false;
489
- return !!(notInRange == null ? void 0 : notInRange(el2.duration));
490
+ return !!(notInRange == null ? void 0 : notInRange(e.duration));
490
491
  },
491
492
  $preDefine: (state) => {
492
493
  const from = state.filterDurationFrom;
@@ -504,26 +505,27 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
504
505
  filterInclude: createTextFilter("filterInclude", "title", true),
505
506
  filterUploaderExclude: createTextFilter("filterUploaderExclude", "uploader", false),
506
507
  filterUploaderInclude: createTextFilter("filterUploaderInclude", "uploader", true),
507
- filterHD: (el2, state) => state.filterHD && !el2.hd,
508
- filterNonHD: (el2, state) => state.filterNonHD && el2.hd,
509
- filterPrivate: (el2, state) => state.filterPrivate && el2.private,
510
- filterPublic: (el2, state) => state.filterPublic && !el2.private
508
+ filterHD: (e, state) => state.filterHD && !e.hd,
509
+ filterNonHD: (e, state) => state.filterNonHD && e.hd,
510
+ filterPrivate: (e, state) => state.filterPrivate && e.private,
511
+ filterPublic: (e, state) => state.filterPublic && !e.private
511
512
  };
512
513
  class DataFilter {
513
514
  constructor(rules) {
514
515
  __publicField(this, "filters", /* @__PURE__ */ new Map());
515
- __publicField(this, "customDataFilterFns", {});
516
516
  __publicField(this, "filterMapping", {});
517
+ __publicField(this, "customDataFilterFns", {});
517
518
  this.rules = rules;
518
519
  this.registerFilters(rules.customDataFilterFns);
519
- this.applyCSSFilters();
520
+ this.createCssFilters();
520
521
  }
521
- static isFiltered(el2) {
522
- return el2.className.includes("filter-");
522
+ static isFiltered(e) {
523
+ return e.className.includes(DataFilterFn.prefix);
523
524
  }
524
- applyCSSFilters(wrapper) {
525
+ createCssFilters(wrapper) {
525
526
  this.filters.forEach((_2, name) => {
526
- const cssRule = `.filter-${name} { display: none !important; }`;
527
+ const className = DataFilterFn.setPrefix(name);
528
+ const cssRule = `.${className} { display: none !important; }`;
527
529
  client.GM_addStyle(wrapper ? wrapper(cssRule) : cssRule);
528
530
  });
529
531
  }
@@ -536,12 +538,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
536
538
  });
537
539
  }
538
540
  registerFilter(customSelectorName) {
539
- var _a3;
540
541
  const dataFilterFn = DataFilterFn.from(
541
542
  this.customDataFilterFns[customSelectorName],
542
543
  customSelectorName
543
544
  );
544
- (_a3 = [customSelectorName, ...dataFilterFn.deps]) == null ? void 0 : _a3.forEach((name) => {
545
+ dataFilterFn.deps.push(customSelectorName);
546
+ dataFilterFn.deps.forEach((name) => {
545
547
  Object.assign(this.filterMapping, { [name]: customSelectorName });
546
548
  });
547
549
  this.filters.set(customSelectorName, dataFilterFn.renderFn(this.rules.store.state));
@@ -571,8 +573,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
571
573
  finished = !!done;
572
574
  if (done) break;
573
575
  for (const f of filtersToApply) {
574
- const { tag, condition } = f()(value);
575
- updates.push({ e: value.element, tag, condition });
576
+ const { name, condition } = f()(value);
577
+ updates.push({ e: value.element, name, condition });
576
578
  }
577
579
  }
578
580
  if (!finished) {
@@ -583,13 +585,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
583
585
  }
584
586
  requestIdleCallback(runBatch);
585
587
  });
586
- const parents = new Set(updates.map((u) => u.e.parentElement));
588
+ const parents = [...new Set(updates.map((u) => u.e.parentElement))].filter(
589
+ (_2) => _2 !== null
590
+ );
587
591
  requestAnimationFrame(() => {
588
- const revertDisplayStyle = [...parents].map((p) => {
589
- const display = p == null ? void 0 : p.style.display;
590
- if (!display) return void 0;
592
+ const revertDisplayStyle = parents.map((p) => {
593
+ const display = p.style.display;
591
594
  p.style.display = "none";
592
- p.style.contain = "layout style paint";
595
+ this.layoutStylePaint(p);
593
596
  p.style.willChange = "contents";
594
597
  return () => {
595
598
  p.style.display = display;
@@ -599,13 +602,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
599
602
  };
600
603
  });
601
604
  updates.forEach((u) => {
602
- u.e.classList.toggle(u.tag, u.condition);
605
+ u.e.classList.toggle(u.name, u.condition);
603
606
  });
604
607
  revertDisplayStyle.forEach((f) => {
605
608
  f == null ? void 0 : f();
606
609
  });
607
610
  });
608
611
  });
612
+ __publicField(this, "layoutStylePaintEnabled", false);
609
613
  __publicField(this, "filterAll", async (offset) => {
610
614
  const keys = Array.from(this.dataFilter.filters.keys());
611
615
  const filters = Object.fromEntries(
@@ -619,10 +623,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
619
623
  const fragment = document.createDocumentFragment();
620
624
  const parent = container || this.rules.container;
621
625
  const homogenity = !!this.containerHomogenity;
622
- if (parent) {
623
- parent.style.contain = "layout style paint";
624
- parent.style.willChange = "contents";
625
- }
626
626
  for (const thumbElement of thumbs) {
627
627
  const url = this.rules.thumbDataParser.getUrl(thumbElement);
628
628
  if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) || homogenity && !checkHomogenity(
@@ -642,8 +642,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
642
642
  fragment.append(thumbElement);
643
643
  }
644
644
  this.filterAll(dataOffset).then(() => {
645
+ if (!parent) return;
646
+ parent.style.willChange = "contents";
645
647
  requestAnimationFrame(() => {
646
648
  parent == null ? void 0 : parent.appendChild(fragment);
649
+ requestAnimationFrame(() => {
650
+ parent.style.willChange = "auto";
651
+ });
647
652
  });
648
653
  });
649
654
  });
@@ -651,12 +656,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
651
656
  this.containerHomogenity = containerHomogenity;
652
657
  this.dataFilter = new DataFilter(this.rules);
653
658
  }
659
+ layoutStylePaint(e) {
660
+ if (!this.layoutStylePaintEnabled) return;
661
+ e.style.contain = "layout style paint";
662
+ }
654
663
  sortBy(key, direction = true) {
655
664
  if (this.data.size < 2) return;
656
665
  const elements = this.data.values().toArray().filter((e) => e.element.parentElement !== null).map((e) => e);
657
666
  const containers = new Set(elements.map((e) => e.element.parentElement));
658
667
  containers.forEach((c) => {
659
- c.style.contain = "layout style paint";
668
+ this.layoutStylePaint(c);
660
669
  c.style.willChange = "contents";
661
670
  });
662
671
  const elementsByContainers = /* @__PURE__ */ new Map();
@@ -3078,8 +3087,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3078
3087
  }
3079
3088
  autoParseText(thumb) {
3080
3089
  var _a3;
3081
- const title = sanitizeStr(thumb.innerText);
3082
- const duration = timeToSeconds(((_a3 = title.match(/\d+m|\d+:\d+/)) == null ? void 0 : _a3[0]) || "");
3090
+ let title = sanitizeStr(thumb.innerText);
3091
+ const durationStr = ((_a3 = title.match(/(\d+:\d+:?\d+?)|\d+m/)) == null ? void 0 : _a3[0]) || "";
3092
+ const duration = timeToSeconds(durationStr);
3093
+ title = title.replaceAll(durationStr, "");
3083
3094
  return { title, duration };
3084
3095
  }
3085
3096
  getUrl(thumb) {