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.
- package/README.md +4 -4
- package/dist/core/pervertmonkey.core.es.d.ts +6 -4
- package/dist/core/pervertmonkey.core.es.js +20 -14
- package/dist/core/pervertmonkey.core.es.js.map +1 -1
- package/dist/core/pervertmonkey.core.umd.js +20 -14
- package/dist/core/pervertmonkey.core.umd.js.map +1 -1
- package/dist/userscripts/3hentai.user.js +2 -2
- package/dist/userscripts/camgirlfinder.user.js +2 -2
- package/dist/userscripts/camwhores.user.js +2 -2
- package/dist/userscripts/e-hentai.user.js +2 -2
- package/dist/userscripts/ebalka.user.js +2 -2
- package/dist/userscripts/eporner.user.js +2 -2
- package/dist/userscripts/erome.user.js +4 -6
- package/dist/userscripts/eroprofile.user.js +2 -2
- package/dist/userscripts/javhdporn.user.js +2 -2
- package/dist/userscripts/missav.user.js +2 -2
- package/dist/userscripts/motherless.user.js +2 -2
- package/dist/userscripts/namethatporn.user.js +2 -2
- package/dist/userscripts/nhentai.user.js +2 -2
- package/dist/userscripts/obmenvsem.user.js +2 -2
- package/dist/userscripts/pornhub.user.js +3 -3
- package/dist/userscripts/spankbang.user.js +2 -2
- package/dist/userscripts/thisvid.user.js +2 -2
- package/dist/userscripts/xhamster.user.js +2 -2
- package/dist/userscripts/xvideos.user.js +2 -2
- package/package.json +1 -1
- package/src/core/data-handler/data-manager.ts +16 -8
- package/src/core/parsers/thumb-data-parser.ts +1 -1
- package/src/core/rules/index.ts +6 -4
- package/src/userscripts/index.ts +1 -1
- package/src/userscripts/scripts/3hentai.ts +1 -1
- package/src/userscripts/scripts/camgirlfinder.ts +1 -1
- package/src/userscripts/scripts/camwhores.ts +1 -1
- package/src/userscripts/scripts/e-hentai.ts +1 -1
- package/src/userscripts/scripts/ebalka.ts +1 -1
- package/src/userscripts/scripts/eporner.ts +1 -1
- package/src/userscripts/scripts/erome.ts +2 -6
- package/src/userscripts/scripts/eroprofile.ts +1 -1
- package/src/userscripts/scripts/javhdporn.ts +1 -1
- package/src/userscripts/scripts/missav.ts +1 -1
- package/src/userscripts/scripts/motherless.ts +1 -1
- package/src/userscripts/scripts/namethatporn.ts +1 -1
- package/src/userscripts/scripts/nhentai.ts +1 -1
- package/src/userscripts/scripts/obmenvsem.ts +1 -1
- package/src/userscripts/scripts/pornhub.ts +3 -3
- package/src/userscripts/scripts/spankbang.ts +1 -1
- package/src/userscripts/scripts/thisvid.ts +1 -1
- package/src/userscripts/scripts/xhamster.ts +1 -1
- package/src/userscripts/scripts/xvideos.ts +1 -1
- package/src/utils/dom/index.ts +3 -5
package/README.md
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
## Userscripts
|
|
9
9
|
```shell
|
|
10
|
-
src/userscripts/scripts
|
|
11
|
-
dist/userscripts
|
|
10
|
+
src/userscripts/scripts # dev
|
|
11
|
+
dist/userscripts # build
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Build
|
|
15
15
|
```shell
|
|
16
|
-
npm run build
|
|
17
|
-
npm run build:
|
|
16
|
+
npm run build # build core
|
|
17
|
+
npm run build:u # build userscripts
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Dev
|
|
@@ -7,7 +7,7 @@ import { Subject } from 'rxjs';
|
|
|
7
7
|
|
|
8
8
|
declare type AnyFunction = (...args: any[]) => any;
|
|
9
9
|
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function areElementsAlike<T extends HTMLElement>(a: T, b: T, options: {
|
|
11
11
|
id?: boolean;
|
|
12
12
|
className?: boolean;
|
|
13
13
|
}): boolean;
|
|
@@ -69,10 +69,11 @@ export declare class DataManager {
|
|
|
69
69
|
data: Map<string, DataElement>;
|
|
70
70
|
private lazyImgLoader;
|
|
71
71
|
dataFilter: DataFilter;
|
|
72
|
-
constructor(rules: Rules, containerHomogenity?: Parameters<typeof
|
|
72
|
+
constructor(rules: Rules, containerHomogenity?: Parameters<typeof areElementsAlike>[2] | undefined);
|
|
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
|
|
|
@@ -407,12 +408,12 @@ export declare function removeClassesAndDataAttributes(element: HTMLElement, key
|
|
|
407
408
|
export declare function replaceElementTag(e: HTMLElement, tagName: string): HTMLElement;
|
|
408
409
|
|
|
409
410
|
export declare class Rules {
|
|
411
|
+
thumbs: Parameters<typeof ThumbsParser.create>[0];
|
|
412
|
+
thumbsParser: ThumbsParser;
|
|
410
413
|
thumb: Parameters<typeof ThumbDataParser.create>[0];
|
|
411
414
|
thumbDataParser: ThumbDataParser;
|
|
412
415
|
thumbImg: Parameters<typeof ThumbImgParser.create>[0];
|
|
413
416
|
thumbImgParser: ThumbImgParser;
|
|
414
|
-
thumbs: Parameters<typeof ThumbsParser.create>[0];
|
|
415
|
-
thumbsParser: ThumbsParser;
|
|
416
417
|
containerSelector: string | (() => HTMLElement);
|
|
417
418
|
containerSelectorLast?: string;
|
|
418
419
|
get container(): HTMLElement;
|
|
@@ -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;
|
|
@@ -237,11 +237,9 @@ function findNextSibling(e) {
|
|
|
237
237
|
if (e.parentElement) return findNextSibling(e.parentElement);
|
|
238
238
|
return null;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function areElementsAlike(a2, b2, options) {
|
|
241
241
|
if (!a2 || !b2) return false;
|
|
242
|
-
if (options.id)
|
|
243
|
-
if (a2.id !== b2.id) return false;
|
|
244
|
-
}
|
|
242
|
+
if (options.id && a2.id !== b2.id) return false;
|
|
245
243
|
if (options.className) {
|
|
246
244
|
const ca2 = a2.className;
|
|
247
245
|
const cb = b2.className;
|
|
@@ -628,7 +626,7 @@ class DataManager {
|
|
|
628
626
|
f();
|
|
629
627
|
} else {
|
|
630
628
|
requestAnimationFrame(() => {
|
|
631
|
-
|
|
629
|
+
this.optimize(parent, f);
|
|
632
630
|
});
|
|
633
631
|
}
|
|
634
632
|
});
|
|
@@ -648,12 +646,12 @@ class DataManager {
|
|
|
648
646
|
const homogenity = !!this.containerHomogenity;
|
|
649
647
|
for (const thumbElement of thumbs) {
|
|
650
648
|
const url = this.rules.thumbDataParser.getUrl(thumbElement);
|
|
651
|
-
const
|
|
649
|
+
const isNotHomogenic = homogenity && !areElementsAlike(
|
|
652
650
|
parent,
|
|
653
651
|
thumbElement.parentElement,
|
|
654
652
|
this.containerHomogenity
|
|
655
653
|
);
|
|
656
|
-
if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) ||
|
|
654
|
+
if (!url || this.data.has(url) || parent !== container && (parent == null ? void 0 : parent.contains(thumbElement)) || isNotHomogenic) {
|
|
657
655
|
if (removeDuplicates) thumbElement.remove();
|
|
658
656
|
continue;
|
|
659
657
|
}
|
|
@@ -667,7 +665,14 @@ class DataManager {
|
|
|
667
665
|
}
|
|
668
666
|
await this.filterAll(dataOffset);
|
|
669
667
|
if (!parent) return;
|
|
670
|
-
|
|
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
|
+
}
|
|
671
676
|
}
|
|
672
677
|
sortBy(key, direction = true) {
|
|
673
678
|
if (this.data.size < 2) return;
|
|
@@ -677,7 +682,7 @@ class DataManager {
|
|
|
677
682
|
for (const [container, items] of byContainers) {
|
|
678
683
|
items.sort((a2, b2) => (a2[key] - b2[key]) * dir);
|
|
679
684
|
const children = items.map((e) => e.element);
|
|
680
|
-
|
|
685
|
+
this.optimize(container, () => container.replaceChildren(...children));
|
|
681
686
|
}
|
|
682
687
|
}
|
|
683
688
|
}
|
|
@@ -3078,7 +3083,7 @@ class ThumbDataParser {
|
|
|
3078
3083
|
return { title, duration };
|
|
3079
3084
|
}
|
|
3080
3085
|
getUrl(thumb) {
|
|
3081
|
-
return (thumb
|
|
3086
|
+
return querySelectorOrSelf(thumb, "a[href]").href;
|
|
3082
3087
|
}
|
|
3083
3088
|
preprocessCustomThumbDataSelectors() {
|
|
3084
3089
|
if (!this.selectors) return;
|
|
@@ -9861,12 +9866,12 @@ function getSelectorFnsFromScheme(xs2) {
|
|
|
9861
9866
|
}
|
|
9862
9867
|
class Rules {
|
|
9863
9868
|
constructor(options) {
|
|
9869
|
+
__publicField(this, "thumbs", {});
|
|
9870
|
+
__publicField(this, "thumbsParser");
|
|
9864
9871
|
__publicField(this, "thumb", {});
|
|
9865
9872
|
__publicField(this, "thumbDataParser");
|
|
9866
9873
|
__publicField(this, "thumbImg", {});
|
|
9867
9874
|
__publicField(this, "thumbImgParser");
|
|
9868
|
-
__publicField(this, "thumbs", {});
|
|
9869
|
-
__publicField(this, "thumbsParser");
|
|
9870
9875
|
__publicField(this, "containerSelector", ".container");
|
|
9871
9876
|
__publicField(this, "containerSelectorLast");
|
|
9872
9877
|
__publicField(this, "intersectionObservableSelector");
|
|
@@ -9885,14 +9890,15 @@ class Rules {
|
|
|
9885
9890
|
__publicField(this, "infiniteScroller");
|
|
9886
9891
|
__publicField(this, "getPaginationData");
|
|
9887
9892
|
__publicField(this, "gropeStrategy", "all-in-one");
|
|
9893
|
+
__publicField(this, "containMutationEnabled", true);
|
|
9888
9894
|
__publicField(this, "mutationObservers", []);
|
|
9889
9895
|
__publicField(this, "resetOnPaginationOrContainerDeath", true);
|
|
9890
9896
|
__publicField(this, "onResetCallback");
|
|
9891
9897
|
if (this.isEmbedded) throw Error("Embedded is not supported");
|
|
9892
9898
|
Object.assign(this, options);
|
|
9899
|
+
this.thumbsParser = ThumbsParser.create(this.thumbs);
|
|
9893
9900
|
this.thumbDataParser = ThumbDataParser.create(this.thumb);
|
|
9894
9901
|
this.thumbImgParser = ThumbImgParser.create(this.thumbImg);
|
|
9895
|
-
this.thumbsParser = ThumbsParser.create(this.thumbs);
|
|
9896
9902
|
this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
|
|
9897
9903
|
this.store = this.createStore();
|
|
9898
9904
|
this.gui = this.createGui();
|
|
@@ -10006,7 +10012,7 @@ export {
|
|
|
10006
10012
|
ThumbImgParser,
|
|
10007
10013
|
ThumbsParser,
|
|
10008
10014
|
Tick,
|
|
10009
|
-
|
|
10015
|
+
areElementsAlike,
|
|
10010
10016
|
chunks,
|
|
10011
10017
|
circularShift,
|
|
10012
10018
|
containMutation,
|