pervert-monkey 1.0.0

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/core/pervertmonkey.core.es.d.ts +391 -0
  4. package/dist/core/pervertmonkey.core.es.js +8497 -0
  5. package/dist/core/pervertmonkey.core.es.js.map +1 -0
  6. package/dist/core/pervertmonkey.core.umd.js +8500 -0
  7. package/dist/core/pervertmonkey.core.umd.js.map +1 -0
  8. package/dist/userscripts/3hentai.user.js +1176 -0
  9. package/dist/userscripts/camgirlfinder.user.js +68 -0
  10. package/dist/userscripts/camwhores.user.js +1602 -0
  11. package/dist/userscripts/e-hentai.user.js +1212 -0
  12. package/dist/userscripts/ebalka.user.js +1231 -0
  13. package/dist/userscripts/eporner.user.js +1265 -0
  14. package/dist/userscripts/erome.user.js +1245 -0
  15. package/dist/userscripts/eroprofile.user.js +1194 -0
  16. package/dist/userscripts/javhdporn.user.js +1178 -0
  17. package/dist/userscripts/missav.user.js +1182 -0
  18. package/dist/userscripts/motherless.user.js +1380 -0
  19. package/dist/userscripts/namethatporn.user.js +1218 -0
  20. package/dist/userscripts/nhentai.user.js +1262 -0
  21. package/dist/userscripts/pornhub.user.js +1199 -0
  22. package/dist/userscripts/spankbang.user.js +1239 -0
  23. package/dist/userscripts/xhamster.user.js +1374 -0
  24. package/dist/userscripts/xvideos.user.js +1254 -0
  25. package/package.json +54 -0
  26. package/src/core/data-control/data-filter.ts +143 -0
  27. package/src/core/data-control/data-manager.ts +144 -0
  28. package/src/core/data-control/index.ts +2 -0
  29. package/src/core/infinite-scroll/index.ts +143 -0
  30. package/src/core/jabroni-config/default-scheme.ts +97 -0
  31. package/src/core/jabroni-config/default-store.ts +9 -0
  32. package/src/core/pagination-parsing/index.ts +55 -0
  33. package/src/core/pagination-parsing/pagination-strategies/PaginationStrategy.ts +44 -0
  34. package/src/core/pagination-parsing/pagination-strategies/PaginationStrategyDataParams.ts +66 -0
  35. package/src/core/pagination-parsing/pagination-strategies/PaginationStrategyPathnameParams.ts +77 -0
  36. package/src/core/pagination-parsing/pagination-strategies/PaginationStrategySearchParams.ts +56 -0
  37. package/src/core/pagination-parsing/pagination-strategies/index.ts +4 -0
  38. package/src/core/pagination-parsing/pagination-utils/index.ts +84 -0
  39. package/src/core/rules/index.ts +385 -0
  40. package/src/index.ts +42 -0
  41. package/src/types/index.ts +7 -0
  42. package/src/userscripts/ascii-logos.js +468 -0
  43. package/src/userscripts/index.ts +1 -0
  44. package/src/userscripts/meta.json +11 -0
  45. package/src/userscripts/scripts/3hentai.ts +20 -0
  46. package/src/userscripts/scripts/camgirlfinder.ts +68 -0
  47. package/src/userscripts/scripts/camwhores.ts +382 -0
  48. package/src/userscripts/scripts/e-hentai.ts +68 -0
  49. package/src/userscripts/scripts/ebalka.ts +58 -0
  50. package/src/userscripts/scripts/eporner.ts +90 -0
  51. package/src/userscripts/scripts/erome.ts +105 -0
  52. package/src/userscripts/scripts/eroprofile.ts +38 -0
  53. package/src/userscripts/scripts/javhdporn.ts +24 -0
  54. package/src/userscripts/scripts/missav.ts +28 -0
  55. package/src/userscripts/scripts/motherless.ts +222 -0
  56. package/src/userscripts/scripts/namethatporn.ts +68 -0
  57. package/src/userscripts/scripts/nhentai.ts +135 -0
  58. package/src/userscripts/scripts/pornhub.ts +53 -0
  59. package/src/userscripts/scripts/spankbang.ts +61 -0
  60. package/src/userscripts/scripts/thisvid.ts +716 -0
  61. package/src/userscripts/scripts/xhamster.ts +179 -0
  62. package/src/userscripts/scripts/xvideos.ts +83 -0
  63. package/src/utils/arrays/index.ts +15 -0
  64. package/src/utils/async/index.ts +3 -0
  65. package/src/utils/dom/dom-observers.ts +76 -0
  66. package/src/utils/dom/index.ts +156 -0
  67. package/src/utils/events/index.ts +2 -0
  68. package/src/utils/events/on-pointer-over-and-leave.ts +35 -0
  69. package/src/utils/events/tick.ts +27 -0
  70. package/src/utils/fetch/index.ts +37 -0
  71. package/src/utils/math/index.ts +3 -0
  72. package/src/utils/objects/index.ts +9 -0
  73. package/src/utils/objects/memoize.ts +25 -0
  74. package/src/utils/observers/index.ts +44 -0
  75. package/src/utils/observers/lazy-image-loader.ts +27 -0
  76. package/src/utils/parsers/index.ts +30 -0
  77. package/src/utils/parsers/time-parser.ts +28 -0
  78. package/src/utils/strings/index.ts +10 -0
  79. package/src/utils/strings/regexes.ts +35 -0
  80. package/src/vite-env.d.ts +4 -0
