pervert-monkey 1.0.13 → 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 (58) hide show
  1. package/dist/core/pervertmonkey.core.es.d.ts +90 -36
  2. package/dist/core/pervertmonkey.core.es.js +258 -129
  3. package/dist/core/pervertmonkey.core.es.js.map +1 -1
  4. package/dist/core/pervertmonkey.core.umd.js +258 -129
  5. package/dist/core/pervertmonkey.core.umd.js.map +1 -1
  6. package/dist/userscripts/3hentai.user.js +4 -5
  7. package/dist/userscripts/camgirlfinder.user.js +2 -2
  8. package/dist/userscripts/camwhores.user.js +7 -16
  9. package/dist/userscripts/e-hentai.user.js +8 -8
  10. package/dist/userscripts/ebalka.user.js +18 -10
  11. package/dist/userscripts/eporner.user.js +24 -41
  12. package/dist/userscripts/erome.user.js +13 -16
  13. package/dist/userscripts/eroprofile.user.js +5 -14
  14. package/dist/userscripts/javhdporn.user.js +6 -5
  15. package/dist/userscripts/missav.user.js +10 -4
  16. package/dist/userscripts/motherless.user.js +13 -6
  17. package/dist/userscripts/namethatporn.user.js +10 -16
  18. package/dist/userscripts/nhentai.user.js +5 -13
  19. package/dist/userscripts/obmenvsem.user.js +11 -4
  20. package/dist/userscripts/pornhub.user.js +14 -6
  21. package/dist/userscripts/spankbang.user.js +28 -7
  22. package/dist/userscripts/thisvid.user.js +15 -33
  23. package/dist/userscripts/xhamster.user.js +13 -18
  24. package/dist/userscripts/xvideos.user.js +33 -5
  25. package/package.json +1 -1
  26. package/src/core/data-handler/data-filter-fn-defaults.ts +52 -0
  27. package/src/core/data-handler/data-filter-fn.ts +62 -0
  28. package/src/core/data-handler/data-filter.ts +31 -103
  29. package/src/core/data-handler/data-manager.ts +91 -28
  30. package/src/core/jabroni-config/default-scheme.ts +54 -5
  31. package/src/core/jabroni-config/index.ts +1 -0
  32. package/src/core/jabroni-config/jabroni-gui-controller.ts +1 -1
  33. package/src/core/jabroni-config/scheme-selectors-mapping.ts +12 -0
  34. package/src/core/parsers/thumb-data-parser.ts +15 -19
  35. package/src/core/rules/index.ts +15 -9
  36. package/src/userscripts/index.ts +1 -1
  37. package/src/userscripts/scripts/3hentai.ts +3 -4
  38. package/src/userscripts/scripts/camgirlfinder.ts +1 -1
  39. package/src/userscripts/scripts/camwhores.ts +5 -14
  40. package/src/userscripts/scripts/e-hentai.ts +12 -12
  41. package/src/userscripts/scripts/ebalka.ts +16 -8
  42. package/src/userscripts/scripts/eporner.ts +23 -39
  43. package/src/userscripts/scripts/erome.ts +13 -17
  44. package/src/userscripts/scripts/eroprofile.ts +4 -12
  45. package/src/userscripts/scripts/javhdporn.ts +7 -8
  46. package/src/userscripts/scripts/missav.ts +10 -4
  47. package/src/userscripts/scripts/motherless.ts +13 -7
  48. package/src/userscripts/scripts/namethatporn.ts +10 -17
  49. package/src/userscripts/scripts/nhentai.ts +6 -13
  50. package/src/userscripts/scripts/obmenvsem.ts +14 -4
  51. package/src/userscripts/scripts/pornhub.ts +13 -4
  52. package/src/userscripts/scripts/spankbang.ts +29 -5
  53. package/src/userscripts/scripts/thisvid.ts +16 -31
  54. package/src/userscripts/scripts/xhamster.ts +13 -18
  55. package/src/userscripts/scripts/xvideos.ts +32 -3
  56. package/src/utils/dom/dom-observers.ts +3 -3
  57. package/src/utils/dom/index.ts +1 -1
  58. package/src/utils/parsers/index.ts +5 -2
