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
|
@@ -375,20 +375,24 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
375
375
|
this.observer.disconnect();
|
|
376
376
|
}
|
|
377
377
|
static observeWhile(target, callback, throttleTime) {
|
|
378
|
-
const
|
|
378
|
+
const observer = new Observer(async (target2) => {
|
|
379
379
|
const condition = await callback();
|
|
380
|
-
if (condition)
|
|
380
|
+
if (condition) {
|
|
381
|
+
observer.throttle(target2, throttleTime);
|
|
382
|
+
} else {
|
|
383
|
+
observer.dispose();
|
|
384
|
+
}
|
|
381
385
|
});
|
|
382
|
-
|
|
383
|
-
return
|
|
386
|
+
observer.observe(target);
|
|
387
|
+
return observer;
|
|
384
388
|
}
|
|
385
389
|
}
|
|
386
390
|
function formatTimeToHHMMSS(timeStr) {
|
|
387
391
|
var _a3, _b2, _c2;
|
|
388
392
|
const pad = (num) => num.toString().padStart(2, "0");
|
|
389
393
|
const h = ((_a3 = timeStr.match(/(\d+)\s*h/)) == null ? void 0 : _a3[1]) || "0";
|
|
390
|
-
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n
|
|
391
|
-
const s = ((_c2 = timeStr.match(/(\d+)\s*
|
|
394
|
+
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n?/)) == null ? void 0 : _b2[1]) || "0";
|
|
395
|
+
const s = ((_c2 = timeStr.match(/(\d+)\s*se?c?/)) == null ? void 0 : _c2[1]) || "0";
|
|
392
396
|
return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
|
|
393
397
|
}
|
|
394
398
|
function timeToSeconds(timeStr) {
|
|
@@ -438,11 +442,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
438
442
|
applyCSSFilters(wrapper) {
|
|
439
443
|
this.filters.forEach((_2, name) => {
|
|
440
444
|
const cssRule = `.filter-${name} { display: none !important; }`;
|
|
441
|
-
|
|
442
|
-
client.GM_addStyle(wrapper(cssRule));
|
|
443
|
-
} else {
|
|
444
|
-
client.GM_addStyle(cssRule);
|
|
445
|
-
}
|
|
445
|
+
client.GM_addStyle(wrapper ? wrapper(cssRule) : cssRule);
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
448
|
registerFilters(customFilters) {
|
|
@@ -1285,14 +1285,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1285
1285
|
__publicField(this, "subject", new Subject());
|
|
1286
1286
|
__publicField(this, "generatorConsumer", async () => {
|
|
1287
1287
|
if (!this.enabled) return false;
|
|
1288
|
-
const {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
await this.doScroll(url, offset);
|
|
1294
|
-
}
|
|
1295
|
-
return !done;
|
|
1288
|
+
const { value, done } = await this.paginationGenerator.next();
|
|
1289
|
+
if (done) return false;
|
|
1290
|
+
const { url, offset } = value;
|
|
1291
|
+
await this.doScroll(url, offset);
|
|
1292
|
+
return true;
|
|
1296
1293
|
});
|
|
1297
1294
|
this.rules = options.rules;
|
|
1298
1295
|
this.paginationOffset = this.rules.paginationStrategy.getPaginationOffset();
|
|
@@ -1320,7 +1317,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1320
1317
|
const autoScrollWrapper = async () => {
|
|
1321
1318
|
if (this.rules.store.state.autoScroll) {
|
|
1322
1319
|
await wait(this.rules.store.state.delay);
|
|
1323
|
-
await this.generatorConsumer();
|
|
1320
|
+
const res = await this.generatorConsumer();
|
|
1321
|
+
if (!res) return;
|
|
1324
1322
|
await autoScrollWrapper();
|
|
1325
1323
|
}
|
|
1326
1324
|
};
|
|
@@ -2382,7 +2380,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2382
2380
|
__publicField(this, "thumbDataSelectors", []);
|
|
2383
2381
|
__publicField(this, "defaultThumbDataSelectors", [
|
|
2384
2382
|
{ name: "title", type: "string", selector: "[class *= title],[title]" },
|
|
2385
|
-
{
|
|
2383
|
+
{
|
|
2384
|
+
name: "uploader",
|
|
2385
|
+
type: "string",
|
|
2386
|
+
selector: "[class *= uploader], [class *= user], [class *= name]"
|
|
2387
|
+
},
|
|
2386
2388
|
{ name: "duration", type: "duration", selector: "[class *= duration]" }
|
|
2387
2389
|
]);
|
|
2388
2390
|
this.strategy = strategy;
|
|
@@ -2437,9 +2439,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2437
2439
|
if (this.strategy === "auto-select") {
|
|
2438
2440
|
this.thumbDataSelectors = this.defaultThumbDataSelectors;
|
|
2439
2441
|
}
|
|
2440
|
-
const thumbData = Object.fromEntries(
|
|
2441
|
-
(s) => [s.name, this.getThumbDataWith(thumb, s)]
|
|
2442
|
-
)
|
|
2442
|
+
const thumbData = Object.fromEntries(
|
|
2443
|
+
this.thumbDataSelectors.map((s) => [s.name, this.getThumbDataWith(thumb, s)])
|
|
2444
|
+
);
|
|
2443
2445
|
if (this.stringsMeltInTitle) {
|
|
2444
2446
|
Object.entries(thumbData).forEach(([k2, v2]) => {
|
|
2445
2447
|
if (typeof v2 === "string" && k2 !== "title") {
|
|
@@ -2455,50 +2457,47 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2455
2457
|
class ThumbImgParser {
|
|
2456
2458
|
constructor() {
|
|
2457
2459
|
__publicField(this, "selector");
|
|
2458
|
-
__publicField(this, "
|
|
2460
|
+
__publicField(this, "remove");
|
|
2459
2461
|
__publicField(this, "strategy", "default");
|
|
2460
2462
|
}
|
|
2461
2463
|
static create(options = {}) {
|
|
2462
2464
|
return Object.assign(new ThumbImgParser(), options);
|
|
2463
2465
|
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
if (this.
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
result.imgSrc = this.selector(img);
|
|
2466
|
+
removeAttrs(img) {
|
|
2467
|
+
if (!this.remove) return;
|
|
2468
|
+
if (this.remove === "auto") {
|
|
2469
|
+
removeClassesAndDataAttributes(img, "lazy");
|
|
2470
|
+
} else {
|
|
2471
|
+
if (this.remove.startsWith(".")) {
|
|
2472
|
+
img.classList.remove(this.remove.slice(1));
|
|
2472
2473
|
} else {
|
|
2473
|
-
|
|
2474
|
-
for (const attr of possibleAttrs) {
|
|
2475
|
-
const imgSrc = img.getAttribute(attr);
|
|
2476
|
-
if (imgSrc) {
|
|
2477
|
-
result.imgSrc = imgSrc;
|
|
2478
|
-
img.removeAttribute(attr);
|
|
2479
|
-
break;
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2474
|
+
img.removeAttribute(this.remove);
|
|
2482
2475
|
}
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
if (img.src.includes("data:image")) {
|
|
2494
|
-
result.img.src = "";
|
|
2495
|
-
}
|
|
2496
|
-
if (img.complete && img.naturalWidth > 0) {
|
|
2497
|
-
return {};
|
|
2498
|
-
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
getImgSrc(img) {
|
|
2479
|
+
const possibleAttrs = this.selector ? [this.selector].flat() : ["data-src", "src"];
|
|
2480
|
+
for (const attr of possibleAttrs) {
|
|
2481
|
+
const imgSrc = img.getAttribute(attr);
|
|
2482
|
+
if (imgSrc) {
|
|
2483
|
+
return imgSrc;
|
|
2499
2484
|
}
|
|
2500
2485
|
}
|
|
2501
|
-
return
|
|
2486
|
+
return "";
|
|
2487
|
+
}
|
|
2488
|
+
getImgData(thumb) {
|
|
2489
|
+
if (this.strategy === "default" && !this.selector) return {};
|
|
2490
|
+
const img = thumb.querySelector("img");
|
|
2491
|
+
if (!img) return {};
|
|
2492
|
+
const imgSrc = typeof this.selector === "function" ? this.selector(img) : this.getImgSrc(img);
|
|
2493
|
+
this.removeAttrs(img);
|
|
2494
|
+
if (img.src.includes("data:image")) {
|
|
2495
|
+
img.src = "";
|
|
2496
|
+
}
|
|
2497
|
+
if (img.complete && img.naturalWidth > 0) {
|
|
2498
|
+
return {};
|
|
2499
|
+
}
|
|
2500
|
+
return { img, imgSrc };
|
|
2502
2501
|
}
|
|
2503
2502
|
}
|
|
2504
2503
|
class ThumbsParser {
|