pervert-monkey 1.0.10 → 1.0.11
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 +9 -4
- package/dist/core/pervertmonkey.core.es.js +58 -59
- package/dist/core/pervertmonkey.core.es.js.map +1 -1
- package/dist/core/pervertmonkey.core.umd.js +58 -59
- package/dist/core/pervertmonkey.core.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/core/infinite-scroll/index.ts +9 -9
- package/src/core/parsers/thumb-data-parser.ts +32 -13
- package/src/core/parsers/thumb-img-parser.ts +49 -46
- package/src/userscripts/index.ts +1 -1
- package/src/userscripts/scripts/3hentai.ts +1 -1
- package/src/userscripts/scripts/camwhores.ts +0 -1
- package/src/userscripts/scripts/e-hentai.ts +0 -1
- package/src/userscripts/scripts/eporner.ts +2 -2
- package/src/userscripts/scripts/motherless.ts +2 -2
- package/src/userscripts/scripts/namethatporn.ts +6 -5
- package/src/userscripts/scripts/nhentai.ts +1 -1
- package/src/userscripts/scripts/obmenvsem.ts +18 -3
- package/src/userscripts/scripts/pornhub.ts +9 -13
- package/src/userscripts/scripts/spankbang.ts +1 -37
- package/src/userscripts/scripts/thisvid.ts +8 -7
- package/src/userscripts/scripts/xhamster.ts +12 -12
- package/src/userscripts/scripts/xvideos.ts +2 -2
- package/src/utils/observers/index.ts +8 -4
- package/src/utils/parsers/time-parser.ts +2 -2
|
@@ -417,12 +417,17 @@ declare type ThumbDataSelectorsRaw = Record<string, string | Pick<ThumbDataSelec
|
|
|
417
417
|
|
|
418
418
|
export declare class ThumbImgParser {
|
|
419
419
|
selector?: string | string[] | ((img: HTMLImageElement) => string);
|
|
420
|
-
|
|
420
|
+
remove?: 'auto' | string;
|
|
421
421
|
strategy: 'default' | 'auto';
|
|
422
|
-
static create(options?: Partial<Pick<ThumbImgParser, 'selector' | '
|
|
422
|
+
static create(options?: Partial<Pick<ThumbImgParser, 'selector' | 'remove' | 'strategy' | 'getImgData'>>): ThumbImgParser & Partial<Pick<ThumbImgParser, "selector" | "strategy" | "remove" | "getImgData">>;
|
|
423
|
+
private removeAttrs;
|
|
424
|
+
private getImgSrc;
|
|
423
425
|
getImgData(thumb: HTMLElement): {
|
|
424
|
-
img?:
|
|
425
|
-
imgSrc?:
|
|
426
|
+
img?: undefined;
|
|
427
|
+
imgSrc?: undefined;
|
|
428
|
+
} | {
|
|
429
|
+
img: HTMLImageElement;
|
|
430
|
+
imgSrc: string;
|
|
426
431
|
};
|
|
427
432
|
}
|
|
428
433
|
|
|
@@ -372,20 +372,24 @@ class Observer {
|
|
|
372
372
|
this.observer.disconnect();
|
|
373
373
|
}
|
|
374
374
|
static observeWhile(target, callback, throttleTime) {
|
|
375
|
-
const
|
|
375
|
+
const observer = new Observer(async (target2) => {
|
|
376
376
|
const condition = await callback();
|
|
377
|
-
if (condition)
|
|
377
|
+
if (condition) {
|
|
378
|
+
observer.throttle(target2, throttleTime);
|
|
379
|
+
} else {
|
|
380
|
+
observer.dispose();
|
|
381
|
+
}
|
|
378
382
|
});
|
|
379
|
-
|
|
380
|
-
return
|
|
383
|
+
observer.observe(target);
|
|
384
|
+
return observer;
|
|
381
385
|
}
|
|
382
386
|
}
|
|
383
387
|
function formatTimeToHHMMSS(timeStr) {
|
|
384
388
|
var _a3, _b2, _c2;
|
|
385
389
|
const pad = (num) => num.toString().padStart(2, "0");
|
|
386
390
|
const h = ((_a3 = timeStr.match(/(\d+)\s*h/)) == null ? void 0 : _a3[1]) || "0";
|
|
387
|
-
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n
|
|
388
|
-
const s = ((_c2 = timeStr.match(/(\d+)\s*
|
|
391
|
+
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n?/)) == null ? void 0 : _b2[1]) || "0";
|
|
392
|
+
const s = ((_c2 = timeStr.match(/(\d+)\s*se?c?/)) == null ? void 0 : _c2[1]) || "0";
|
|
389
393
|
return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
|
|
390
394
|
}
|
|
391
395
|
function timeToSeconds(timeStr) {
|
|
@@ -435,11 +439,7 @@ const _DataFilter = class _DataFilter {
|
|
|
435
439
|
applyCSSFilters(wrapper) {
|
|
436
440
|
this.filters.forEach((_2, name) => {
|
|
437
441
|
const cssRule = `.filter-${name} { display: none !important; }`;
|
|
438
|
-
|
|
439
|
-
GM_addStyle(wrapper(cssRule));
|
|
440
|
-
} else {
|
|
441
|
-
GM_addStyle(cssRule);
|
|
442
|
-
}
|
|
442
|
+
GM_addStyle(wrapper ? wrapper(cssRule) : cssRule);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
registerFilters(customFilters) {
|
|
@@ -1282,14 +1282,11 @@ class InfiniteScroller {
|
|
|
1282
1282
|
__publicField(this, "subject", new Subject());
|
|
1283
1283
|
__publicField(this, "generatorConsumer", async () => {
|
|
1284
1284
|
if (!this.enabled) return false;
|
|
1285
|
-
const {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
await this.doScroll(url, offset);
|
|
1291
|
-
}
|
|
1292
|
-
return !done;
|
|
1285
|
+
const { value, done } = await this.paginationGenerator.next();
|
|
1286
|
+
if (done) return false;
|
|
1287
|
+
const { url, offset } = value;
|
|
1288
|
+
await this.doScroll(url, offset);
|
|
1289
|
+
return true;
|
|
1293
1290
|
});
|
|
1294
1291
|
this.rules = options.rules;
|
|
1295
1292
|
this.paginationOffset = this.rules.paginationStrategy.getPaginationOffset();
|
|
@@ -1317,7 +1314,8 @@ class InfiniteScroller {
|
|
|
1317
1314
|
const autoScrollWrapper = async () => {
|
|
1318
1315
|
if (this.rules.store.state.autoScroll) {
|
|
1319
1316
|
await wait(this.rules.store.state.delay);
|
|
1320
|
-
await this.generatorConsumer();
|
|
1317
|
+
const res = await this.generatorConsumer();
|
|
1318
|
+
if (!res) return;
|
|
1321
1319
|
await autoScrollWrapper();
|
|
1322
1320
|
}
|
|
1323
1321
|
};
|
|
@@ -2379,7 +2377,11 @@ class ThumbDataParser {
|
|
|
2379
2377
|
__publicField(this, "thumbDataSelectors", []);
|
|
2380
2378
|
__publicField(this, "defaultThumbDataSelectors", [
|
|
2381
2379
|
{ name: "title", type: "string", selector: "[class *= title],[title]" },
|
|
2382
|
-
{
|
|
2380
|
+
{
|
|
2381
|
+
name: "uploader",
|
|
2382
|
+
type: "string",
|
|
2383
|
+
selector: "[class *= uploader], [class *= user], [class *= name]"
|
|
2384
|
+
},
|
|
2383
2385
|
{ name: "duration", type: "duration", selector: "[class *= duration]" }
|
|
2384
2386
|
]);
|
|
2385
2387
|
this.strategy = strategy;
|
|
@@ -2434,9 +2436,9 @@ class ThumbDataParser {
|
|
|
2434
2436
|
if (this.strategy === "auto-select") {
|
|
2435
2437
|
this.thumbDataSelectors = this.defaultThumbDataSelectors;
|
|
2436
2438
|
}
|
|
2437
|
-
const thumbData = Object.fromEntries(
|
|
2438
|
-
(s) => [s.name, this.getThumbDataWith(thumb, s)]
|
|
2439
|
-
)
|
|
2439
|
+
const thumbData = Object.fromEntries(
|
|
2440
|
+
this.thumbDataSelectors.map((s) => [s.name, this.getThumbDataWith(thumb, s)])
|
|
2441
|
+
);
|
|
2440
2442
|
if (this.stringsMeltInTitle) {
|
|
2441
2443
|
Object.entries(thumbData).forEach(([k2, v2]) => {
|
|
2442
2444
|
if (typeof v2 === "string" && k2 !== "title") {
|
|
@@ -2452,50 +2454,47 @@ class ThumbDataParser {
|
|
|
2452
2454
|
class ThumbImgParser {
|
|
2453
2455
|
constructor() {
|
|
2454
2456
|
__publicField(this, "selector");
|
|
2455
|
-
__publicField(this, "
|
|
2457
|
+
__publicField(this, "remove");
|
|
2456
2458
|
__publicField(this, "strategy", "default");
|
|
2457
2459
|
}
|
|
2458
2460
|
static create(options = {}) {
|
|
2459
2461
|
return Object.assign(new ThumbImgParser(), options);
|
|
2460
2462
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
if (this.
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
result.imgSrc = this.selector(img);
|
|
2463
|
+
removeAttrs(img) {
|
|
2464
|
+
if (!this.remove) return;
|
|
2465
|
+
if (this.remove === "auto") {
|
|
2466
|
+
removeClassesAndDataAttributes(img, "lazy");
|
|
2467
|
+
} else {
|
|
2468
|
+
if (this.remove.startsWith(".")) {
|
|
2469
|
+
img.classList.remove(this.remove.slice(1));
|
|
2469
2470
|
} else {
|
|
2470
|
-
|
|
2471
|
-
for (const attr of possibleAttrs) {
|
|
2472
|
-
const imgSrc = img.getAttribute(attr);
|
|
2473
|
-
if (imgSrc) {
|
|
2474
|
-
result.imgSrc = imgSrc;
|
|
2475
|
-
img.removeAttribute(attr);
|
|
2476
|
-
break;
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2471
|
+
img.removeAttribute(this.remove);
|
|
2479
2472
|
}
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
if (img.src.includes("data:image")) {
|
|
2491
|
-
result.img.src = "";
|
|
2492
|
-
}
|
|
2493
|
-
if (img.complete && img.naturalWidth > 0) {
|
|
2494
|
-
return {};
|
|
2495
|
-
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
getImgSrc(img) {
|
|
2476
|
+
const possibleAttrs = this.selector ? [this.selector].flat() : ["data-src", "src"];
|
|
2477
|
+
for (const attr of possibleAttrs) {
|
|
2478
|
+
const imgSrc = img.getAttribute(attr);
|
|
2479
|
+
if (imgSrc) {
|
|
2480
|
+
return imgSrc;
|
|
2496
2481
|
}
|
|
2497
2482
|
}
|
|
2498
|
-
return
|
|
2483
|
+
return "";
|
|
2484
|
+
}
|
|
2485
|
+
getImgData(thumb) {
|
|
2486
|
+
if (this.strategy === "default" && !this.selector) return {};
|
|
2487
|
+
const img = thumb.querySelector("img");
|
|
2488
|
+
if (!img) return {};
|
|
2489
|
+
const imgSrc = typeof this.selector === "function" ? this.selector(img) : this.getImgSrc(img);
|
|
2490
|
+
this.removeAttrs(img);
|
|
2491
|
+
if (img.src.includes("data:image")) {
|
|
2492
|
+
img.src = "";
|
|
2493
|
+
}
|
|
2494
|
+
if (img.complete && img.naturalWidth > 0) {
|
|
2495
|
+
return {};
|
|
2496
|
+
}
|
|
2497
|
+
return { img, imgSrc };
|
|
2499
2498
|
}
|
|
2500
2499
|
}
|
|
2501
2500
|
class ThumbsParser {
|