@@ -14,6 +14,43 @@ 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
+ const _DataFilterFn = class _DataFilterFn {
18
+ constructor(handle, deps = [], name, $preDefine) {
19
+ this.handle = handle;
20
+ this.deps = deps;
21
+ this.name = name;
22
+ this.$preDefine = $preDefine;
23
+ this.name = _DataFilterFn.setPrefix(name);
24
+ }
25
+ static setPrefix(name) {
26
+ return `${_DataFilterFn.prefix}${name}`;
27
+ }
28
+ static from(options, name) {
29
+ if (typeof options === "function") {
30
+ const deps = [name];
31
+ return new _DataFilterFn(options, deps, name);
32
+ }
33
+ return new _DataFilterFn(
34
+ options.handle,
35
+ options.deps,
36
+ name,
37
+ options.$preDefine
38
+ );
39
+ }
40
+ renderFn(state) {
41
+ const name = this.name;
42
+ return () => {
43
+ var _a3;
44
+ const preDefined = (_a3 = this.$preDefine) == null ? void 0 : _a3.call(this, state);
45
+ return (a2) => {
46
+ const condition = this.handle(a2, state, preDefined);
47
+ return { condition, name };
48
+ };
49
+ };
50
+ }
51
+ };
52
+ __publicField(_DataFilterFn, "prefix", "filter-");
53
+ let DataFilterFn = _DataFilterFn;
17
54
  function chunks(arr, size) {
18
55
  return Array.from(
19
56
  { length: Math.ceil(arr.length / size) },
@@ -84,10 +121,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
84
121
  }
85
122
  function waitForElementToAppear(parent, selector, callback) {
86
123
  const observer = new MutationObserver((_mutations) => {
87
- const el2 = parent.querySelector(selector);
88
- if (el2) {
124
+ const e = parent.querySelector(selector);
125
+ if (e) {
89
126
  observer.disconnect();
90
- callback(el2);
127
+ callback(e);
91
128
  }
92
129
  });
93
130
  observer.observe(document.body, { childList: true, subtree: true });
@@ -186,7 +223,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
186
223
  });
187
224
  }
188
225
  function getCommonParents(elements) {
189
- 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);
190
227
  return [...new Set(parents)];
191
228
  }
