pervert-monkey 1.0.18 → 1.0.19
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/dist/core/pervertmonkey.core.es.d.ts +8 -11
- package/dist/core/pervertmonkey.core.es.js +31 -35
- package/dist/core/pervertmonkey.core.es.js.map +1 -1
- package/dist/core/pervertmonkey.core.umd.js +31 -35
- package/dist/core/pervertmonkey.core.umd.js.map +1 -1
- package/dist/test/test.user.js +10301 -0
- 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 +2 -2
- 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 +3 -3
- package/dist/userscripts/pornhub.user.js +2 -2
- package/dist/userscripts/spankbang.user.js +2 -2
- package/dist/userscripts/thisvid.user.js +33 -27
- package/dist/userscripts/xhamster.user.js +3 -3
- package/dist/userscripts/xvideos.user.js +3 -3
- package/package.json +4 -4
- package/src/core/data-handler/data-filter.ts +4 -4
- package/src/core/infinite-scroll/index.ts +2 -9
- package/src/core/parsers/thumb-data-parser.ts +4 -3
- package/src/core/parsers/thumbs-parser.ts +9 -10
- package/src/core/rules/index.ts +6 -7
- 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 +1 -1
- 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 -2
- package/src/userscripts/scripts/obmenvsem.ts +2 -2
- package/src/userscripts/scripts/pornhub.ts +1 -1
- package/src/userscripts/scripts/spankbang.ts +1 -1
- package/src/userscripts/scripts/thisvid.ts +43 -35
- package/src/userscripts/scripts/xhamster.ts +2 -2
- package/src/userscripts/scripts/xvideos.ts +2 -2
- package/src/utils/dom/index.ts +14 -10
- package/src/utils/parsers/index.ts +1 -1
|
@@ -28,7 +28,7 @@ export declare type DataElement = {
|
|
|
28
28
|
export declare class DataFilter {
|
|
29
29
|
private rules;
|
|
30
30
|
filters: Map<string, () => DataFilterFnRendered>;
|
|
31
|
-
|
|
31
|
+
filterDepsMapping: Record<string, string>;
|
|
32
32
|
constructor(rules: Rules);
|
|
33
33
|
static isFiltered(e: HTMLElement): boolean;
|
|
34
34
|
createCssFilters(wrapper?: (cssRule: string) => string): void;
|
|
@@ -223,8 +223,6 @@ export declare function fetchWith<T extends JSON | string | HTMLElement>(input:
|
|
|
223
223
|
|
|
224
224
|
export declare function findNextSibling<T extends Element = HTMLElement>(e: T): Element | null;
|
|
225
225
|
|
|
226
|
-
export declare function findSelfOrChild<T extends HTMLElement>(element: T, selector: string): T | null;
|
|
227
|
-
|
|
228
226
|
/**
|
|
229
227
|
* Converts a duration string (e.g., "1h 22min 3sec") to HH:MM:SS format.
|
|
230
228
|
* @param timeStr - The duration string to format.
|
|
@@ -237,12 +235,11 @@ declare type GeneratorResult = {
|
|
|
237
235
|
offset: number;
|
|
238
236
|
};
|
|
239
237
|
|
|
240
|
-
export declare function getCommonParents(elements:
|
|
238
|
+
export declare function getCommonParents<T extends HTMLElement>(elements: Iterable<T>): HTMLElement[];
|
|
241
239
|
|
|
242
240
|
export declare function getPaginationStrategy(options: Partial<PaginationStrategy>): PaginationStrategy;
|
|
243
241
|
|
|
244
242
|
export declare class InfiniteScroller {
|
|
245
|
-
enabled: boolean;
|
|
246
243
|
paginationOffset: number;
|
|
247
244
|
rules: Rules;
|
|
248
245
|
private observer?;
|
|
@@ -381,7 +378,7 @@ export declare function parseHtml(html: string): HTMLElement;
|
|
|
381
378
|
|
|
382
379
|
export declare function parseIntegerOr(n: string | number, or: number): number;
|
|
383
380
|
|
|
384
|
-
export declare function
|
|
381
|
+
export declare function parseNumericAbbreviation(str: string): number;
|
|
385
382
|
|
|
386
383
|
export declare function parseUrl(s: HTMLAnchorElement | Location | URL | string): URL;
|
|
387
384
|
|
|
@@ -391,6 +388,8 @@ export declare function querySelectorLast<T extends Element = HTMLElement>(root:
|
|
|
391
388
|
|
|
392
389
|
export declare function querySelectorLastNumber(selector: string, e?: ParentNode): number;
|
|
393
390
|
|
|
391
|
+
export declare function querySelectorOrSelf<T extends Element = HTMLElement>(element: T, selector: string): T | null;
|
|
392
|
+
|
|
394
393
|
export declare function querySelectorText(e: ParentNode, selector?: string): string;
|
|
395
394
|
|
|
396
395
|
export declare function range(size: number, start?: number, step?: number): number[];
|
|
@@ -418,7 +417,7 @@ export declare class Rules {
|
|
|
418
417
|
containerSelectorLast?: string;
|
|
419
418
|
get container(): HTMLElement;
|
|
420
419
|
intersectionObservableSelector?: string;
|
|
421
|
-
get intersectionObservable():
|
|
420
|
+
get intersectionObservable(): HTMLElement | null | undefined;
|
|
422
421
|
get observable(): HTMLElement;
|
|
423
422
|
paginationStrategyOptions: Partial<PaginationStrategy>;
|
|
424
423
|
paginationStrategy: PaginationStrategy;
|
|
@@ -501,13 +500,11 @@ export declare class ThumbImgParser {
|
|
|
501
500
|
}
|
|
502
501
|
|
|
503
502
|
export declare class ThumbsParser {
|
|
504
|
-
containerSelector: string;
|
|
505
503
|
selector: string;
|
|
506
504
|
strategy: 'default' | 'auto';
|
|
507
505
|
transform?: (thumb: HTMLElement) => void;
|
|
508
|
-
static create(options
|
|
509
|
-
|
|
510
|
-
getThumbs(html: HTMLElement): HTMLElement[];
|
|
506
|
+
static create(options?: Partial<Pick<ThumbsParser, 'selector' | 'strategy' | 'transform'>>): ThumbsParser & Partial<Pick<ThumbsParser, "selector" | "strategy" | "transform">>;
|
|
507
|
+
getThumbs(container: HTMLElement): HTMLElement[];
|
|
511
508
|
}
|
|
512
509
|
|
|
513
510
|
export declare class Tick {
|
|
@@ -172,15 +172,19 @@ function watchDomChangesWithThrottle(element, callback, throttle = 1e3, times =
|
|
|
172
172
|
observer.observe(element, options);
|
|
173
173
|
return observer;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
175
|
+
function querySelectorOrSelf(element, selector) {
|
|
176
|
+
var _a3;
|
|
177
|
+
if ((_a3 = element.matches) == null ? void 0 : _a3.call(element, selector)) {
|
|
177
178
|
return element;
|
|
178
179
|
}
|
|
179
180
|
return element.querySelector(selector);
|
|
180
181
|
}
|
|
181
182
|
function querySelectorLast(root = document, selector) {
|
|
182
183
|
const nodes = root.querySelectorAll(selector);
|
|
183
|
-
|
|
184
|
+
if (nodes.length < 1) {
|
|
185
|
+
return querySelectorOrSelf(root, selector) || void 0;
|
|
186
|
+
}
|
|
187
|
+
return nodes[nodes.length - 1];
|
|
184
188
|
}
|
|
185
189
|
function querySelectorLastNumber(selector, e = document) {
|
|
186
190
|
var _a3;
|
|
@@ -190,7 +194,7 @@ function querySelectorLastNumber(selector, e = document) {
|
|
|
190
194
|
function querySelectorText(e, selector) {
|
|
191
195
|
var _a3;
|
|
192
196
|
if (typeof selector !== "string") return "";
|
|
193
|
-
const text = ((_a3 = e
|
|
197
|
+
const text = ((_a3 = querySelectorOrSelf(e, selector)) == null ? void 0 : _a3.innerText) || "";
|
|
194
198
|
return sanitizeStr(text);
|
|
195
199
|
}
|
|
196
200
|
function parseHtml(html) {
|
|
@@ -226,8 +230,7 @@ function removeClassesAndDataAttributes(element, keyword) {
|
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
function getCommonParents(elements) {
|
|
229
|
-
|
|
230
|
-
return [...new Set(parents)];
|
|
233
|
+
return Map.groupBy(elements, (e) => e.parentElement).keys().filter((e) => e !== null).toArray();
|
|
231
234
|
}
|
|
232
235
|
function findNextSibling(e) {
|
|
233
236
|
if (e.nextElementSibling) return e.nextElementSibling;
|
|
@@ -437,7 +440,7 @@ function parseIntegerOr(n, or2) {
|
|
|
437
440
|
const num = Number(n);
|
|
438
441
|
return Number.isSafeInteger(num) ? num : or2;
|
|
439
442
|
}
|
|
440
|
-
function
|
|
443
|
+
function parseNumericAbbreviation(str) {
|
|
441
444
|
var _a3;
|
|
442
445
|
const multipliers = { k: 1e3, m: 1e6 };
|
|
443
446
|
const match = str.trim().match(/([\d., ]+)(\w)?/);
|
|
@@ -552,7 +555,7 @@ const defaultDataFilterFns = {
|
|
|
552
555
|
class DataFilter {
|
|
553
556
|
constructor(rules) {
|
|
554
557
|
__publicField(this, "filters", /* @__PURE__ */ new Map());
|
|
555
|
-
__publicField(this, "
|
|
558
|
+
__publicField(this, "filterDepsMapping", {});
|
|
556
559
|
__publicField(this, "customDataFilterFns", {});
|
|
557
560
|
this.rules = rules;
|
|
558
561
|
this.registerFilters(rules.customDataFilterFns);
|
|
@@ -583,12 +586,12 @@ class DataFilter {
|
|
|
583
586
|
);
|
|
584
587
|
dataFilterFn.deps.push(customSelectorName);
|
|
585
588
|
dataFilterFn.deps.forEach((name) => {
|
|
586
|
-
Object.assign(this.
|
|
589
|
+
Object.assign(this.filterDepsMapping, { [name]: customSelectorName });
|
|
587
590
|
});
|
|
588
591
|
this.filters.set(customSelectorName, dataFilterFn.renderFn(this.rules.store.state));
|
|
589
592
|
}
|
|
590
593
|
selectFilters(filters) {
|
|
591
|
-
const selectedFilters = Object.keys(filters).filter((k2) => k2 in this.
|
|
594
|
+
const selectedFilters = Object.keys(filters).filter((k2) => k2 in this.filterDepsMapping).map((k2) => this.filterDepsMapping[k2]).map((k2) => this.filters.get(k2));
|
|
592
595
|
return selectedFilters;
|
|
593
596
|
}
|
|
594
597
|
}
|
|
@@ -1954,14 +1957,13 @@ function takeUntil(notifier) {
|
|
|
1954
1957
|
}
|
|
1955
1958
|
class InfiniteScroller {
|
|
1956
1959
|
constructor(options) {
|
|
1957
|
-
__publicField(this, "enabled", true);
|
|
1958
1960
|
__publicField(this, "paginationOffset", 1);
|
|
1959
1961
|
__publicField(this, "rules");
|
|
1960
1962
|
__publicField(this, "observer");
|
|
1961
1963
|
__publicField(this, "paginationGenerator");
|
|
1962
1964
|
__publicField(this, "subject", new Subject());
|
|
1963
1965
|
__publicField(this, "generatorConsumer", async () => {
|
|
1964
|
-
if (!this.
|
|
1966
|
+
if (!this.rules.store.state.infiniteScrollEnabled) return true;
|
|
1965
1967
|
const { value, done } = await this.paginationGenerator.next();
|
|
1966
1968
|
if (done) return false;
|
|
1967
1969
|
const { url, offset } = value;
|
|
@@ -2027,9 +2029,8 @@ class InfiniteScroller {
|
|
|
2027
2029
|
}
|
|
2028
2030
|
}
|
|
2029
2031
|
static create(rules) {
|
|
2030
|
-
const enabled = rules.store.state.infiniteScrollEnabled;
|
|
2031
2032
|
rules.store.state.$paginationLast = rules.paginationStrategy.getPaginationLast();
|
|
2032
|
-
const infiniteScroller = new InfiniteScroller({
|
|
2033
|
+
const infiniteScroller = new InfiniteScroller({ rules });
|
|
2033
2034
|
rules.store.state.$paginationOffset = infiniteScroller.paginationOffset;
|
|
2034
2035
|
infiniteScroller.subject.subscribe((x2) => {
|
|
2035
2036
|
if (x2.type === "scroll") {
|
|
@@ -2040,9 +2041,6 @@ class InfiniteScroller {
|
|
|
2040
2041
|
});
|
|
2041
2042
|
}
|
|
2042
2043
|
});
|
|
2043
|
-
rules.store.stateSubject.subscribe(() => {
|
|
2044
|
-
infiniteScroller.enabled = rules.store.state.infiniteScrollEnabled;
|
|
2045
|
-
});
|
|
2046
2044
|
return infiniteScroller;
|
|
2047
2045
|
}
|
|
2048
2046
|
}
|
|
@@ -3101,7 +3099,7 @@ class ThumbDataParser {
|
|
|
3101
3099
|
getThumbDataWith(thumb, { type, selector }) {
|
|
3102
3100
|
var _a3;
|
|
3103
3101
|
if (type === "boolean") {
|
|
3104
|
-
return !!thumb
|
|
3102
|
+
return !!querySelectorOrSelf(thumb, selector);
|
|
3105
3103
|
}
|
|
3106
3104
|
if (type === "string") {
|
|
3107
3105
|
return sanitizeStr(((_a3 = querySelectorLast(thumb, selector)) == null ? void 0 : _a3.innerText) || "");
|
|
@@ -3111,7 +3109,7 @@ class ThumbDataParser {
|
|
|
3111
3109
|
}
|
|
3112
3110
|
if (type === "float") {
|
|
3113
3111
|
const value = querySelectorText(thumb, selector);
|
|
3114
|
-
return
|
|
3112
|
+
return parseNumericAbbreviation(value);
|
|
3115
3113
|
}
|
|
3116
3114
|
return Number.parseInt(querySelectorText(thumb, selector));
|
|
3117
3115
|
}
|
|
@@ -3180,24 +3178,21 @@ class ThumbImgParser {
|
|
|
3180
3178
|
}
|
|
3181
3179
|
}
|
|
3182
3180
|
class ThumbsParser {
|
|
3183
|
-
constructor(
|
|
3181
|
+
constructor() {
|
|
3184
3182
|
__publicField(this, "selector", ".thumb");
|
|
3185
3183
|
__publicField(this, "strategy", "default");
|
|
3186
3184
|
__publicField(this, "transform");
|
|
3187
|
-
this.containerSelector = containerSelector;
|
|
3188
3185
|
}
|
|
3189
|
-
static create(options = {}
|
|
3190
|
-
return Object.assign(new ThumbsParser(
|
|
3186
|
+
static create(options = {}) {
|
|
3187
|
+
return Object.assign(new ThumbsParser(), options);
|
|
3191
3188
|
}
|
|
3192
|
-
getThumbs(
|
|
3193
|
-
if (!
|
|
3194
|
-
let thumbs;
|
|
3189
|
+
getThumbs(container) {
|
|
3190
|
+
if (!container) return [];
|
|
3195
3191
|
if (this.strategy === "auto") {
|
|
3196
3192
|
if (typeof this.selector !== "string") return [];
|
|
3197
|
-
|
|
3198
|
-
thumbs = [...(container == null ? void 0 : container.children) || []];
|
|
3193
|
+
return [...(container == null ? void 0 : container.children) || []];
|
|
3199
3194
|
}
|
|
3200
|
-
thumbs = Array.from(
|
|
3195
|
+
const thumbs = Array.from(container.querySelectorAll(this.selector));
|
|
3201
3196
|
if (typeof this.transform === "function") {
|
|
3202
3197
|
thumbs.forEach(this.transform);
|
|
3203
3198
|
}
|
|
@@ -9897,7 +9892,7 @@ class Rules {
|
|
|
9897
9892
|
Object.assign(this, options);
|
|
9898
9893
|
this.thumbDataParser = ThumbDataParser.create(this.thumb);
|
|
9899
9894
|
this.thumbImgParser = ThumbImgParser.create(this.thumbImg);
|
|
9900
|
-
this.thumbsParser = ThumbsParser.create(this.thumbs
|
|
9895
|
+
this.thumbsParser = ThumbsParser.create(this.thumbs);
|
|
9901
9896
|
this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
|
|
9902
9897
|
this.store = this.createStore();
|
|
9903
9898
|
this.gui = this.createGui();
|
|
@@ -9908,15 +9903,16 @@ class Rules {
|
|
|
9908
9903
|
}
|
|
9909
9904
|
get container() {
|
|
9910
9905
|
if (typeof this.containerSelectorLast === "string") {
|
|
9911
|
-
return querySelectorLast(document, this.containerSelectorLast);
|
|
9906
|
+
return querySelectorLast(document.body, this.containerSelectorLast);
|
|
9912
9907
|
}
|
|
9913
9908
|
if (typeof this.containerSelector === "string") {
|
|
9914
|
-
return document.
|
|
9909
|
+
return querySelectorOrSelf(document.body, this.containerSelector);
|
|
9915
9910
|
}
|
|
9916
9911
|
return this.containerSelector();
|
|
9917
9912
|
}
|
|
9918
9913
|
get intersectionObservable() {
|
|
9919
|
-
|
|
9914
|
+
if (!this.intersectionObservableSelector) return void 0;
|
|
9915
|
+
return document.querySelector(this.intersectionObservableSelector);
|
|
9920
9916
|
}
|
|
9921
9917
|
get observable() {
|
|
9922
9918
|
return this.intersectionObservable || this.paginationStrategy.getPaginationElement();
|
|
@@ -10022,7 +10018,6 @@ export {
|
|
|
10022
10018
|
fetchText,
|
|
10023
10019
|
fetchWith,
|
|
10024
10020
|
findNextSibling,
|
|
10025
|
-
findSelfOrChild,
|
|
10026
10021
|
formatTimeToHHMMSS,
|
|
10027
10022
|
getCommonParents,
|
|
10028
10023
|
getPaginationStrategy,
|
|
@@ -10034,10 +10029,11 @@ export {
|
|
|
10034
10029
|
parseDataParams,
|
|
10035
10030
|
parseHtml,
|
|
10036
10031
|
parseIntegerOr,
|
|
10037
|
-
|
|
10032
|
+
parseNumericAbbreviation,
|
|
10038
10033
|
parseUrl,
|
|
10039
10034
|
querySelectorLast,
|
|
10040
10035
|
querySelectorLastNumber,
|
|
10036
|
+
querySelectorOrSelf,
|
|
10041
10037
|
querySelectorText,
|
|
10042
10038
|
range,
|
|
10043
10039
|
removeClassesAndDataAttributes,
|