@@ -0,0 +1,44 @@
1
+ export { LazyImgLoader } from './lazy-image-loader';
2
+
3
+ export class Observer {
4
+ public observer: IntersectionObserver;
5
+ private timeout?: number;
6
+ constructor(private callback: (entry: Element) => void) {
7
+ this.observer = new IntersectionObserver(this.handleIntersection.bind(this));
8
+ }
9
+
10
+ observe(target: Element) {
11
+ this.observer.observe(target);
12
+ }
13
+
14
+ throttle(target: Element, throttleTime: number) {
15
+ this.observer.unobserve(target);
16
+ this.timeout = window.setTimeout(() => this.observer.observe(target), throttleTime);
17
+ }
18
+
19
+ handleIntersection(entries: Iterable<IntersectionObserverEntry>) {
20
+ for (const entry of entries) {
21
+ if (entry.isIntersecting) {
22
+ this.callback(entry.target);
23
+ }
24
+ }
25
+ }
26
+
27
+ dispose() {
28
+ if (this.timeout) clearTimeout(this.timeout);
29
+ this.observer.disconnect();
30
+ }
31
+
32
+ static observeWhile(
33
+ target: Element,
34
+ callback: () => Promise<boolean> | boolean,
35
+ throttleTime: number,
36
+ ) {
37
+ const observer_ = new Observer(async (target: Element) => {
38
+ const condition = await callback();
39
+ if (condition) observer_.throttle(target, throttleTime);
40
+ });
41
+ observer_.observe(target);
42
+ return observer_;
43
+ }
44
+ }
@@ -0,0 +1,27 @@
1
+ import { Observer } from ".";
2
+
3
+ export class LazyImgLoader {
4
+ public lazyImgObserver: Observer;
5
+ private attributeName = 'data-lazy-load';
6
+
7
+ constructor(shouldDelazify: (target: Element) => boolean) {
8
+ this.lazyImgObserver = new Observer((target: Element) => {
9
+ if (shouldDelazify(target)) {
10
+ this.delazify(target as HTMLImageElement);
11
+ }
12
+ });
13
+ }
14
+
15
+ lazify(_target: Element, img?: HTMLImageElement, imgSrc?: string) {
16
+ if (!img || !imgSrc) return;
17
+ img.setAttribute(this.attributeName, imgSrc);
18
+ img.src = '';
19
+ this.lazyImgObserver.observe(img);
20
+ }
21
+
22
+ delazify = (target: HTMLImageElement) => {
23
+ this.lazyImgObserver.observer.unobserve(target);
24
+ target.src = target.getAttribute(this.attributeName) as string;
25
+ target.removeAttribute(this.attributeName);
26
+ };
27
+ }
@@ -0,0 +1,30 @@
1
+ export { formatTimeToHHMMSS, timeToSeconds } from './time-parser';
2
+
3
+ export function parseIntegerOr(n: string | number, or: number): number {
4
+ const num = Number(n);
5
+ return Number.isSafeInteger(num) ? num : or;
6
+ }
7
+
8
+ // "data:02;body+head:async;void:;zero:;"
9
+ export function parseDataParams(str: string): Record<string, string> {
10
+ const paramsStr = decodeURI(str.trim()).split(';');
11
+ return paramsStr.reduce(
12
+ (acc, s) => {
13
+ const parsed = s.match(/([+\w]+):([\w\- ]+)?/);
14
+ if (parsed) {
15
+ const [, key, value] = parsed;
16
+ if (value) {
17
+ key.split('+').forEach((p) => {
18
+ acc[p] = value;
19
+ });
20
+ }
21
+ }
22
+ return acc;
23
+ },
24
+ {} as Record<string, string>,
25
+ );
26
+ }
27
+
28
+ export function parseCssUrl(s: string) {
29
+ return s.replace(/url\("|"\).*/g, '');
30
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Converts a duration string (e.g., "1h 22min 3sec") to HH:MM:SS format.
3
+ * @param timeStr - The duration string to format.
4
+ * @returns A string in the format HH:MM:SS.
5
+ */
6
+ export function formatTimeToHHMMSS(timeStr: string): string {
7
+ const pad = (num: number): string => num.toString().padStart(2, '0');
8
+
9
+ const h = timeStr.match(/(\d+)\s*h/)?.[1] || '0';
10
+ const m = timeStr.match(/(\d+)\s*mi?n/)?.[1] || '0';
11
+ const s = timeStr.match(/(\d+)\s*sec/)?.[1] || '0';
12
+
13
+ return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
14
+ }
15
+
16
+ /**
17
+ * Converts a time string (HH:MM:SS or duration format) to total seconds.
18
+ * @param timeStr - The time string to convert.
19
+ * @returns The total number of seconds.
20
+ */
21
+ export function timeToSeconds(timeStr: string): number {
22
+ const normalized = /[a-zA-Z]/.test(timeStr) ? formatTimeToHHMMSS(timeStr) : timeStr;
23
+
24
+ return normalized
25
+ .split(':')
26
+ .reverse()
27
+ .reduce((total, unit, index) => total + parseInt(unit, 10) * 60 ** index, 0);
28
+ }
@@ -0,0 +1,10 @@
1
+ export function splitWith(s: string, c: string = ','): Array<string> {
2
+ return s
3
+ .split(c)
4
+ .map((s) => s.trim())
5
+ .filter(Boolean);
6
+ }
7
+
8
+ export function sanitizeStr(s: string) {
9
+ return s?.replace(/\n|\t/g, ' ').replace(/ {2,}/g, ' ').trim() || '';
10
+ }
@@ -0,0 +1,35 @@
1
+ import { memoize } from '../objects';
2
+ import { splitWith } from '.';
3
+
4
+ export class RegexFilter {
5
+ private regexes: RegExp[];
6
+
7
+ constructor(str: string, flags: string = 'gi') {
8
+ this.regexes = memoize(this.compileSearchRegex)(str, flags);
9
+ }
10
+
11
+ // 'dog,bog,f:girl' or r:dog|bog... => [r/dog/i, r/bog/i, r/(^|\ )girl($|\ )/i]
12
+ private compileSearchRegex(str: string, flags: string): RegExp[] {
13
+ try {
14
+ if (str.startsWith('r:')) return [new RegExp(str.slice(2), flags)];
15
+
16
+ const regexes = splitWith(str)
17
+ .map(
18
+ (s) => s.replace(/f:(\w+)/g, (_, w) => `(^|\\ |,)${w}($|\\ |,)`), // full word
19
+ )
20
+ .map((_) => new RegExp(_, flags));
21
+
22
+ return regexes;
23
+ } catch (_) {
24
+ return [];
25
+ }
26
+ }
27
+
28
+ public hasEvery(str: string) {
29
+ return this.regexes.every((r) => r.test(str));
30
+ }
31
+
32
+ public hasNone(str: string) {
33
+ return this.regexes.every((r) => !r.test(str));
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-monkey/client" />
3
+ /// <reference types="vite-plugin-monkey/global" />
4
+ /// <reference types="vite-plugin-monkey/style" />