pervert-monkey 1.0.3 → 1.0.5
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.
|
@@ -10,26 +10,23 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
12
|
var _i2, _n, _t, _e2, _s2, _l2, _o2, _d, _p2, _g, _C_instances, r_fn, R_fn, b_fn, u_fn, m_fn, a_fn, P_fn, E_fn, S_fn, O_fn, k_fn, x_fn, h_fn, f_fn, T_fn, A_fn, y_fn, w_fn, c_fn, C_fn, _a2, _i3, _n2, _t2, _e3, _s3, _l3, _b;
|
|
13
|
-
import { GM_addStyle } from "
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return cache.get(key);
|
|
20
|
-
}
|
|
21
|
-
const result = fn2(...args);
|
|
22
|
-
cache.set(key, result);
|
|
23
|
-
return result;
|
|
24
|
-
});
|
|
25
|
-
return memoizedFunction;
|
|
13
|
+
import { GM_addStyle } from "vite-plugin-monkey/dist/client";
|
|
14
|
+
function chunks(arr, size) {
|
|
15
|
+
return Array.from(
|
|
16
|
+
{ length: Math.ceil(arr.length / size) },
|
|
17
|
+
(_2, i) => arr.slice(i * size, i * size + size)
|
|
18
|
+
);
|
|
26
19
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
function* irange(start = 1, step = 1) {
|
|
21
|
+
for (let i = start; ; i += step) {
|
|
22
|
+
yield i;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function range(size, start = 1, step = 1) {
|
|
26
|
+
return irange(start, step).take(size).toArray();
|
|
27
|
+
}
|
|
28
|
+
function wait(milliseconds) {
|
|
29
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
33
30
|
}
|
|
34
31
|
function splitWith(s, c = ",") {
|
|
35
32
|
return s.split(c).map((s2) => s2.trim()).filter(Boolean);
|
|
@@ -37,133 +34,6 @@ function splitWith(s, c = ",") {
|
|
|
37
34
|
function sanitizeStr(s) {
|
|
38
35
|
return (s == null ? void 0 : s.replace(/\n|\t/g, " ").replace(/ {2,}/g, " ").trim()) || "";
|
|
39
36
|
}
|
|
40
|
-
class RegexFilter {
|
|
41
|
-
constructor(str, flags = "gi") {
|
|
42
|
-
__publicField(this, "regexes");
|
|
43
|
-
this.regexes = memoize(this.compileSearchRegex)(str, flags);
|
|
44
|
-
}
|
|
45
|
-
// 'dog,bog,f:girl' or r:dog|bog... => [r/dog/i, r/bog/i, r/(^|\ )girl($|\ )/i]
|
|
46
|
-
compileSearchRegex(str, flags) {
|
|
47
|
-
try {
|
|
48
|
-
if (str.startsWith("r:")) return [new RegExp(str.slice(2), flags)];
|
|
49
|
-
const regexes = splitWith(str).map(
|
|
50
|
-
(s) => s.replace(/f:(\w+)/g, (_2, w2) => `(^|\\ |,)${w2}($|\\ |,)`)
|
|
51
|
-
// full word
|
|
52
|
-
).map((_2) => new RegExp(_2, flags));
|
|
53
|
-
return regexes;
|
|
54
|
-
} catch (_2) {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
hasEvery(str) {
|
|
59
|
-
return this.regexes.every((r) => r.test(str));
|
|
60
|
-
}
|
|
61
|
-
hasNone(str) {
|
|
62
|
-
return this.regexes.every((r) => !r.test(str));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const _DataFilter = class _DataFilter {
|
|
66
|
-
constructor(rules) {
|
|
67
|
-
__publicField(this, "filters", /* @__PURE__ */ new Map());
|
|
68
|
-
__publicField(this, "customDataSelectorFns", {});
|
|
69
|
-
__publicField(this, "filterMapping", {});
|
|
70
|
-
this.rules = rules;
|
|
71
|
-
this.registerFilters(rules.customDataSelectorFns);
|
|
72
|
-
this.applyCSSFilters();
|
|
73
|
-
}
|
|
74
|
-
static isFiltered(el2) {
|
|
75
|
-
return el2.className.includes("filter-");
|
|
76
|
-
}
|
|
77
|
-
applyCSSFilters(wrapper) {
|
|
78
|
-
this.filters.forEach((_2, name) => {
|
|
79
|
-
const cssRule = `.filter-${name} { display: none !important; }`;
|
|
80
|
-
if (wrapper) {
|
|
81
|
-
GM_addStyle(wrapper(cssRule));
|
|
82
|
-
} else {
|
|
83
|
-
GM_addStyle(cssRule);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
registerFilters(customFilters) {
|
|
88
|
-
customFilters.forEach((o) => {
|
|
89
|
-
if (typeof o === "string") {
|
|
90
|
-
this.customDataSelectorFns[o] = _DataFilter.customDataSelectorFnsDefault[o];
|
|
91
|
-
this.registerFilter(o);
|
|
92
|
-
} else {
|
|
93
|
-
const k2 = Object.keys(o)[0];
|
|
94
|
-
this.customDataSelectorFns[k2] = o[k2];
|
|
95
|
-
this.registerFilter(k2);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
customSelectorParser(name, selector) {
|
|
100
|
-
if ("handle" in selector) {
|
|
101
|
-
return selector;
|
|
102
|
-
} else {
|
|
103
|
-
return { handle: selector, deps: [name] };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
registerFilter(customSelectorName) {
|
|
107
|
-
var _a3;
|
|
108
|
-
const handler = this.customSelectorParser(
|
|
109
|
-
customSelectorName,
|
|
110
|
-
this.customDataSelectorFns[customSelectorName]
|
|
111
|
-
);
|
|
112
|
-
const tag = `filter-${customSelectorName}`;
|
|
113
|
-
(_a3 = [customSelectorName, ...handler.deps || []]) == null ? void 0 : _a3.forEach((name) => {
|
|
114
|
-
Object.assign(this.filterMapping, { [name]: customSelectorName });
|
|
115
|
-
});
|
|
116
|
-
const fn2 = () => {
|
|
117
|
-
var _a4;
|
|
118
|
-
const preDefined = (_a4 = handler.$preDefine) == null ? void 0 : _a4.call(handler, this.rules.store.state);
|
|
119
|
-
return (v2) => {
|
|
120
|
-
const condition = handler.handle(v2, this.rules.store.state, preDefined);
|
|
121
|
-
return {
|
|
122
|
-
condition,
|
|
123
|
-
tag
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
this.filters.set(customSelectorName, fn2);
|
|
128
|
-
}
|
|
129
|
-
selectFilters(filters) {
|
|
130
|
-
const selectedFilters = Object.keys(filters).filter((k2) => k2 in this.filterMapping).map((k2) => this.filterMapping[k2]).map((k2) => this.filters.get(k2));
|
|
131
|
-
return selectedFilters;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
__publicField(_DataFilter, "customDataSelectorFnsDefault", {
|
|
135
|
-
filterDuration: {
|
|
136
|
-
handle(el2, state, notInRange) {
|
|
137
|
-
return state.filterDuration && notInRange(el2.duration);
|
|
138
|
-
},
|
|
139
|
-
$preDefine: (state) => {
|
|
140
|
-
const from = state.filterDurationFrom;
|
|
141
|
-
const to2 = state.filterDurationTo;
|
|
142
|
-
function notInRange(d2) {
|
|
143
|
-
return d2 < from || d2 > to2;
|
|
144
|
-
}
|
|
145
|
-
return notInRange;
|
|
146
|
-
},
|
|
147
|
-
deps: ["filterDurationFrom", "filterDurationTo"]
|
|
148
|
-
},
|
|
149
|
-
filterExclude: {
|
|
150
|
-
handle(el2, state, searchFilter) {
|
|
151
|
-
if (!state.filterExclude) return false;
|
|
152
|
-
return !searchFilter.hasNone(el2.title);
|
|
153
|
-
},
|
|
154
|
-
$preDefine: (state) => new RegexFilter(state.filterExcludeWords),
|
|
155
|
-
deps: ["filterExcludeWords"]
|
|
156
|
-
},
|
|
157
|
-
filterInclude: {
|
|
158
|
-
handle(el2, state, searchFilter) {
|
|
159
|
-
if (!state.filterInclude) return false;
|
|
160
|
-
return !searchFilter.hasEvery(el2.title);
|
|
161
|
-
},
|
|
162
|
-
$preDefine: (state) => new RegexFilter(state.filterIncludeWords),
|
|
163
|
-
deps: ["filterIncludeWords"]
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
let DataFilter = _DataFilter;
|
|
167
37
|
function waitForElementToAppear(parent, selector, callback) {
|
|
168
38
|
const observer = new MutationObserver((_mutations) => {
|
|
169
39
|
const el2 = parent.querySelector(selector);
|
|
@@ -326,6 +196,94 @@ function downloader(options = { append: "", after: "", button: "", cbBefore: ()
|
|
|
326
196
|
});
|
|
327
197
|
});
|
|
328
198
|
}
|
|
199
|
+
function onPointerOverAndLeave(container, subjectSelector, onOver, onLeave) {
|
|
200
|
+
let target;
|
|
201
|
+
let onOverFinally;
|
|
202
|
+
function handleLeaveEvent() {
|
|
203
|
+
onLeave == null ? void 0 : onLeave(target);
|
|
204
|
+
onOverFinally == null ? void 0 : onOverFinally();
|
|
205
|
+
target = void 0;
|
|
206
|
+
}
|
|
207
|
+
function handleEvent(e) {
|
|
208
|
+
const currentTarget = e.target;
|
|
209
|
+
if (!subjectSelector(currentTarget) || target === currentTarget) return;
|
|
210
|
+
target = currentTarget;
|
|
211
|
+
const result = onOver(target);
|
|
212
|
+
onOverFinally = result == null ? void 0 : result.onOverCallback;
|
|
213
|
+
const leaveSubject = (result == null ? void 0 : result.leaveTarget) || target;
|
|
214
|
+
leaveSubject.addEventListener("pointerleave", handleLeaveEvent, {
|
|
215
|
+
once: true
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
container.addEventListener("pointerover", handleEvent);
|
|
219
|
+
}
|
|
220
|
+
class Tick {
|
|
221
|
+
constructor(delay, startImmediate = true) {
|
|
222
|
+
__publicField(this, "tick");
|
|
223
|
+
__publicField(this, "callbackFinal");
|
|
224
|
+
this.delay = delay;
|
|
225
|
+
this.startImmediate = startImmediate;
|
|
226
|
+
}
|
|
227
|
+
start(callback, callbackFinal) {
|
|
228
|
+
this.stop();
|
|
229
|
+
this.callbackFinal = callbackFinal;
|
|
230
|
+
if (this.startImmediate) callback();
|
|
231
|
+
this.tick = window.setInterval(callback, this.delay);
|
|
232
|
+
}
|
|
233
|
+
stop() {
|
|
234
|
+
if (this.tick !== void 0) {
|
|
235
|
+
clearInterval(this.tick);
|
|
236
|
+
this.tick = void 0;
|
|
237
|
+
}
|
|
238
|
+
if (this.callbackFinal) {
|
|
239
|
+
this.callbackFinal();
|
|
240
|
+
this.callbackFinal = void 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const MOBILE_UA = {
|
|
245
|
+
"User-Agent": [
|
|
246
|
+
"Mozilla/5.0 (Linux; Android 10; K)",
|
|
247
|
+
"AppleWebKit/537.36 (KHTML, like Gecko)",
|
|
248
|
+
"Chrome/114.0.0.0 Mobile Safari/537.36"
|
|
249
|
+
].join(" ")
|
|
250
|
+
};
|
|
251
|
+
async function fetchWith(input, options) {
|
|
252
|
+
const requestInit = options.init || {};
|
|
253
|
+
if (options.mobile) {
|
|
254
|
+
Object.assign(requestInit, { headers: new Headers(MOBILE_UA) });
|
|
255
|
+
}
|
|
256
|
+
const r = await fetch(input, requestInit).then((r2) => r2);
|
|
257
|
+
if (options.type === "json") return await r.json();
|
|
258
|
+
if (options.type === "html") return parseHtml(await r.text());
|
|
259
|
+
return await r.text();
|
|
260
|
+
}
|
|
261
|
+
const fetchJson = (input) => fetchWith(input, { type: "json" });
|
|
262
|
+
const fetchHtml = (input) => fetchWith(input, { type: "html" });
|
|
263
|
+
const fetchText = (input) => fetchWith(input, { type: "text" });
|
|
264
|
+
function circularShift(n, c = 6, s = 1) {
|
|
265
|
+
return (n + s) % c || c;
|
|
266
|
+
}
|
|
267
|
+
function memoize(fn2) {
|
|
268
|
+
const cache = /* @__PURE__ */ new Map();
|
|
269
|
+
const memoizedFunction = ((...args) => {
|
|
270
|
+
const key = JSON.stringify(args);
|
|
271
|
+
if (cache.has(key)) {
|
|
272
|
+
return cache.get(key);
|
|
273
|
+
}
|
|
274
|
+
const result = fn2(...args);
|
|
275
|
+
cache.set(key, result);
|
|
276
|
+
return result;
|
|
277
|
+
});
|
|
278
|
+
return memoizedFunction;
|
|
279
|
+
}
|
|
280
|
+
function objectToFormData(obj) {
|
|
281
|
+
const formData = new FormData();
|
|
282
|
+
Object.entries(obj).forEach(([k2, v2]) => {
|
|
283
|
+
formData.append(k2, v2);
|
|
284
|
+
});
|
|
285
|
+
return formData;
|
|
286
|
+
}
|
|
329
287
|
class LazyImgLoader {
|
|
330
288
|
constructor(shouldDelazify) {
|
|
331
289
|
__publicField(this, "lazyImgObserver");
|
|
@@ -341,47 +299,211 @@ class LazyImgLoader {
|
|
|
341
299
|
}
|
|
342
300
|
});
|
|
343
301
|
}
|
|
344
|
-
lazify(_target, img, imgSrc) {
|
|
345
|
-
if (!img || !imgSrc) return;
|
|
346
|
-
img.setAttribute(this.attributeName, imgSrc);
|
|
347
|
-
img.src = "";
|
|
348
|
-
this.lazyImgObserver.observe(img);
|
|
302
|
+
lazify(_target, img, imgSrc) {
|
|
303
|
+
if (!img || !imgSrc) return;
|
|
304
|
+
img.setAttribute(this.attributeName, imgSrc);
|
|
305
|
+
img.src = "";
|
|
306
|
+
this.lazyImgObserver.observe(img);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
class Observer {
|
|
310
|
+
constructor(callback) {
|
|
311
|
+
__publicField(this, "observer");
|
|
312
|
+
__publicField(this, "timeout");
|
|
313
|
+
this.callback = callback;
|
|
314
|
+
this.observer = new IntersectionObserver(this.handleIntersection.bind(this));
|
|
315
|
+
}
|
|
316
|
+
observe(target) {
|
|
317
|
+
this.observer.observe(target);
|
|
318
|
+
}
|
|
319
|
+
throttle(target, throttleTime) {
|
|
320
|
+
this.observer.unobserve(target);
|
|
321
|
+
this.timeout = window.setTimeout(() => this.observer.observe(target), throttleTime);
|
|
322
|
+
}
|
|
323
|
+
handleIntersection(entries) {
|
|
324
|
+
for (const entry of entries) {
|
|
325
|
+
if (entry.isIntersecting) {
|
|
326
|
+
this.callback(entry.target);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
dispose() {
|
|
331
|
+
if (this.timeout) clearTimeout(this.timeout);
|
|
332
|
+
this.observer.disconnect();
|
|
333
|
+
}
|
|
334
|
+
static observeWhile(target, callback, throttleTime) {
|
|
335
|
+
const observer_ = new Observer(async (target2) => {
|
|
336
|
+
const condition = await callback();
|
|
337
|
+
if (condition) observer_.throttle(target2, throttleTime);
|
|
338
|
+
});
|
|
339
|
+
observer_.observe(target);
|
|
340
|
+
return observer_;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function formatTimeToHHMMSS(timeStr) {
|
|
344
|
+
var _a3, _b2, _c2;
|
|
345
|
+
const pad = (num) => num.toString().padStart(2, "0");
|
|
346
|
+
const h = ((_a3 = timeStr.match(/(\d+)\s*h/)) == null ? void 0 : _a3[1]) || "0";
|
|
347
|
+
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n/)) == null ? void 0 : _b2[1]) || "0";
|
|
348
|
+
const s = ((_c2 = timeStr.match(/(\d+)\s*sec/)) == null ? void 0 : _c2[1]) || "0";
|
|
349
|
+
return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
|
|
350
|
+
}
|
|
351
|
+
function timeToSeconds(timeStr) {
|
|
352
|
+
const normalized = /[a-zA-Z]/.test(timeStr) ? formatTimeToHHMMSS(timeStr) : timeStr;
|
|
353
|
+
return normalized.split(":").reverse().reduce((total, unit, index) => total + parseInt(unit, 10) * 60 ** index, 0);
|
|
354
|
+
}
|
|
355
|
+
function parseIntegerOr(n, or2) {
|
|
356
|
+
const num = Number(n);
|
|
357
|
+
return Number.isSafeInteger(num) ? num : or2;
|
|
358
|
+
}
|
|
359
|
+
function parseDataParams(str) {
|
|
360
|
+
const paramsStr = decodeURI(str.trim()).split(";");
|
|
361
|
+
return paramsStr.reduce(
|
|
362
|
+
(acc, s) => {
|
|
363
|
+
const parsed = s.match(/([+\w]+):([\w\- ]+)?/);
|
|
364
|
+
if (parsed) {
|
|
365
|
+
const [, key, value] = parsed;
|
|
366
|
+
if (value) {
|
|
367
|
+
key.split("+").forEach((p) => {
|
|
368
|
+
acc[p] = value;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return acc;
|
|
373
|
+
},
|
|
374
|
+
{}
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
function parseCssUrl(s) {
|
|
378
|
+
return s.replace(/url\("|"\).*/g, "");
|
|
379
|
+
}
|
|
380
|
+
class RegexFilter {
|
|
381
|
+
constructor(str, flags = "gi") {
|
|
382
|
+
__publicField(this, "regexes");
|
|
383
|
+
this.regexes = memoize(this.compileSearchRegex)(str, flags);
|
|
384
|
+
}
|
|
385
|
+
// 'dog,bog,f:girl' or r:dog|bog... => [r/dog/i, r/bog/i, r/(^|\ )girl($|\ )/i]
|
|
386
|
+
compileSearchRegex(str, flags) {
|
|
387
|
+
try {
|
|
388
|
+
if (str.startsWith("r:")) return [new RegExp(str.slice(2), flags)];
|
|
389
|
+
const regexes = splitWith(str).map(
|
|
390
|
+
(s) => s.replace(/f:(\w+)/g, (_2, w2) => `(^|\\ |,)${w2}($|\\ |,)`)
|
|
391
|
+
// full word
|
|
392
|
+
).map((_2) => new RegExp(_2, flags));
|
|
393
|
+
return regexes;
|
|
394
|
+
} catch (_2) {
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
hasEvery(str) {
|
|
399
|
+
return this.regexes.every((r) => r.test(str));
|
|
400
|
+
}
|
|
401
|
+
hasNone(str) {
|
|
402
|
+
return this.regexes.every((r) => !r.test(str));
|
|
349
403
|
}
|
|
350
404
|
}
|
|
351
|
-
class
|
|
352
|
-
constructor(
|
|
353
|
-
__publicField(this, "
|
|
354
|
-
__publicField(this, "
|
|
355
|
-
this
|
|
356
|
-
this.
|
|
405
|
+
const _DataFilter = class _DataFilter {
|
|
406
|
+
constructor(rules) {
|
|
407
|
+
__publicField(this, "filters", /* @__PURE__ */ new Map());
|
|
408
|
+
__publicField(this, "customDataSelectorFns", {});
|
|
409
|
+
__publicField(this, "filterMapping", {});
|
|
410
|
+
this.rules = rules;
|
|
411
|
+
this.registerFilters(rules.customDataSelectorFns);
|
|
412
|
+
this.applyCSSFilters();
|
|
357
413
|
}
|
|
358
|
-
|
|
359
|
-
|
|
414
|
+
static isFiltered(el2) {
|
|
415
|
+
return el2.className.includes("filter-");
|
|
360
416
|
}
|
|
361
|
-
|
|
362
|
-
this.
|
|
363
|
-
|
|
417
|
+
applyCSSFilters(wrapper) {
|
|
418
|
+
this.filters.forEach((_2, name) => {
|
|
419
|
+
const cssRule = `.filter-${name} { display: none !important; }`;
|
|
420
|
+
if (wrapper) {
|
|
421
|
+
GM_addStyle(wrapper(cssRule));
|
|
422
|
+
} else {
|
|
423
|
+
GM_addStyle(cssRule);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
364
426
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if (
|
|
368
|
-
this.
|
|
427
|
+
registerFilters(customFilters) {
|
|
428
|
+
customFilters.forEach((o) => {
|
|
429
|
+
if (typeof o === "string") {
|
|
430
|
+
this.customDataSelectorFns[o] = _DataFilter.customDataSelectorFnsDefault[o];
|
|
431
|
+
this.registerFilter(o);
|
|
432
|
+
} else {
|
|
433
|
+
const k2 = Object.keys(o)[0];
|
|
434
|
+
this.customDataSelectorFns[k2] = o[k2];
|
|
435
|
+
this.registerFilter(k2);
|
|
369
436
|
}
|
|
370
|
-
}
|
|
437
|
+
});
|
|
371
438
|
}
|
|
372
|
-
|
|
373
|
-
if (
|
|
374
|
-
|
|
439
|
+
customSelectorParser(name, selector) {
|
|
440
|
+
if ("handle" in selector) {
|
|
441
|
+
return selector;
|
|
442
|
+
} else {
|
|
443
|
+
return { handle: selector, deps: [name] };
|
|
444
|
+
}
|
|
375
445
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
446
|
+
registerFilter(customSelectorName) {
|
|
447
|
+
var _a3;
|
|
448
|
+
const handler = this.customSelectorParser(
|
|
449
|
+
customSelectorName,
|
|
450
|
+
this.customDataSelectorFns[customSelectorName]
|
|
451
|
+
);
|
|
452
|
+
const tag = `filter-${customSelectorName}`;
|
|
453
|
+
(_a3 = [customSelectorName, ...handler.deps || []]) == null ? void 0 : _a3.forEach((name) => {
|
|
454
|
+
Object.assign(this.filterMapping, { [name]: customSelectorName });
|
|
380
455
|
});
|
|
381
|
-
|
|
382
|
-
|
|
456
|
+
const fn2 = () => {
|
|
457
|
+
var _a4;
|
|
458
|
+
const preDefined = (_a4 = handler.$preDefine) == null ? void 0 : _a4.call(handler, this.rules.store.state);
|
|
459
|
+
return (v2) => {
|
|
460
|
+
const condition = handler.handle(v2, this.rules.store.state, preDefined);
|
|
461
|
+
return {
|
|
462
|
+
condition,
|
|
463
|
+
tag
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
this.filters.set(customSelectorName, fn2);
|
|
383
468
|
}
|
|
384
|
-
|
|
469
|
+
selectFilters(filters) {
|
|
470
|
+
const selectedFilters = Object.keys(filters).filter((k2) => k2 in this.filterMapping).map((k2) => this.filterMapping[k2]).map((k2) => this.filters.get(k2));
|
|
471
|
+
return selectedFilters;
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
__publicField(_DataFilter, "customDataSelectorFnsDefault", {
|
|
475
|
+
filterDuration: {
|
|
476
|
+
handle(el2, state, notInRange) {
|
|
477
|
+
return state.filterDuration && notInRange(el2.duration);
|
|
478
|
+
},
|
|
479
|
+
$preDefine: (state) => {
|
|
480
|
+
const from = state.filterDurationFrom;
|
|
481
|
+
const to2 = state.filterDurationTo;
|
|
482
|
+
function notInRange(d2) {
|
|
483
|
+
return d2 < from || d2 > to2;
|
|
484
|
+
}
|
|
485
|
+
return notInRange;
|
|
486
|
+
},
|
|
487
|
+
deps: ["filterDurationFrom", "filterDurationTo"]
|
|
488
|
+
},
|
|
489
|
+
filterExclude: {
|
|
490
|
+
handle(el2, state, searchFilter) {
|
|
491
|
+
if (!state.filterExclude) return false;
|
|
492
|
+
return !searchFilter.hasNone(el2.title);
|
|
493
|
+
},
|
|
494
|
+
$preDefine: (state) => new RegexFilter(state.filterExcludeWords),
|
|
495
|
+
deps: ["filterExcludeWords"]
|
|
496
|
+
},
|
|
497
|
+
filterInclude: {
|
|
498
|
+
handle(el2, state, searchFilter) {
|
|
499
|
+
if (!state.filterInclude) return false;
|
|
500
|
+
return !searchFilter.hasEvery(el2.title);
|
|
501
|
+
},
|
|
502
|
+
$preDefine: (state) => new RegexFilter(state.filterIncludeWords),
|
|
503
|
+
deps: ["filterIncludeWords"]
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
let DataFilter = _DataFilter;
|
|
385
507
|
class DataManager {
|
|
386
508
|
constructor(rules) {
|
|
387
509
|
__publicField(this, "data", /* @__PURE__ */ new Map());
|
|
@@ -477,29 +599,6 @@ class DataManager {
|
|
|
477
599
|
container.style.visibility = "visible";
|
|
478
600
|
}
|
|
479
601
|
}
|
|
480
|
-
function wait(milliseconds) {
|
|
481
|
-
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
482
|
-
}
|
|
483
|
-
const MOBILE_UA = {
|
|
484
|
-
"User-Agent": [
|
|
485
|
-
"Mozilla/5.0 (Linux; Android 10; K)",
|
|
486
|
-
"AppleWebKit/537.36 (KHTML, like Gecko)",
|
|
487
|
-
"Chrome/114.0.0.0 Mobile Safari/537.36"
|
|
488
|
-
].join(" ")
|
|
489
|
-
};
|
|
490
|
-
async function fetchWith(input, options) {
|
|
491
|
-
const requestInit = options.init || {};
|
|
492
|
-
if (options.mobile) {
|
|
493
|
-
Object.assign(requestInit, { headers: new Headers(MOBILE_UA) });
|
|
494
|
-
}
|
|
495
|
-
const r = await fetch(input, requestInit).then((r2) => r2);
|
|
496
|
-
if (options.type === "json") return await r.json();
|
|
497
|
-
if (options.type === "html") return parseHtml(await r.text());
|
|
498
|
-
return await r.text();
|
|
499
|
-
}
|
|
500
|
-
const fetchJson = (input) => fetchWith(input, { type: "json" });
|
|
501
|
-
const fetchHtml = (input) => fetchWith(input, { type: "html" });
|
|
502
|
-
const fetchText = (input) => fetchWith(input, { type: "text" });
|
|
503
602
|
class InfiniteScroller {
|
|
504
603
|
constructor(options) {
|
|
505
604
|
__publicField(this, "enabled", true);
|
|
@@ -1420,43 +1519,6 @@ class PaginationStrategy {
|
|
|
1420
1519
|
}
|
|
1421
1520
|
}
|
|
1422
1521
|
__publicField(PaginationStrategy, "_pathnameSelector", /\/(page\/)?\d+\/?$/);
|
|
1423
|
-
function formatTimeToHHMMSS(timeStr) {
|
|
1424
|
-
var _a3, _b2, _c2;
|
|
1425
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
1426
|
-
const h = ((_a3 = timeStr.match(/(\d+)\s*h/)) == null ? void 0 : _a3[1]) || "0";
|
|
1427
|
-
const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n/)) == null ? void 0 : _b2[1]) || "0";
|
|
1428
|
-
const s = ((_c2 = timeStr.match(/(\d+)\s*sec/)) == null ? void 0 : _c2[1]) || "0";
|
|
1429
|
-
return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
|
|
1430
|
-
}
|
|
1431
|
-
function timeToSeconds(timeStr) {
|
|
1432
|
-
const normalized = /[a-zA-Z]/.test(timeStr) ? formatTimeToHHMMSS(timeStr) : timeStr;
|
|
1433
|
-
return normalized.split(":").reverse().reduce((total, unit, index) => total + parseInt(unit, 10) * 60 ** index, 0);
|
|
1434
|
-
}
|
|
1435
|
-
function parseIntegerOr(n, or2) {
|
|
1436
|
-
const num = Number(n);
|
|
1437
|
-
return Number.isSafeInteger(num) ? num : or2;
|
|
1438
|
-
}
|
|
1439
|
-
function parseDataParams(str) {
|
|
1440
|
-
const paramsStr = decodeURI(str.trim()).split(";");
|
|
1441
|
-
return paramsStr.reduce(
|
|
1442
|
-
(acc, s) => {
|
|
1443
|
-
const parsed = s.match(/([+\w]+):([\w\- ]+)?/);
|
|
1444
|
-
if (parsed) {
|
|
1445
|
-
const [, key, value] = parsed;
|
|
1446
|
-
if (value) {
|
|
1447
|
-
key.split("+").forEach((p) => {
|
|
1448
|
-
acc[p] = value;
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
return acc;
|
|
1453
|
-
},
|
|
1454
|
-
{}
|
|
1455
|
-
);
|
|
1456
|
-
}
|
|
1457
|
-
function parseCssUrl(s) {
|
|
1458
|
-
return s.replace(/url\("|"\).*/g, "");
|
|
1459
|
-
}
|
|
1460
1522
|
class PaginationStrategyDataParams extends PaginationStrategy {
|
|
1461
1523
|
getPaginationLast() {
|
|
1462
1524
|
var _a3;
|
|
@@ -8411,68 +8473,6 @@ class RulesGlobal {
|
|
|
8411
8473
|
this.resetOn();
|
|
8412
8474
|
}
|
|
8413
8475
|
}
|
|
8414
|
-
function chunks(arr, size) {
|
|
8415
|
-
return Array.from(
|
|
8416
|
-
{ length: Math.ceil(arr.length / size) },
|
|
8417
|
-
(_2, i) => arr.slice(i * size, i * size + size)
|
|
8418
|
-
);
|
|
8419
|
-
}
|
|
8420
|
-
function* irange(start = 1, step = 1) {
|
|
8421
|
-
for (let i = start; ; i += step) {
|
|
8422
|
-
yield i;
|
|
8423
|
-
}
|
|
8424
|
-
}
|
|
8425
|
-
function range(size, start = 1, step = 1) {
|
|
8426
|
-
return irange(start, step).take(size).toArray();
|
|
8427
|
-
}
|
|
8428
|
-
function onPointerOverAndLeave(container, subjectSelector, onOver, onLeave) {
|
|
8429
|
-
let target;
|
|
8430
|
-
let onOverFinally;
|
|
8431
|
-
function handleLeaveEvent() {
|
|
8432
|
-
onLeave == null ? void 0 : onLeave(target);
|
|
8433
|
-
onOverFinally == null ? void 0 : onOverFinally();
|
|
8434
|
-
target = void 0;
|
|
8435
|
-
}
|
|
8436
|
-
function handleEvent(e) {
|
|
8437
|
-
const currentTarget = e.target;
|
|
8438
|
-
if (!subjectSelector(currentTarget) || target === currentTarget) return;
|
|
8439
|
-
target = currentTarget;
|
|
8440
|
-
const result = onOver(target);
|
|
8441
|
-
onOverFinally = result == null ? void 0 : result.onOverCallback;
|
|
8442
|
-
const leaveSubject = (result == null ? void 0 : result.leaveTarget) || target;
|
|
8443
|
-
leaveSubject.addEventListener("pointerleave", handleLeaveEvent, {
|
|
8444
|
-
once: true
|
|
8445
|
-
});
|
|
8446
|
-
}
|
|
8447
|
-
container.addEventListener("pointerover", handleEvent);
|
|
8448
|
-
}
|
|
8449
|
-
class Tick {
|
|
8450
|
-
constructor(delay, startImmediate = true) {
|
|
8451
|
-
__publicField(this, "tick");
|
|
8452
|
-
__publicField(this, "callbackFinal");
|
|
8453
|
-
this.delay = delay;
|
|
8454
|
-
this.startImmediate = startImmediate;
|
|
8455
|
-
}
|
|
8456
|
-
start(callback, callbackFinal) {
|
|
8457
|
-
this.stop();
|
|
8458
|
-
this.callbackFinal = callbackFinal;
|
|
8459
|
-
if (this.startImmediate) callback();
|
|
8460
|
-
this.tick = window.setInterval(callback, this.delay);
|
|
8461
|
-
}
|
|
8462
|
-
stop() {
|
|
8463
|
-
if (this.tick !== void 0) {
|
|
8464
|
-
clearInterval(this.tick);
|
|
8465
|
-
this.tick = void 0;
|
|
8466
|
-
}
|
|
8467
|
-
if (this.callbackFinal) {
|
|
8468
|
-
this.callbackFinal();
|
|
8469
|
-
this.callbackFinal = void 0;
|
|
8470
|
-
}
|
|
8471
|
-
}
|
|
8472
|
-
}
|
|
8473
|
-
function circularShift(n, c = 6, s = 1) {
|
|
8474
|
-
return (n + s) % c || c;
|
|
8475
|
-
}
|
|
8476
8476
|
export {
|
|
8477
8477
|
DataManager,
|
|
8478
8478
|
InfiniteScroller,
|