192
229
  function findNextSibling(e) {
@@ -400,9 +437,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
400
437
  function parseNumberWithLetter(str) {
401
438
  var _a3;
402
439
  const multipliers = { k: 1e3, m: 1e6 };
403
- const match = str.trim().match(/^([\d.]+)(\w)?$/);
440
+ const match = str.trim().match(/([\d., ]+)(\w)?/);
404
441
  if (!match) return 0;
405
- const num = parseFloat(match[1]);
442
+ const s1 = match[1].replace(/,/g, ".").replace(/[ ]/g, "");
443
+ const s2 = s1.split(".").filter(Boolean).length < 3 ? s1 : s1.replace(".", "");
444
+ const num = parseFloat(s2);
406
445
  const suffix = (_a3 = match[2]) == null ? void 0 : _a3.toLowerCase();
407
446
  if (suffix && suffix in multipliers) {
408
447
  return num * multipliers[suffix];
@@ -430,107 +469,92 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
430
469
  function parseCssUrl(s) {
431
470
  return s.replace(/url\("|"\).*/g, "");
432
471
  }
433
- const _DataFilter = class _DataFilter {
472
+ function createTextFilter(filterName, dataPropName, positive) {
473
+ const filterNameValue = `${filterName}Words`;
474
+ return {
475
+ handle(e, state, searchFilter) {
476
+ if (!Object.hasOwn(state, filterName) || !state[filterName]) return false;
477
+ return !(searchFilter == null ? void 0 : searchFilter(e[dataPropName]));
478
+ },
479
+ $preDefine: (state) => {
480
+ const r = new RegexFilter(state[filterNameValue]);
481
+ if (positive) return (s) => r.hasEvery(s);
482
+ return (s) => r.hasNone(s);
483
+ },
484
+ deps: [filterNameValue]
485
+ };
486
+ }
487
+ const filterDuration = {
488
+ handle(e, state, notInRange) {
489
+ if (!state.filterDuration) return false;
490
+ return !!(notInRange == null ? void 0 : notInRange(e.duration));
491
+ },
492
+ $preDefine: (state) => {
493
+ const from = state.filterDurationFrom;
494
+ const to2 = state.filterDurationTo;
495
+ function notInRange(d2) {
496
+ return d2 < from || d2 > to2;
497
+ }
498
+ return notInRange;
499
+ },
500
+ deps: ["filterDurationFrom", "filterDurationTo"]
501
+ };
502
+ const defaultDataFilterFns = {
503
+ filterDuration,
504
+ filterExclude: createTextFilter("filterExclude", "title", false),
505
+ filterInclude: createTextFilter("filterInclude", "title", true),
506
+ filterUploaderExclude: createTextFilter("filterUploaderExclude", "uploader", false),
507
+ filterUploaderInclude: createTextFilter("filterUploaderInclude", "uploader", true),
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
512
+ };
513
+ class DataFilter {
434
514
  constructor(rules) {
435
515
  __publicField(this, "filters", /* @__PURE__ */ new Map());
436
- __publicField(this, "customDataSelectorFns", {});
437
516
  __publicField(this, "filterMapping", {});
517
+ __publicField(this, "customDataFilterFns", {});
438
518
  this.rules = rules;
439
- this.registerFilters(rules.customDataSelectorFns);
440
- this.applyCSSFilters();
519
+ this.registerFilters(rules.customDataFilterFns);
520
+ this.createCssFilters();
441
521
  }
442
- static isFiltered(el2) {
443
- return el2.className.includes("filter-");
522
+ static isFiltered(e) {
523
+ return e.className.includes(DataFilterFn.prefix);
444
524
  }
445
- applyCSSFilters(wrapper) {
525
+ createCssFilters(wrapper) {
446
526
  this.filters.forEach((_2, name) => {
447
- const cssRule = `.filter-${name} { display: none !important; }`;
527
+ const className = DataFilterFn.setPrefix(name);
528
+ const cssRule = `.${className} { display: none !important; }`;
448
529
  client.GM_addStyle(wrapper ? wrapper(cssRule) : cssRule);
449
530
  });
450
531
  }
451
532
  registerFilters(customFilters) {
452
533
  customFilters.forEach((o) => {
453
- if (typeof o === "string") {
454
- this.customDataSelectorFns[o] = _DataFilter.customDataSelectorFnsDefault[o];
455
- this.registerFilter(o);
456
- } else {
457
- const k2 = Object.keys(o)[0];
458
- this.customDataSelectorFns[k2] = o[k2];
459
- this.registerFilter(k2);
460
- }
534
+ const isStr = typeof o === "string";
535
+ const k2 = isStr ? o : Object.keys(o)[0];
536
+ this.customDataFilterFns[k2] = isStr ? defaultDataFilterFns[o] : o[k2];
537
+ this.registerFilter(k2);
461
538
  });
462
539
  }
463
- customSelectorParser(name, selector) {
464
- if ("handle" in selector) {
465
- return selector;
466
- } else {
467
- return { handle: selector, deps: [name] };
468
- }
469
- }
470
540
  registerFilter(customSelectorName) {
471
- var _a3;
472
- const handler = this.customSelectorParser(
473
- customSelectorName,
474
- this.customDataSelectorFns[customSelectorName]
541
+ const dataFilterFn = DataFilterFn.from(
542
+ this.customDataFilterFns[customSelectorName],
543
+ customSelectorName
475
544
  );
476
- const tag = `filter-${customSelectorName}`;
477
- (_a3 = [customSelectorName, ...handler.deps || []]) == null ? void 0 : _a3.forEach((name) => {
545
+ dataFilterFn.deps.push(customSelectorName);
546
+ dataFilterFn.deps.forEach((name) => {
478
547
  Object.assign(this.filterMapping, { [name]: customSelectorName });
479
548
  });
480
- const fn2 = () => {
481
- var _a4;
482
- const preDefined = (_a4 = handler.$preDefine) == null ? void 0 : _a4.call(handler, this.rules.store.state);
483
- return (v2) => {
484
- const condition = handler.handle(v2, this.rules.store.state, preDefined);
485
- return {
486
- condition,
487
- tag
488
- };
489
- };
490
- };
491
- this.filters.set(customSelectorName, fn2);
549
+ this.filters.set(customSelectorName, dataFilterFn.renderFn(this.rules.store.state));
492
550
  }
493
551
  selectFilters(filters) {
494
552
  const selectedFilters = Object.keys(filters).filter((k2) => k2 in this.filterMapping).map((k2) => this.filterMapping[k2]).map((k2) => this.filters.get(k2));
495
553
  return selectedFilters;
496
554
  }
497
- };
498
- __publicField(_DataFilter, "customDataSelectorFnsDefault", {
499
- filterDuration: {
500
- handle(el2, state, notInRange) {
501
- if (!state.filterDuration) return false;
502
- return notInRange(el2.duration);
503
- },
504
- $preDefine: (state) => {
505
- const from = state.filterDurationFrom;
506
- const to2 = state.filterDurationTo;
507
- function notInRange(d2) {
508
- return d2 < from || d2 > to2;
509
- }
510
- return notInRange;
511
- },
512
- deps: ["filterDurationFrom", "filterDurationTo"]
513
- },
514
- filterExclude: {
515
- handle(el2, state, searchFilter) {
516
- if (!state.filterExclude) return false;
517
- return !searchFilter.hasNone(el2.title);
518
- },
519
- $preDefine: (state) => new RegexFilter(state.filterExcludeWords),
520
- deps: ["filterExcludeWords"]
521
- },
522
- filterInclude: {
523
- handle(el2, state, searchFilter) {
524
- if (!state.filterInclude) return false;
525
- return !searchFilter.hasEvery(el2.title);
526
- },
527
- $preDefine: (state) => new RegexFilter(state.filterIncludeWords),
528
- deps: ["filterIncludeWords"]
529
- }
530
- });
531
- let DataFilter = _DataFilter;
555
+ }
532
556
  class DataManager {
533
- constructor(rules, parentHomogenity) {
557
+ constructor(rules, containerHomogenity) {
534
558
  __publicField(this, "data", /* @__PURE__ */ new Map());
535
559
  __publicField(this, "lazyImgLoader", new LazyImgLoader(
536
560
  (target) => !DataFilter.isFiltered(target)
@@ -541,25 +565,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
541
565
  if (filtersToApply.length === 0) return;
542
566
  const iterator2 = this.data.values().drop(offset);
543
567
  let finished = false;
568
+ const updates = [];
544
569
  await new Promise((resolve) => {
545
570
  function runBatch(deadline) {
546
- const updates = [];
547
571
  while (deadline.timeRemaining() > 0) {
548
572
  const { value, done } = iterator2.next();
549
573
  finished = !!done;
550
574
  if (done) break;
551
575
  for (const f of filtersToApply) {
552
- const { tag, condition } = f()(value);
553
- updates.push({ e: value.element, tag, condition });
576
+ const { name, condition } = f()(value);
577
+ updates.push({ e: value.element, name, condition });
554
578
  }
555
579
  }
556
- if (updates.length > 0) {
557
- requestAnimationFrame(() => {
558
- updates.forEach((u) => {
559
- u.e.classList.toggle(u.tag, u.condition);
560
- });
561
- });
562
- }
563
580
  if (!finished) {
564
581
  requestIdleCallback(runBatch);
565
582
  } else {
@@ -568,7 +585,31 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
568
585
  }
569
586
  requestIdleCallback(runBatch);
570
587
  });
588
+ const parents = [...new Set(updates.map((u) => u.e.parentElement))].filter(
589
+ (_2) => _2 !== null
590
+ );
591
+ requestAnimationFrame(() => {
592
+ const revertDisplayStyle = parents.map((p) => {
593
+ const display = p.style.display;
594
+ p.style.display = "none";
595
+ this.layoutStylePaint(p);
596
+ p.style.willChange = "contents";
597
+ return () => {
598
+ p.style.display = display;
599
+ requestAnimationFrame(() => {
600
+ p.style.willChange = "auto";
601
+ });
602
+ };
603
+ });
604
+ updates.forEach((u) => {
605
+ u.e.classList.toggle(u.name, u.condition);
606
+ });
607
+ revertDisplayStyle.forEach((f) => {
608
+ f == null ? void 0 : f();
609
+ });
610
+ });
571
611
  });
612
+ __publicField(this, "layoutStylePaintEnabled", false);
572
613
  __publicField(this, "filterAll", async (offset) => {
573
614
  const keys = Array.from(this.dataFilter.filters.keys());
574
615
  const filters = Object.fromEntries(
@@ -581,13 +622,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
581
622
  const dataOffset = this.data.size;
582
623
  const fragment = document.createDocumentFragment();
583
624
  const parent = container || this.rules.container;
584
- const homogenity = !!this.parentHomogenity;
625
+ const homogenity = !!this.containerHomogenity;
585
626
  for (const thumbElement of thumbs) {
586
627
  const url = this.rules.thumbDataParser.getUrl(thumbElement);
587
628
  if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) || homogenity && !checkHomogenity(
588
629
  parent,
589
630
  thumbElement.parentElement,
590
- this.parentHomogenity
631
+ this.containerHomogenity
591
632
  )) {
592
633
  if (removeDuplicates) thumbElement.remove();
593
634
  continue;
@@ -601,27 +642,55 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
601
642
  fragment.append(thumbElement);
602
643
  }
603
644
  this.filterAll(dataOffset).then(() => {
645
+ if (!parent) return;
646
+ parent.style.willChange = "contents";
604
647
  requestAnimationFrame(() => {
605
- parent.appendChild(fragment);
648
+ parent == null ? void 0 : parent.appendChild(fragment);
649
+ requestAnimationFrame(() => {
650
+ parent.style.willChange = "auto";
651
+ });
606
652
  });
607
653
  });
608
654
  });
609
655
  this.rules = rules;
610
- this.parentHomogenity = parentHomogenity;
656
+ this.containerHomogenity = containerHomogenity;
611
657
  this.dataFilter = new DataFilter(this.rules);
612
658
  }
659
+ layoutStylePaint(e) {
660
+ if (!this.layoutStylePaintEnabled) return;
661
+ e.style.contain = "layout style paint";
662
+ }
613
663
  sortBy(key, direction = true) {
614
664
  if (this.data.size < 2) return;
615
- let sorted = this.data.values().toArray().sort((a2, b2) => {
616
- return a2[key] - b2[key];
665
+ const elements = this.data.values().toArray().filter((e) => e.element.parentElement !== null).map((e) => e);
666
+ const containers = new Set(elements.map((e) => e.element.parentElement));
667
+ containers.forEach((c) => {
668
+ this.layoutStylePaint(c);
669
+ c.style.willChange = "contents";
617
670
  });
618
- if (!direction) sorted = sorted.reverse();
619
- const container = sorted[0].element.parentElement;
620
- container.style.visibility = "hidden";
621
- sorted.forEach((s) => {
622
- container.append(s.element);
671
+ const elementsByContainers = /* @__PURE__ */ new Map();
672
+ containers.forEach((c) => {
673
+ elementsByContainers.set(c, []);
623
674
  });
624
- container.style.visibility = "visible";
675
+ elements.forEach((e) => {
676
+ const parent = e.element.parentElement;
677
+ const container = elementsByContainers.get(parent);
678
+ container == null ? void 0 : container.push(e);
679
+ });
680
+ const dir = direction ? -1 : 1;
681
+ for (const [container, items] of elementsByContainers) {
682
+ items.sort((a2, b2) => (a2[key] - b2[key]) * dir);
683
+ const domNodes = items.map((e) => e.element);
684
+ const display = container.style.display;
685
+ container.style.display = "none";
686
+ container.replaceChildren(...domNodes);
687
+ requestAnimationFrame(() => {
688
+ container.style.display = display;
689
+ requestAnimationFrame(() => {
690
+ container.style.willChange = "auto";
691
+ });
692
+ });
693
+ }
625
694
  }
626
695
  }
627
696
  var extendStatics = function(d2, b2) {
@@ -2999,7 +3068,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2999
3068
  return paginationStrategy;
3000
3069
  }
3001
3070
  class ThumbDataParser {
3002
- constructor(strategy = "manual", selectors = {}, callback, stringsMeltInTitle = true) {
3071
+ constructor(strategy = "manual", selectors = {}, callback) {
3003
3072
  __publicField(this, "thumbDataSelectors", []);
3004
3073
  __publicField(this, "defaultThumbDataSelectors", [
3005
3074
  { name: "title", type: "string", selector: "[class *= title],[title]" },
@@ -3009,17 +3078,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3009
3078
  selector: "[class *= uploader], [class *= user], [class *= name]"
3010
3079
  },
3011
3080
  { name: "duration", type: "duration", selector: "[class *= duration]" }
3081
+ // { name: 'views', type: 'float', selector: '[class *= view]' },
3012
3082
  ]);
3013
3083
  this.strategy = strategy;
3014
3084
  this.selectors = selectors;
3015
3085
  this.callback = callback;
3016
- this.stringsMeltInTitle = stringsMeltInTitle;
3017
3086
  this.preprocessCustomThumbDataSelectors();
3018
3087
  }
3019
3088
  autoParseText(thumb) {
3020
3089
  var _a3;
3021
- const title = sanitizeStr(thumb.innerText);
3022
- 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, "");
3023
3094
  return { title, duration };
3024
3095
  }
3025
3096
  getUrl(thumb) {
@@ -3059,7 +3130,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3059
3130
  return Number.parseInt(querySelectorText(thumb, selector));
3060
3131
  }
3061
3132
  static create(o = {}) {
3062
- return new ThumbDataParser(o.strategy, o.selectors, o.callback, o.stringsMeltInTitle);
3133
+ return new ThumbDataParser(o.strategy, o.selectors, o.callback);
3063
3134
  }
3064
3135
  getThumbData(thumb) {
3065
3136
  var _a3;
@@ -3067,19 +3138,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3067
3138
  return this.autoParseText(thumb);
3068
3139
  }
3069
3140
  if (this.strategy === "auto-select") {
3070
- this.thumbDataSelectors = this.defaultThumbDataSelectors;
3141
+ this.thumbDataSelectors.push(...this.defaultThumbDataSelectors);
3071
3142
  }
3072
3143
  const thumbData = Object.fromEntries(
3073
3144
  this.thumbDataSelectors.map((s) => [s.name, this.getThumbDataWith(thumb, s)])
3074
3145
  );
3075
- if (this.stringsMeltInTitle) {
3076
- Object.entries(thumbData).forEach(([k2, v2]) => {
3077
- if (typeof v2 === "string" && k2 !== "title") {
3078
- thumbData.title = `${thumbData.title} ${k2}:${v2}`;
3079
- delete thumbData[k2];
3080
- }
3081
- });
3082
- }
3083
3146
  (_a3 = this.callback) == null ? void 0 : _a3.call(this, thumb, thumbData);
3084
3147
  return thumbData;
3085
3148
  }
@@ -9609,7 +9672,7 @@ Expected function or array of functions, received type ${typeof t}.`
9609
9672
  }
9610
9673
  const DefaultScheme = [
9611
9674
  {
9612
- title: "Text Filter",
9675
+ title: "Title Filter",
9613
9676
  collapsed: true,
9614
9677
  content: [
9615
9678
  { filterExclude: false, label: "exclude" },
@@ -9628,6 +9691,26 @@ Expected function or array of functions, received type ${typeof t}.`
9628
9691
  }
9629
9692
  ]
9630
9693
  },
9694
+ {
9695
+ title: "Uploader Filter",
9696
+ collapsed: true,
9697
+ content: [
9698
+ { filterUploaderExclude: false, label: "exclude" },
9699
+ {
9700
+ filterUploaderExcludeWords: "",
9701
+ label: "keywords",
9702
+ watch: "filterUploaderExclude",
9703
+ placeholder: "word, f:full_word, r:RegEx..."
9704
+ },
9705
+ { filterUploaderInclude: false, label: "include" },
9706
+ {
9707
+ filterUploaderIncludeWords: "",
9708
+ label: "keywords",
9709
+ watch: "filterUploaderInclude",
9710
+ placeholder: "word, f:full_word, r:RegEx..."
9711
+ }
9712
+ ]
9713
+ },
9631
9714
  {
9632
9715
  title: "Duration Filter",
9633
9716
  collapsed: true,
@@ -9649,6 +9732,7 @@ Expected function or array of functions, received type ${typeof t}.`
9649
9732
  },
9650
9733
  {
9651
9734
  title: "Sort By",
9735
+ collapsed: true,
9652
9736
  content: [
9653
9737
  {
9654
9738
  "sort by views": () => {
@@ -9660,8 +9744,29 @@ Expected function or array of functions, received type ${typeof t}.`
9660
9744
  }
9661
9745
  ]
9662
9746
  },
9747
+ {
9748
+ title: "Sort By Duration",
9749
+ collapsed: true,
9750
+ content: [
9751
+ {
9752
+ "sort by duration": () => {
9753
+ }
9754
+ }
9755
+ ]
9756
+ },
9757
+ {
9758
+ title: "Sort By Views",
9759
+ collapsed: true,
9760
+ content: [
9761
+ {
9762
+ "sort by views": () => {
9763
+ }
9764
+ }
9765
+ ]
9766
+ },
9663
9767
  {
9664
9768
  title: "Privacy Filter",
9769
+ collapsed: true,
9665
9770
  content: [
9666
9771
  { filterPrivate: false, label: "private" },
9667
9772
  { filterPublic: false, label: "public" },
@@ -9669,6 +9774,13 @@ Expected function or array of functions, received type ${typeof t}.`
9669
9774
  } }
9670
9775
  ]
9671
9776
  },
9777
+ {
9778
+ title: "HD Filter",
9779
+ content: [
9780
+ { filterHD: false, label: "hd" },
9781
+ { filterNonHD: false, label: "non-hd" }
9782
+ ]
9783
+ },
9672
9784
  {
9673
9785
  title: "Advanced",
9674
9786
  collapsed: true,
@@ -9688,6 +9800,11 @@ Expected function or array of functions, received type ${typeof t}.`
9688
9800
  {
9689
9801
  writeHistory: false,
9690
9802
  label: "write history"
9803
+ },
9804
+ {
9805
+ reset: () => {
9806
+ localStorage.removeItem("state_acephale");
9807
+ }
9691
9808
  }
9692
9809
  ]
9693
9810
  },
@@ -9745,13 +9862,22 @@ Expected function or array of functions, received type ${typeof t}.`
9745
9862
  setupStoreListeners() {
9746
9863
  var _a3;
9747
9864
  (_a3 = this.directionalEventObservable$) == null ? void 0 : _a3.subscribe((e) => {
9748
- this.eventsMap[e.type](e.direction);
9865
+ var _a4, _b2;
9866
+ (_b2 = (_a4 = this.eventsMap)[e.type]) == null ? void 0 : _b2.call(_a4, e.direction);
9749
9867
  });
9750
9868
  this.store.stateSubject.pipe(takeUntil(this.destroy$)).subscribe((a2) => {
9751
9869
  this.dataManager.applyFilters(a2);
9752
9870
  });
9753
9871
  }
9754
9872
  }
9873
+ function getSelectorFnsFromScheme(xs2) {
9874
+ const keys = xs2.flatMap((s) => {
9875
+ const schemeBlock = DefaultScheme.find((e) => e.title === s);
9876
+ if (!schemeBlock) return [];
9877
+ return schemeBlock.content.flatMap((c) => Object.keys(c));
9878
+ });
9879
+ return keys.filter((k2) => k2 in defaultDataFilterFns);
9880
+ }
9755
9881
  class Rules {
9756
9882
  constructor(options) {
9757
9883
  __publicField(this, "thumb", {});
@@ -9766,12 +9892,8 @@ Expected function or array of functions, received type ${typeof t}.`
9766
9892
  __publicField(this, "paginationStrategyOptions", {});
9767
9893
  __publicField(this, "paginationStrategy");
9768
9894
  __publicField(this, "dataManager");
9769
- __publicField(this, "dataHomogenity");
9770
- __publicField(this, "customDataSelectorFns", [
9771
- "filterInclude",
9772
- "filterExclude",
9773
- "filterDuration"
9774
- ]);
9895
+ __publicField(this, "containerHomogenity");
9896
+ __publicField(this, "customDataFilterFns", []);
9775
9897
  __publicField(this, "animatePreview");
9776
9898
  __publicField(this, "storeOptions");
9777
9899
  __publicField(this, "schemeOptions", []);
@@ -9793,7 +9915,8 @@ Expected function or array of functions, received type ${typeof t}.`
9793
9915
  this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
9794
9916
  this.store = this.createStore();
9795
9917
  this.gui = this.createGui();
9796
- this.dataManager = new DataManager(this, this.dataHomogenity);
9918
+ this.hookDataFilterFns();
9919
+ this.dataManager = new DataManager(this, this.containerHomogenity);
9797
9920
  this.inputController = new JabronioGuiController(this.store, this.dataManager);
9798
9921
  this.reset();
9799
9922
  }
@@ -9812,6 +9935,12 @@ Expected function or array of functions, received type ${typeof t}.`
9812
9935
  get observable() {
9813
9936
  return this.intersectionObservable || this.paginationStrategy.getPaginationElement();
9814
9937
  }
9938
+ hookDataFilterFns() {
9939
+ const defaultFilterFns = getSelectorFnsFromScheme(
9940
+ this.schemeOptions.filter((s) => typeof s === "string")
9941
+ );
9942
+ this.customDataFilterFns.push(...defaultFilterFns);
9943
+ }
9815
9944
  createStore() {
9816
9945
  const config2 = { ...StoreStateDefault, ...this.storeOptions };
9817
9946
  this.store = new Up(config2);
@@ -9867,7 +9996,7 @@ Expected function or array of functions, received type ${typeof t}.`
9867
9996
  });
9868
9997
  this.mutationObservers = [];
9869
9998
  this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
9870
- this.dataManager = new DataManager(this, this.dataHomogenity);
9999
+ this.dataManager = new DataManager(this, this.containerHomogenity);
9871
10000
  this.inputController.dispose();
9872
10001
  this.inputController = new JabronioGuiController(this.store, this.dataManager);
9873
10002
  this.resetInfiniteScroller();