domquery-com 1.0.4 → 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.
- package/README.md +1 -1
- package/domquery.js +216 -209
- package/domquery.min.js +59 -57
- package/package.json +1 -1
- package/src/select.js +1406 -1367
- package/src_min/select.min.js +180 -177
package/domquery.js
CHANGED
|
@@ -3303,19 +3303,23 @@ DomQuery.prototype = {
|
|
|
3303
3303
|
if (a.call(this.elements[b], b, this.elements[b])) return b;
|
|
3304
3304
|
return -1
|
|
3305
3305
|
},
|
|
3306
|
-
parent: function(a) {
|
|
3307
|
-
const
|
|
3308
|
-
this.elements.forEach(
|
|
3309
|
-
|
|
3310
|
-
!
|
|
3311
|
-
|
|
3306
|
+
parent: function(a, b, c) {
|
|
3307
|
+
const d = [];
|
|
3308
|
+
this.elements.forEach(f => {
|
|
3309
|
+
f = f.parentNode;
|
|
3310
|
+
!f || a &&
|
|
3311
|
+
!f.matches(a) || d.push(f)
|
|
3312
3312
|
});
|
|
3313
|
-
|
|
3313
|
+
let e = domquery([...(new Set(d))]);
|
|
3314
|
+
if ("string" === typeof b || "number" === typeof b) "first" === b ? e = e.eq(0) : "last" === b ? e = e.eq(-1) : "all" !== b && "number" === typeof b && (e = e.eq(b));
|
|
3315
|
+
"function" === typeof c && c.call(e, e);
|
|
3316
|
+
return e
|
|
3314
3317
|
},
|
|
3315
3318
|
parents: function(a, b) {
|
|
3319
|
+
"function" === typeof a && (b = a, a = null);
|
|
3316
3320
|
var c = [];
|
|
3317
3321
|
this.elements.forEach(function(e) {
|
|
3318
|
-
for (; e && e.parentNode && 1 === e.parentNode.nodeType;) e = e.parentNode, (!a || a && e.matches(a)) && c.push(e)
|
|
3322
|
+
for (; e && e.parentNode && 1 === e.parentNode.nodeType;) e = e.parentNode, (!a || "string" === typeof a && e.matches(a)) && c.push(e)
|
|
3319
3323
|
});
|
|
3320
3324
|
c = Array.from(new Set(c));
|
|
3321
3325
|
var d = this.endStack(c);
|
|
@@ -3327,8 +3331,7 @@ DomQuery.prototype = {
|
|
|
3327
3331
|
this.elements.forEach(function(c) {
|
|
3328
3332
|
for (c = c.nodeType === Node.TEXT_NODE ? c.parentNode : c; c && c !== document;) {
|
|
3329
3333
|
var d = c;
|
|
3330
|
-
if ("function" === typeof a ? a(d) : "string" === typeof a ? d.nodeType ===
|
|
3331
|
-
Node.ELEMENT_NODE && d.matches(a) : (Array.isArray(a) || a instanceof DomQuery) && (a instanceof DomQuery ? a.elements : a).includes(d)) {
|
|
3334
|
+
if ("function" === typeof a ? a(d) : "string" === typeof a ? d.nodeType === Node.ELEMENT_NODE && d.matches(a) : (Array.isArray(a) || a instanceof DomQuery) && (a instanceof DomQuery ? a.elements : a).includes(d)) {
|
|
3332
3335
|
b.push(c);
|
|
3333
3336
|
break
|
|
3334
3337
|
}
|
|
@@ -3340,14 +3343,14 @@ DomQuery.prototype = {
|
|
|
3340
3343
|
parentsUntil: function(a, b, c) {
|
|
3341
3344
|
let d = [];
|
|
3342
3345
|
"function" === typeof b && (c = b, b = null);
|
|
3343
|
-
a instanceof
|
|
3346
|
+
a instanceof
|
|
3347
|
+
DomQuery && (a = a.elements[0]);
|
|
3344
3348
|
this.elements.forEach(e => {
|
|
3345
3349
|
for (e = e.parentNode; e && 1 === e.nodeType;) {
|
|
3346
3350
|
if (a)
|
|
3347
3351
|
if ("string" === typeof a && e.matches(a)) break;
|
|
3348
3352
|
else if (a instanceof Element && e === a) break;
|
|
3349
|
-
if (!b || "string" === typeof b && e.matches(b)) d.push(e), "function" ===
|
|
3350
|
-
typeof c && c.call(e, e);
|
|
3353
|
+
if (!b || "string" === typeof b && e.matches(b)) d.push(e), "function" === typeof c && c.call(e, e);
|
|
3351
3354
|
e = e.parentNode
|
|
3352
3355
|
}
|
|
3353
3356
|
});
|
|
@@ -3358,7 +3361,8 @@ DomQuery.prototype = {
|
|
|
3358
3361
|
let c = [];
|
|
3359
3362
|
"function" === typeof a && (b = a, a = null);
|
|
3360
3363
|
this.elements.forEach(d => {
|
|
3361
|
-
(d = d.previousElementSibling) && (!a || "string" === typeof a && d.matches(a)) && (c.push(d),
|
|
3364
|
+
(d = d.previousElementSibling) && (!a || "string" === typeof a && d.matches(a)) && (c.push(d),
|
|
3365
|
+
"function" === typeof b && b.call(d, d))
|
|
3362
3366
|
});
|
|
3363
3367
|
return this.endStack(c)
|
|
3364
3368
|
},
|
|
@@ -3368,8 +3372,7 @@ DomQuery.prototype = {
|
|
|
3368
3372
|
this.elements.forEach(d => {
|
|
3369
3373
|
let e = [];
|
|
3370
3374
|
for (d = d.previousElementSibling; d;) {
|
|
3371
|
-
if (!a || "string" === typeof a && d.matches(a)) e.push(d),
|
|
3372
|
-
"function" === typeof b && b.call(d, d);
|
|
3375
|
+
if (!a || "string" === typeof a && d.matches(a)) e.push(d), "function" === typeof b && b.call(d, d);
|
|
3373
3376
|
d = d.previousElementSibling
|
|
3374
3377
|
}
|
|
3375
3378
|
c = c.concat(e)
|
|
@@ -3382,13 +3385,13 @@ DomQuery.prototype = {
|
|
|
3382
3385
|
this.elements.includes(d) && b.add(d)
|
|
3383
3386
|
});
|
|
3384
3387
|
let c = Array.from(b);
|
|
3385
|
-
"function" ===
|
|
3388
|
+
"function" ===
|
|
3389
|
+
typeof a ? c.sort((d, e) => {
|
|
3386
3390
|
d = d.compareDocumentPosition(e);
|
|
3387
3391
|
return d & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : d & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0
|
|
3388
3392
|
}).sort(a) : c.sort((d, e) => {
|
|
3389
3393
|
d = d.compareDocumentPosition(e);
|
|
3390
|
-
return d & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : d &
|
|
3391
|
-
Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0
|
|
3394
|
+
return d & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : d & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0
|
|
3392
3395
|
});
|
|
3393
3396
|
this.elements = c;
|
|
3394
3397
|
this.length = this.elements.length;
|
|
@@ -3398,7 +3401,8 @@ DomQuery.prototype = {
|
|
|
3398
3401
|
prevUntil: function(a, b) {
|
|
3399
3402
|
let c = [],
|
|
3400
3403
|
d;
|
|
3401
|
-
d = "function" === typeof a ? a : a instanceof Element ? f => f === a : "string" === typeof a ?
|
|
3404
|
+
d = "function" === typeof a ? a : a instanceof Element ? f => f === a : "string" === typeof a ?
|
|
3405
|
+
f => f.matches(a) : () => !1;
|
|
3402
3406
|
let e;
|
|
3403
3407
|
e = "function" === typeof b ? b : "string" === typeof b ? f => f.matches(b) : () => !0;
|
|
3404
3408
|
this.elements.forEach(f => {
|
|
@@ -3406,8 +3410,7 @@ DomQuery.prototype = {
|
|
|
3406
3410
|
});
|
|
3407
3411
|
return this.endStack(c)
|
|
3408
3412
|
},
|
|
3409
|
-
next: function(a,
|
|
3410
|
-
b = 1) {
|
|
3413
|
+
next: function(a, b = 1) {
|
|
3411
3414
|
return new this.constructor(this.elements.flatMap(c => {
|
|
3412
3415
|
const d = [];
|
|
3413
3416
|
c = c.nextElementSibling;
|
|
@@ -3421,7 +3424,8 @@ DomQuery.prototype = {
|
|
|
3421
3424
|
}))
|
|
3422
3425
|
},
|
|
3423
3426
|
nextAll: function(a, b = Infinity) {
|
|
3424
|
-
if ("number" !== typeof b ||
|
|
3427
|
+
if ("number" !== typeof b ||
|
|
3428
|
+
0 >= b) throw Error("Limit must be a positive number");
|
|
3425
3429
|
return new this.constructor(this.elements.flatMap(c => {
|
|
3426
3430
|
const d = [];
|
|
3427
3431
|
for (c = c.nextElementSibling; c && d.length < b;) a && !c.matches(a) || d.push(c), c = c.nextElementSibling;
|
|
@@ -3443,8 +3447,7 @@ DomQuery.prototype = {
|
|
|
3443
3447
|
function e(n) {
|
|
3444
3448
|
k || (k = n);
|
|
3445
3449
|
n -= k;
|
|
3446
|
-
var p =
|
|
3447
|
-
n / b;
|
|
3450
|
+
var p = n / b;
|
|
3448
3451
|
p = l + (a - l) * (.5 > p ? 2 * p * p : -1 + (4 - 2 * p) * p);
|
|
3449
3452
|
h ? window.scrollTo(d ? p : 0, d ? 0 : p) : d ? f[0].scrollLeft = p : f[0].scrollTop = p;
|
|
3450
3453
|
n < b ? requestAnimationFrame(e) : (h ? window.scrollTo(d ? a : 0, d ? 0 : a) : d ? f[0].scrollLeft = a : f[0].scrollTop = a, "function" === typeof c && c())
|
|
@@ -3455,9 +3458,9 @@ DomQuery.prototype = {
|
|
|
3455
3458
|
g = h ? d ? window.scrollX : window.scrollY : d ? f[0].scrollLeft : f[0].scrollTop;
|
|
3456
3459
|
if (void 0 === a) return g;
|
|
3457
3460
|
if ("first" === a || 0 === a || "0" === a) a = 0;
|
|
3458
|
-
else if ("last" ===
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
+
else if ("last" === a) a = h ? d ? document.documentElement.scrollWidth - window.innerWidth : document.documentElement.scrollHeight - window.innerHeight : d ? f[0].scrollWidth - f[0].clientWidth : f[0].scrollHeight - f[0].clientHeight;
|
|
3462
|
+
else if ("string" === typeof a && (a.startsWith("+=") ||
|
|
3463
|
+
a.startsWith("-="))) {
|
|
3461
3464
|
const n = parseFloat(a.substring(2));
|
|
3462
3465
|
a = g + (a.startsWith("+=") ? n : -n)
|
|
3463
3466
|
} else a = Number(a);
|
|
@@ -3470,44 +3473,44 @@ DomQuery.prototype = {
|
|
|
3470
3473
|
h ? window.scrollTo(d ? a : 0, d ? 0 : a) : d ? f[0].scrollLeft = a : f[0].scrollTop = a;
|
|
3471
3474
|
"function" === typeof c && c()
|
|
3472
3475
|
},
|
|
3473
|
-
scrollLeft: function(a,
|
|
3474
|
-
b, c) {
|
|
3476
|
+
scrollLeft: function(a, b, c) {
|
|
3475
3477
|
if (!this.elements || !this.elements[0]) return "function" === typeof c && c(), this;
|
|
3476
3478
|
const d = this.elements[0];
|
|
3477
|
-
return void 0 === a ? d === document || d === window ? window.pageXOffset || document.documentElement.scrollLeft : d.scrollLeft : this._scrollLR(a,
|
|
3479
|
+
return void 0 === a ? d === document || d === window ? window.pageXOffset || document.documentElement.scrollLeft : d.scrollLeft : this._scrollLR(a,
|
|
3480
|
+
b, c, !0)
|
|
3478
3481
|
},
|
|
3479
3482
|
scroll: function(a) {
|
|
3480
3483
|
if (!this.elements || !this.elements.length) return this;
|
|
3481
3484
|
const b = this;
|
|
3482
3485
|
this.elements.forEach(c => {
|
|
3483
3486
|
c === document ? window.addEventListener("scroll", d => {
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
})
|
|
3487
|
+
a.call(window, d, b)
|
|
3488
|
+
}) : c instanceof Window ? window.addEventListener("scroll", d => {
|
|
3489
|
+
a.call(window, d, b)
|
|
3490
|
+
}) : c instanceof Element && c.addEventListener("scroll", d => {
|
|
3491
|
+
a.call(c, d, b)
|
|
3492
|
+
})
|
|
3491
3493
|
});
|
|
3492
3494
|
return this
|
|
3493
3495
|
},
|
|
3494
3496
|
scrollTop: function(a, b, c) {
|
|
3495
3497
|
if (!this.elements || !this.elements[0]) return "function" === typeof c && c(), this;
|
|
3496
3498
|
const d = this.elements[0];
|
|
3497
|
-
return void 0 === a ? d ===
|
|
3499
|
+
return void 0 === a ? d ===
|
|
3500
|
+
document || d === window ? window.pageYOffset || document.documentElement.scrollTop : d.scrollTop : this._scrollLR(a, b, c, !1)
|
|
3498
3501
|
},
|
|
3499
3502
|
scrollTo: function(a, b, c) {
|
|
3500
3503
|
return this.elements && this.elements.length ? new Promise(d => {
|
|
3501
3504
|
const e = this.elements[0],
|
|
3502
3505
|
f = this,
|
|
3503
|
-
h = () => e === window || e === document.documentElement ?
|
|
3504
|
-
window.pageYOffset || document.documentElement.scrollTop : e.scrollTop,
|
|
3506
|
+
h = () => e === window || e === document.documentElement ? window.pageYOffset || document.documentElement.scrollTop : e.scrollTop,
|
|
3505
3507
|
g = m => {
|
|
3506
3508
|
e === window || e === document.documentElement ? window.scrollTo(0, m) : e.scrollTop = m
|
|
3507
3509
|
},
|
|
3508
3510
|
l = h();
|
|
3509
3511
|
let k;
|
|
3510
|
-
k = "string" === typeof a ? a.startsWith("+") || a.startsWith("-") ? l + parseInt(a) :
|
|
3512
|
+
k = "string" === typeof a ? a.startsWith("+") || a.startsWith("-") ? l + parseInt(a) :
|
|
3513
|
+
parseInt(a) : parseInt(a);
|
|
3511
3514
|
if (isNaN(k)) console.warn("Invalid scroll target value"), d();
|
|
3512
3515
|
else if (b) {
|
|
3513
3516
|
var n, p = h(),
|
|
@@ -3519,8 +3522,7 @@ DomQuery.prototype = {
|
|
|
3519
3522
|
requestAnimationFrame(t)
|
|
3520
3523
|
} else {
|
|
3521
3524
|
try {
|
|
3522
|
-
"scrollBehavior" in
|
|
3523
|
-
document.documentElement.style ? e === window || e === document.documentElement ? window.scrollTo({
|
|
3525
|
+
"scrollBehavior" in document.documentElement.style ? e === window || e === document.documentElement ? window.scrollTo({
|
|
3524
3526
|
top: k,
|
|
3525
3527
|
behavior: "smooth"
|
|
3526
3528
|
}) : e.scrollTo({
|
|
@@ -3530,7 +3532,8 @@ DomQuery.prototype = {
|
|
|
3530
3532
|
} catch (m) {
|
|
3531
3533
|
g(k)
|
|
3532
3534
|
}
|
|
3533
|
-
"function" === typeof c && c.call(e,
|
|
3535
|
+
"function" === typeof c && c.call(e,
|
|
3536
|
+
f);
|
|
3534
3537
|
d()
|
|
3535
3538
|
}
|
|
3536
3539
|
}) : Promise.resolve()
|
|
@@ -3546,12 +3549,12 @@ DomQuery.prototype = {
|
|
|
3546
3549
|
});
|
|
3547
3550
|
e.dispatchEvent(f)
|
|
3548
3551
|
} catch (f) {
|
|
3549
|
-
console.warn(`Failed to trigger ${a} event on element`,
|
|
3550
|
-
e, f)
|
|
3552
|
+
console.warn(`Failed to trigger ${a} event on element`, e, f)
|
|
3551
3553
|
}
|
|
3552
3554
|
}), this;
|
|
3553
3555
|
void 0 !== b && "function" !== typeof b && "string" !== typeof b && console.warn("Warning: scallback should be a function, a string, or undefined");
|
|
3554
|
-
"string" === typeof b && "function" !==
|
|
3556
|
+
"string" === typeof b && "function" !==
|
|
3557
|
+
typeof c && console.warn("Warning: callback should be a function when selector is provided");
|
|
3555
3558
|
d = {
|
|
3556
3559
|
passive: !1,
|
|
3557
3560
|
capture: !1,
|
|
@@ -3587,13 +3590,13 @@ DomQuery.prototype = {
|
|
|
3587
3590
|
e.addEventListener(a, k, h)
|
|
3588
3591
|
};
|
|
3589
3592
|
if ("function" === typeof b) f(b);
|
|
3590
|
-
else if ("string" ===
|
|
3591
|
-
typeof b && "function" === typeof c) f(g => {
|
|
3593
|
+
else if ("string" === typeof b && "function" === typeof c) f(g => {
|
|
3592
3594
|
try {
|
|
3593
3595
|
const l = g.target.closest(b);
|
|
3594
3596
|
if (l && e.contains(l)) {
|
|
3595
3597
|
let k = [g];
|
|
3596
|
-
g.detail && Array.isArray(g.detail) ? k = k.concat(g.detail) : null !== g.detail &&
|
|
3598
|
+
g.detail && Array.isArray(g.detail) ? k = k.concat(g.detail) : null !== g.detail &&
|
|
3599
|
+
void 0 !== g.detail && k.push(g.detail);
|
|
3597
3600
|
c.apply(l, k)
|
|
3598
3601
|
}
|
|
3599
3602
|
} catch (l) {
|
|
@@ -3609,42 +3612,41 @@ DomQuery.prototype = {
|
|
|
3609
3612
|
return this
|
|
3610
3613
|
},
|
|
3611
3614
|
off: function(a, b) {
|
|
3612
|
-
this._Queue =
|
|
3613
|
-
this.
|
|
3614
|
-
|
|
3615
|
-
if (
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
});
|
|
3615
|
+
this._Queue = this._Queue.then(() => {
|
|
3616
|
+
this.elements.forEach(c => {
|
|
3617
|
+
if (c._eventHandlers)
|
|
3618
|
+
if ("object" === typeof a && void 0 === b)
|
|
3619
|
+
for (var d in a) this.off.call(this, d, a[d]);
|
|
3620
|
+
else if (d = a ? "string" ===
|
|
3621
|
+
typeof a ? a.split(" ") : [a] : null) {
|
|
3622
|
+
let e = d.filter(h => "string" === typeof h && h.startsWith(".")).map(h => h.slice(1)),
|
|
3623
|
+
f = d.filter(h => "string" === typeof h && !h.startsWith("."));
|
|
3624
|
+
Object.keys(c._eventHandlers).forEach(h => {
|
|
3625
|
+
if (0 === f.length || f.includes(h)) c._eventHandlers[h] = c._eventHandlers[h].filter(g => {
|
|
3626
|
+
let l = (0 === e.length || e.includes(g.namespace)) && (!b || g.selector === b || g.originalHandler === b);
|
|
3627
|
+
if (l) {
|
|
3628
|
+
const k = {
|
|
3629
|
+
passive: ["scroll", "touchstart", "touchmove", "touchend"].includes(h),
|
|
3630
|
+
capture: !0
|
|
3631
|
+
};
|
|
3632
|
+
c.removeEventListener(h, g.handler,
|
|
3633
|
+
k)
|
|
3634
|
+
}
|
|
3635
|
+
return !l
|
|
3636
|
+
}), 0 === c._eventHandlers[h].length && delete c._eventHandlers[h]
|
|
3637
|
+
});
|
|
3638
|
+
0 === Object.keys(c._eventHandlers).length && delete c._eventHandlers
|
|
3639
|
+
} else Object.keys(c._eventHandlers).forEach(e => {
|
|
3640
|
+
c._eventHandlers[e].forEach(f => {
|
|
3641
|
+
const h = {
|
|
3642
|
+
passive: ["scroll", "touchstart", "touchmove", "touchend"].includes(e),
|
|
3643
|
+
capture: !0
|
|
3644
|
+
};
|
|
3645
|
+
c.removeEventListener(e, f.handler, h)
|
|
3646
|
+
})
|
|
3647
|
+
}), delete c._eventHandlers
|
|
3648
|
+
})
|
|
3649
|
+
});
|
|
3648
3650
|
return this
|
|
3649
3651
|
},
|
|
3650
3652
|
on: function(a, b, c) {
|
|
@@ -3684,8 +3686,7 @@ DomQuery.prototype = {
|
|
|
3684
3686
|
d._eventHandlers[f].push({
|
|
3685
3687
|
namespace: h,
|
|
3686
3688
|
handler: e,
|
|
3687
|
-
selector: "string" === typeof b ?
|
|
3688
|
-
b : null,
|
|
3689
|
+
selector: "string" === typeof b ? b : null,
|
|
3689
3690
|
originalHandler: "function" === typeof b ? b : c
|
|
3690
3691
|
});
|
|
3691
3692
|
d.addEventListener(f, e, g)
|
|
@@ -3695,7 +3696,8 @@ DomQuery.prototype = {
|
|
|
3695
3696
|
return this
|
|
3696
3697
|
},
|
|
3697
3698
|
trigger: function(a, b = {}, c) {
|
|
3698
|
-
this._Queue && "function" === typeof this._Queue.then || (this._Queue =
|
|
3699
|
+
this._Queue && "function" === typeof this._Queue.then || (this._Queue =
|
|
3700
|
+
Promise.resolve());
|
|
3699
3701
|
"function" === typeof b && (c = b, b = {});
|
|
3700
3702
|
this._Queue = this._Queue.then(() => new Promise(d => {
|
|
3701
3703
|
if ("function" === typeof a) a.call(this, this);
|
|
@@ -3707,8 +3709,7 @@ DomQuery.prototype = {
|
|
|
3707
3709
|
cancelable: !0,
|
|
3708
3710
|
detail: null
|
|
3709
3711
|
};
|
|
3710
|
-
if ("string" === typeof b) e =
|
|
3711
|
-
document.querySelectorAll(b);
|
|
3712
|
+
if ("string" === typeof b) e = document.querySelectorAll(b);
|
|
3712
3713
|
else if (Array.isArray(b)) f.detail = b;
|
|
3713
3714
|
else if ("object" === typeof b && null !== b) f = Object.assign(f, b);
|
|
3714
3715
|
else if (void 0 !== b && "function" !== typeof b) {
|
|
@@ -3725,8 +3726,7 @@ DomQuery.prototype = {
|
|
|
3725
3726
|
} else g = null !== g.detail ? new CustomEvent(a, g) : new Event(a, g);
|
|
3726
3727
|
!1 === h.dispatchEvent(g) && (g.preventDefault(), g.stopPropagation())
|
|
3727
3728
|
});
|
|
3728
|
-
"function" === typeof c &&
|
|
3729
|
-
c.call(this, this)
|
|
3729
|
+
"function" === typeof c && c.call(this, this)
|
|
3730
3730
|
}
|
|
3731
3731
|
d()
|
|
3732
3732
|
}));
|
|
@@ -3764,11 +3764,11 @@ DomQuery.prototype = {
|
|
|
3764
3764
|
a.split(/\s+/).forEach(d => {
|
|
3765
3765
|
this.elements.forEach(e => {
|
|
3766
3766
|
e instanceof Element && e._eventHandlers?.[d] && (e._eventHandlers[d] = e._eventHandlers[d].filter(f => {
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3767
|
+
let h = !1;
|
|
3768
|
+
"function" === typeof b ? h = f.handler === b : "string" === typeof b && "function" === typeof c ? h = f.handler.toString().includes(b) && f.handler.toString().includes(c.toString()) : void 0 === b && "function" === typeof c ? h = f.handler === c : b || c || (h = !0);
|
|
3769
|
+
return h ? (e.removeEventListener(d, f.wrappedHandler, f.options), !1) : !0
|
|
3770
|
+
}), 0 === e._eventHandlers[d].length && delete e._eventHandlers[d], 0 === Object.keys(e._eventHandlers).length &&
|
|
3771
|
+
delete e._eventHandlers)
|
|
3772
3772
|
})
|
|
3773
3773
|
});
|
|
3774
3774
|
return this
|
|
@@ -3777,8 +3777,7 @@ DomQuery.prototype = {
|
|
|
3777
3777
|
return this.mouse_event("blur", a, b, c)
|
|
3778
3778
|
},
|
|
3779
3779
|
focus: function(a, b, c) {
|
|
3780
|
-
return "function" === typeof a || "string" === typeof a && "function" === typeof b ? this.mouse_event("focus", a,
|
|
3781
|
-
b, c) : this
|
|
3780
|
+
return "function" === typeof a || "string" === typeof a && "function" === typeof b ? this.mouse_event("focus", a, b, c) : this
|
|
3782
3781
|
},
|
|
3783
3782
|
focusin: function(a, b, c) {
|
|
3784
3783
|
return this.mouse_event("focusin", a, b, c)
|
|
@@ -3792,7 +3791,8 @@ DomQuery.prototype = {
|
|
|
3792
3791
|
submit: function(a, b, c) {
|
|
3793
3792
|
return this.mouse_event("submit", a, b, c)
|
|
3794
3793
|
},
|
|
3795
|
-
click: function(a,
|
|
3794
|
+
click: function(a,
|
|
3795
|
+
b, c) {
|
|
3796
3796
|
return this.mouse_event("click", a, b, c)
|
|
3797
3797
|
},
|
|
3798
3798
|
dblclick: function(a, b, c) {
|
|
@@ -3802,8 +3802,7 @@ DomQuery.prototype = {
|
|
|
3802
3802
|
return this.mouse_event("contextmenu", a, b, c)
|
|
3803
3803
|
},
|
|
3804
3804
|
keydown: function(a, b, c) {
|
|
3805
|
-
return this.mouse_event("keydown",
|
|
3806
|
-
a, b, c)
|
|
3805
|
+
return this.mouse_event("keydown", a, b, c)
|
|
3807
3806
|
},
|
|
3808
3807
|
keypress: function(a, b, c) {
|
|
3809
3808
|
return this.mouse_event("keypress", a, b, c)
|
|
@@ -3815,7 +3814,8 @@ DomQuery.prototype = {
|
|
|
3815
3814
|
return this.mouse_event("input", a, b, c)
|
|
3816
3815
|
},
|
|
3817
3816
|
reset: function(a, b, c) {
|
|
3818
|
-
return this.mouse_event("reset", a,
|
|
3817
|
+
return this.mouse_event("reset", a,
|
|
3818
|
+
b, c)
|
|
3819
3819
|
},
|
|
3820
3820
|
mousedown: function(a, b, c) {
|
|
3821
3821
|
return this.mouse_event("mousedown", a, b, c)
|
|
@@ -3827,8 +3827,7 @@ DomQuery.prototype = {
|
|
|
3827
3827
|
return this.mouse_event("mouseleave", a, b, c)
|
|
3828
3828
|
},
|
|
3829
3829
|
mousemove: function(a, b, c) {
|
|
3830
|
-
return this.mouse_event("mousemove",
|
|
3831
|
-
a, b, c)
|
|
3830
|
+
return this.mouse_event("mousemove", a, b, c)
|
|
3832
3831
|
},
|
|
3833
3832
|
mouseout: function(a, b, c) {
|
|
3834
3833
|
return this.mouse_event("mouseout", a, b, c)
|
|
@@ -3839,13 +3838,13 @@ DomQuery.prototype = {
|
|
|
3839
3838
|
mouseover: function(a, b, c) {
|
|
3840
3839
|
return this.mouse_event("mouseover", a, b, c)
|
|
3841
3840
|
},
|
|
3842
|
-
hover: function(a,
|
|
3841
|
+
hover: function(a,
|
|
3842
|
+
b, c, d) {
|
|
3843
3843
|
"function" === typeof a ? (this.mouse_event("mouseenter", a, null, d), this.mouse_event("mouseleave", b || a, null, d)) : (this.mouse_event("mouseenter", a, b, d), this.mouse_event("mouseleave", a, c || b, d));
|
|
3844
3844
|
return this
|
|
3845
3845
|
},
|
|
3846
3846
|
dragstart: function(a, b, c) {
|
|
3847
|
-
return this.mouse_event("dragstart", a, b,
|
|
3848
|
-
c)
|
|
3847
|
+
return this.mouse_event("dragstart", a, b, c)
|
|
3849
3848
|
},
|
|
3850
3849
|
drag: function(a, b, c) {
|
|
3851
3850
|
return this.mouse_event("drag", a, b, c)
|
|
@@ -3857,7 +3856,8 @@ DomQuery.prototype = {
|
|
|
3857
3856
|
return this.mouse_event("drop", a, b, c)
|
|
3858
3857
|
},
|
|
3859
3858
|
animationstart: function(a, b, c) {
|
|
3860
|
-
return this.mouse_event("animationstart",
|
|
3859
|
+
return this.mouse_event("animationstart",
|
|
3860
|
+
a, b, c)
|
|
3861
3861
|
},
|
|
3862
3862
|
animationend: function(a, b, c) {
|
|
3863
3863
|
return this.mouse_event("animationend", a, b, c)
|
|
@@ -3866,8 +3866,7 @@ DomQuery.prototype = {
|
|
|
3866
3866
|
return this.mouse_event("animationiteration", a, b, c)
|
|
3867
3867
|
},
|
|
3868
3868
|
animationcancel: function(a, b, c) {
|
|
3869
|
-
return this.mouse_event("animationcancel",
|
|
3870
|
-
a, b, c)
|
|
3869
|
+
return this.mouse_event("animationcancel", a, b, c)
|
|
3871
3870
|
},
|
|
3872
3871
|
transitionend: function(a, b, c) {
|
|
3873
3872
|
return this.mouse_event("transitionend", a, b, c)
|
|
@@ -3878,7 +3877,8 @@ DomQuery.prototype = {
|
|
|
3878
3877
|
gotpointercapture: function(a, b, c) {
|
|
3879
3878
|
return this.mouse_event("gotpointercapture", a, b, c)
|
|
3880
3879
|
},
|
|
3881
|
-
lostpointercapture: function(a,
|
|
3880
|
+
lostpointercapture: function(a,
|
|
3881
|
+
b, c) {
|
|
3882
3882
|
return this.mouse_event("lostpointercapture", a, b, c)
|
|
3883
3883
|
},
|
|
3884
3884
|
touchstart: function(a, b, c) {
|
|
@@ -3888,8 +3888,7 @@ DomQuery.prototype = {
|
|
|
3888
3888
|
return this.mouse_event("touchmove", a, b, c)
|
|
3889
3889
|
},
|
|
3890
3890
|
touchend: function(a, b, c) {
|
|
3891
|
-
return this.mouse_event("touchend",
|
|
3892
|
-
a, b, c)
|
|
3891
|
+
return this.mouse_event("touchend", a, b, c)
|
|
3893
3892
|
},
|
|
3894
3893
|
touchcancel: function(a, b, c) {
|
|
3895
3894
|
return this.mouse_event("touchcancel", a, b, c)
|
|
@@ -3900,7 +3899,8 @@ DomQuery.prototype = {
|
|
|
3900
3899
|
pointermove: function(a, b, c) {
|
|
3901
3900
|
return this.mouse_event("pointermove", a, b, c)
|
|
3902
3901
|
},
|
|
3903
|
-
pointerup: function(a,
|
|
3902
|
+
pointerup: function(a,
|
|
3903
|
+
b, c) {
|
|
3904
3904
|
return this.mouse_event("pointerup", a, b, c)
|
|
3905
3905
|
},
|
|
3906
3906
|
pointercancel: function(a, b, c) {
|
|
@@ -3910,8 +3910,7 @@ DomQuery.prototype = {
|
|
|
3910
3910
|
return this.mouse_event("pointerenter", a, b, c)
|
|
3911
3911
|
},
|
|
3912
3912
|
pointerleave: function(a, b, c) {
|
|
3913
|
-
return this.mouse_event("pointerleave",
|
|
3914
|
-
a, b, c)
|
|
3913
|
+
return this.mouse_event("pointerleave", a, b, c)
|
|
3915
3914
|
},
|
|
3916
3915
|
pointerover: function(a, b, c) {
|
|
3917
3916
|
return this.mouse_event("pointerover", a, b, c)
|
|
@@ -3922,7 +3921,8 @@ DomQuery.prototype = {
|
|
|
3922
3921
|
error: function(a, b, c) {
|
|
3923
3922
|
return this.mouse_event("error", a, b, c)
|
|
3924
3923
|
},
|
|
3925
|
-
abort: function(a,
|
|
3924
|
+
abort: function(a,
|
|
3925
|
+
b, c) {
|
|
3926
3926
|
return this.mouse_event("abort", a, b, c)
|
|
3927
3927
|
},
|
|
3928
3928
|
transitionrun: function(a) {
|
|
@@ -3934,8 +3934,7 @@ DomQuery.prototype = {
|
|
|
3934
3934
|
transitioncancel: function(a) {
|
|
3935
3935
|
return this.mouse_event("transitioncancel", a)
|
|
3936
3936
|
},
|
|
3937
|
-
play: function(a,
|
|
3938
|
-
b) {
|
|
3937
|
+
play: function(a, b) {
|
|
3939
3938
|
return this.mouse_event("play", a, b)
|
|
3940
3939
|
},
|
|
3941
3940
|
pause: function(a, b) {
|
|
@@ -3945,7 +3944,8 @@ DomQuery.prototype = {
|
|
|
3945
3944
|
return this.mouse_event("ended", a, b)
|
|
3946
3945
|
},
|
|
3947
3946
|
volumechange: function(a, b) {
|
|
3948
|
-
return this.mouse_event("volumechange",
|
|
3947
|
+
return this.mouse_event("volumechange",
|
|
3948
|
+
a, b)
|
|
3949
3949
|
},
|
|
3950
3950
|
timeupdate: function(a, b) {
|
|
3951
3951
|
return this.mouse_event("timeupdate", a, b)
|
|
@@ -3963,10 +3963,9 @@ DomQuery.prototype = {
|
|
|
3963
3963
|
return this
|
|
3964
3964
|
},
|
|
3965
3965
|
deviceorientation: function(a) {
|
|
3966
|
-
window.addEventListener("deviceorientation",
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
});
|
|
3966
|
+
window.addEventListener("deviceorientation", function(b) {
|
|
3967
|
+
a(b)
|
|
3968
|
+
});
|
|
3970
3969
|
return this
|
|
3971
3970
|
},
|
|
3972
3971
|
beforeunload: function(a) {
|
|
@@ -3976,9 +3975,10 @@ DomQuery.prototype = {
|
|
|
3976
3975
|
return this
|
|
3977
3976
|
},
|
|
3978
3977
|
hashchange: function(a) {
|
|
3979
|
-
window.addEventListener("hashchange",
|
|
3980
|
-
|
|
3981
|
-
|
|
3978
|
+
window.addEventListener("hashchange",
|
|
3979
|
+
function(b) {
|
|
3980
|
+
a(b)
|
|
3981
|
+
});
|
|
3982
3982
|
return this
|
|
3983
3983
|
},
|
|
3984
3984
|
popstate: function(a) {
|
|
@@ -4000,8 +4000,7 @@ DomQuery.prototype = {
|
|
|
4000
4000
|
return this
|
|
4001
4001
|
},
|
|
4002
4002
|
end: function() {
|
|
4003
|
-
return this._prevObject ?
|
|
4004
|
-
this._prevObject : this
|
|
4003
|
+
return this._prevObject ? this._prevObject : this
|
|
4005
4004
|
},
|
|
4006
4005
|
endStack: function(a) {
|
|
4007
4006
|
a = new DomQuery(a);
|
|
@@ -4011,7 +4010,8 @@ DomQuery.prototype = {
|
|
|
4011
4010
|
offsetParent: function(a) {
|
|
4012
4011
|
let b = [];
|
|
4013
4012
|
this.elements.forEach(d => {
|
|
4014
|
-
(d = d.offsetParent) ||
|
|
4013
|
+
(d = d.offsetParent) ||
|
|
4014
|
+
(d = document.body || document.documentElement);
|
|
4015
4015
|
b.push(d)
|
|
4016
4016
|
});
|
|
4017
4017
|
let c = this.endStack(b);
|
|
@@ -4027,16 +4027,16 @@ DomQuery.prototype = {
|
|
|
4027
4027
|
return this
|
|
4028
4028
|
},
|
|
4029
4029
|
selectionchange: function(a) {
|
|
4030
|
-
document.addEventListener("selectionchange",
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
});
|
|
4030
|
+
document.addEventListener("selectionchange", function(b) {
|
|
4031
|
+
a(b)
|
|
4032
|
+
});
|
|
4034
4033
|
return this
|
|
4035
4034
|
},
|
|
4036
4035
|
fullscreenchange: function(a) {
|
|
4037
|
-
document.addEventListener("fullscreenchange",
|
|
4038
|
-
|
|
4039
|
-
|
|
4036
|
+
document.addEventListener("fullscreenchange",
|
|
4037
|
+
function(b) {
|
|
4038
|
+
a(b)
|
|
4039
|
+
});
|
|
4040
4040
|
return this
|
|
4041
4041
|
},
|
|
4042
4042
|
readystatechange: function(a) {
|
|
@@ -4054,8 +4054,7 @@ DomQuery.prototype = {
|
|
|
4054
4054
|
var f = function(h) {
|
|
4055
4055
|
var g = e.querySelectorAll(a);
|
|
4056
4056
|
let l = h.target;
|
|
4057
|
-
for (; l && l !==
|
|
4058
|
-
e;) {
|
|
4057
|
+
for (; l && l !== e;) {
|
|
4059
4058
|
if (Array.from(g).includes(l)) {
|
|
4060
4059
|
g = {
|
|
4061
4060
|
type: h.type.replace(/^focusin$/, "focus").replace(/^focusout$/, "blur"),
|
|
@@ -4079,7 +4078,8 @@ DomQuery.prototype = {
|
|
|
4079
4078
|
b.forEach(h => {
|
|
4080
4079
|
const [g, l] = h.split(".");
|
|
4081
4080
|
h = "focus" === g ? "focusin" : "blur" === g ? "focusout" : g;
|
|
4082
|
-
e.addEventListener(h,
|
|
4081
|
+
e.addEventListener(h,
|
|
4082
|
+
f, d.capture);
|
|
4083
4083
|
e.delegatedEvents || (e.delegatedEvents = {});
|
|
4084
4084
|
e.delegatedEvents[h] || (e.delegatedEvents[h] = []);
|
|
4085
4085
|
e.delegatedEvents[h].push({
|
|
@@ -4099,15 +4099,15 @@ DomQuery.prototype = {
|
|
|
4099
4099
|
"object" !== typeof b || Array.isArray(b) || (c = b, b = Object.keys(c));
|
|
4100
4100
|
Array.isArray(b) || (b = b ? b.split(" ") : null);
|
|
4101
4101
|
this.elements.forEach(d => {
|
|
4102
|
-
if (d instanceof Element &&
|
|
4103
|
-
d.delegatedEvents) {
|
|
4102
|
+
if (d instanceof Element && d.delegatedEvents) {
|
|
4104
4103
|
var e = (f, h) => {
|
|
4105
4104
|
const g = "focus" === f ? "focusin" : "blur" === f ? "focusout" : f;
|
|
4106
|
-
d.delegatedEvents[g] &&
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4105
|
+
d.delegatedEvents[g] &&
|
|
4106
|
+
(d.delegatedEvents[g] = d.delegatedEvents[g].filter(l => {
|
|
4107
|
+
const k = (!a || a === l.selector) && (!h || h === l.namespace) && (!c || c === l.callback);
|
|
4108
|
+
k && d.removeEventListener(g, l.handler, l.options.capture);
|
|
4109
|
+
return !k
|
|
4110
|
+
}), 0 === d.delegatedEvents[g].length && delete d.delegatedEvents[g])
|
|
4111
4111
|
};
|
|
4112
4112
|
b ? b.forEach(f => {
|
|
4113
4113
|
const [h, g] = f.split(".");
|
|
@@ -4115,16 +4115,16 @@ DomQuery.prototype = {
|
|
|
4115
4115
|
}) : Object.keys(d.delegatedEvents).forEach(f => {
|
|
4116
4116
|
e(f)
|
|
4117
4117
|
});
|
|
4118
|
-
0 === Object.keys(d.delegatedEvents).length &&
|
|
4119
|
-
delete d.delegatedEvents
|
|
4118
|
+
0 === Object.keys(d.delegatedEvents).length && delete d.delegatedEvents
|
|
4120
4119
|
}
|
|
4121
4120
|
});
|
|
4122
4121
|
return this
|
|
4123
4122
|
},
|
|
4124
4123
|
visibilitychange: function(a) {
|
|
4125
|
-
document.addEventListener("visibilitychange",
|
|
4126
|
-
|
|
4127
|
-
|
|
4124
|
+
document.addEventListener("visibilitychange",
|
|
4125
|
+
function(b) {
|
|
4126
|
+
a(b)
|
|
4127
|
+
});
|
|
4128
4128
|
return this
|
|
4129
4129
|
},
|
|
4130
4130
|
online: function(a) {
|
|
@@ -4146,14 +4146,14 @@ DomQuery.prototype = {
|
|
|
4146
4146
|
return this
|
|
4147
4147
|
},
|
|
4148
4148
|
activate: function(a) {
|
|
4149
|
-
"serviceWorker" in navigator && navigator.serviceWorker.addEventListener("activate",
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
});
|
|
4149
|
+
"serviceWorker" in navigator && navigator.serviceWorker.addEventListener("activate", function(b) {
|
|
4150
|
+
a(b)
|
|
4151
|
+
});
|
|
4153
4152
|
return this
|
|
4154
4153
|
},
|
|
4155
4154
|
fetch: function(a) {
|
|
4156
|
-
"serviceWorker" in
|
|
4155
|
+
"serviceWorker" in
|
|
4156
|
+
navigator && navigator.serviceWorker.addEventListener("fetch", function(b) {
|
|
4157
4157
|
a(b)
|
|
4158
4158
|
});
|
|
4159
4159
|
return this
|
|
@@ -4188,9 +4188,9 @@ DomQuery.prototype = {
|
|
|
4188
4188
|
else if ("string" === typeof a) {
|
|
4189
4189
|
if ("" === a.trim()) return this;
|
|
4190
4190
|
c = ":first" === a ? 0 < b.length ? [b[0]] : [] : ":last" === a ? 0 < b.length ? [b[b.length - 1]] : [] : Array.from(document.querySelectorAll(a))
|
|
4191
|
-
} else if (a && "object" === typeof a && "length" in
|
|
4192
|
-
|
|
4193
|
-
|
|
4191
|
+
} else if (a && "object" === typeof a && "length" in a) c = Array.from(a);
|
|
4192
|
+
else return console.warn("Invalid selector provided to not() method"),
|
|
4193
|
+
this
|
|
4194
4194
|
} catch (e) {
|
|
4195
4195
|
return console.error("Error in not() method:", e), this
|
|
4196
4196
|
}
|
|
@@ -4207,12 +4207,12 @@ DomQuery.prototype = {
|
|
|
4207
4207
|
});
|
|
4208
4208
|
return "function" !== typeof a || 0 < b.length ? this.endStack(b) : this
|
|
4209
4209
|
} catch (b) {
|
|
4210
|
-
return console.error("Error in even() method:",
|
|
4211
|
-
b), this
|
|
4210
|
+
return console.error("Error in even() method:", b), this
|
|
4212
4211
|
}
|
|
4213
4212
|
},
|
|
4214
4213
|
odd: function(a) {
|
|
4215
|
-
if (0 === this.length) return console.warn("No elements selected for odd() method"),
|
|
4214
|
+
if (0 === this.length) return console.warn("No elements selected for odd() method"),
|
|
4215
|
+
this;
|
|
4216
4216
|
try {
|
|
4217
4217
|
const b = this.elements.filter((c, d) => {
|
|
4218
4218
|
const e = 0 !== d % 2;
|
|
@@ -4225,8 +4225,7 @@ DomQuery.prototype = {
|
|
|
4225
4225
|
},
|
|
4226
4226
|
nth: function(a, b) {
|
|
4227
4227
|
if (0 === this.length) return console.warn("No elements selected for nth() method"), this;
|
|
4228
|
-
if ("number" !== typeof a || 1 > a) return console.error("Invalid argument for nth() method. Expected a positive number."),
|
|
4229
|
-
this;
|
|
4228
|
+
if ("number" !== typeof a || 1 > a) return console.error("Invalid argument for nth() method. Expected a positive number."), this;
|
|
4230
4229
|
try {
|
|
4231
4230
|
const c = this.elements.filter((d, e) => {
|
|
4232
4231
|
const f = 0 === (e + 1) % a;
|
|
@@ -4245,7 +4244,8 @@ DomQuery.prototype = {
|
|
|
4245
4244
|
0 > a && (a = Math.max(0, this.length + a));
|
|
4246
4245
|
0 > b && (b = Math.max(0, this.length + b));
|
|
4247
4246
|
if (a > b) return this.endStack([]);
|
|
4248
|
-
const c = this.elements.slice(a,
|
|
4247
|
+
const c = this.elements.slice(a,
|
|
4248
|
+
b);
|
|
4249
4249
|
return this.endStack(c)
|
|
4250
4250
|
} catch (c) {
|
|
4251
4251
|
return console.error("Error in slice() method:", c), this
|
|
@@ -4264,7 +4264,8 @@ DomQuery.prototype = {
|
|
|
4264
4264
|
return b
|
|
4265
4265
|
}
|
|
4266
4266
|
this.elements.forEach(b => {
|
|
4267
|
-
b.nodeType === Node.ELEMENT_NODE ?
|
|
4267
|
+
b.nodeType === Node.ELEMENT_NODE ?
|
|
4268
|
+
a(b) : b.nodeType === Node.TEXT_NODE && (b.nodeValue = b.nodeValue.toUpperCase())
|
|
4268
4269
|
});
|
|
4269
4270
|
return this
|
|
4270
4271
|
},
|
|
@@ -4275,8 +4276,8 @@ DomQuery.prototype = {
|
|
|
4275
4276
|
if ("string" === typeof a) b = this.elements.filter(c => null !== c.querySelector(a));
|
|
4276
4277
|
else if (a instanceof Node) b = this.elements.filter(c => c.contains(a));
|
|
4277
4278
|
else if (a instanceof DomQuery) b = this.elements.filter(c => a.elements.some(d => c.contains(d)));
|
|
4278
|
-
else if ("function" === typeof a) b = this.elements.filter((c,
|
|
4279
|
-
d
|
|
4279
|
+
else if ("function" === typeof a) b = this.elements.filter((c, d) => a.call(c,
|
|
4280
|
+
d, c));
|
|
4280
4281
|
else return console.warn("Invalid selector provided to has() method"), this;
|
|
4281
4282
|
return this.endStack(b)
|
|
4282
4283
|
} catch (b) {
|
|
@@ -4285,8 +4286,8 @@ DomQuery.prototype = {
|
|
|
4285
4286
|
},
|
|
4286
4287
|
add: function(a) {
|
|
4287
4288
|
var b = [];
|
|
4288
|
-
"string" === typeof a ? "<" === a.trim().charAt(0) && ">" === a.trim().charAt(a.trim().length - 1) ? (b = document.createElement("template"), b.innerHTML = a.trim(), b = Array.from(b.content.childNodes)) : b = Array.from(document.querySelectorAll(a)) : a instanceof Element ? b = [a] : a instanceof NodeList || a instanceof HTMLCollection ?
|
|
4289
|
-
|
|
4289
|
+
"string" === typeof a ? "<" === a.trim().charAt(0) && ">" === a.trim().charAt(a.trim().length - 1) ? (b = document.createElement("template"), b.innerHTML = a.trim(), b = Array.from(b.content.childNodes)) : b = Array.from(document.querySelectorAll(a)) : a instanceof Element ? b = [a] : a instanceof NodeList || a instanceof HTMLCollection ? b = Array.from(a) :
|
|
4290
|
+
Array.isArray(a) ? b = a.filter(c => c instanceof Element) : a instanceof DomQuery && (b = a.elements);
|
|
4290
4291
|
this.elements = [...this.elements, ...b];
|
|
4291
4292
|
this.length = this.elements.length;
|
|
4292
4293
|
for (a = 0; a < this.length; a++) this[a] = this.elements[a];
|
|
@@ -4295,8 +4296,8 @@ DomQuery.prototype = {
|
|
|
4295
4296
|
addBack: function(a) {
|
|
4296
4297
|
if (!this._prevObject) return this;
|
|
4297
4298
|
let b = this.elements.slice();
|
|
4298
|
-
void 0 === a ? b = b.concat(this._prevObject.elements) : "string" === typeof a ? b = b.concat(this._prevObject.filter(a).elements) : "function" === typeof a ? b = b.concat(this._prevObject.filter((c, d) =>
|
|
4299
|
-
a
|
|
4299
|
+
void 0 === a ? b = b.concat(this._prevObject.elements) : "string" === typeof a ? b = b.concat(this._prevObject.filter(a).elements) : "function" === typeof a ? b = b.concat(this._prevObject.filter((c, d) => a.call(c, d, c)).elements) :
|
|
4300
|
+
a instanceof Node || a instanceof NodeList || Array.isArray(a) ? b = b.concat(Array.from(a)) : a instanceof DomQuery && (b = b.concat(a.elements));
|
|
4300
4301
|
return this.endStack(b)
|
|
4301
4302
|
},
|
|
4302
4303
|
andSelf: function() {
|
|
@@ -5278,36 +5279,40 @@ v,x,c)}`;
|
|
|
5278
5279
|
a = a.split("\n");
|
|
5279
5280
|
const h = new Map,
|
|
5280
5281
|
g = [];
|
|
5281
|
-
for (let
|
|
5282
|
-
const
|
|
5283
|
-
var l =
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5282
|
+
for (let p = 0; p < a.length; p++) {
|
|
5283
|
+
const t = a[p];
|
|
5284
|
+
var l = p + 1,
|
|
5285
|
+
k = t.match(/domqGLG\s*\(\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*[^)]+)?\s*\)/);
|
|
5286
|
+
if (k || /\/\/\s*domqGLG/.test(t))
|
|
5287
|
+
if (k) DomQuery.prototype._extractProcessJSLine.call(this,
|
|
5288
|
+
t, e, d, f, b, null);
|
|
5289
|
+
else {
|
|
5290
|
+
var n = t.match(/\/\/\s*domqGLG_(\w+)/);
|
|
5291
|
+
k = null;
|
|
5292
|
+
if (n) {
|
|
5293
|
+
k = n[1];
|
|
5294
|
+
const m = t.substring(0, 100).replace(/\n/g, " ");
|
|
5295
|
+
n = k;
|
|
5296
|
+
if (h.has(n)) {
|
|
5297
|
+
const u = h.get(n);
|
|
5298
|
+
console.warn(`\u26a0\ufe0f \uc911\ubcf5\ub41c \uace0\uc720\uac12 \ubc1c\uacac: "${n}" (${"Gong_"})\n` + ` \uc774\uc804 \uc704\uce58: ${b}:${u.lineNumber}\uc904\n` + ` \ud604\uc7ac \uc704\uce58: ${b}:${l}\uc904\n` + ` \ucee8\ud14d\uc2a4\ud2b8: ${m}`);
|
|
5299
|
+
g.push({
|
|
5300
|
+
uniqueValue: n,
|
|
5301
|
+
keyType: "Gong_",
|
|
5302
|
+
previousLine: u.lineNumber,
|
|
5303
|
+
currentLine: l,
|
|
5304
|
+
context: m
|
|
5305
|
+
})
|
|
5306
|
+
} else h.set(n, {
|
|
5307
|
+
lineNumber: l,
|
|
5308
|
+
context: m
|
|
5309
|
+
})
|
|
5310
|
+
}(l = t.match(/\/\/\s*domqGLG_(\w+)\s+(\[[^\]]+\])/)) ? d[`Tae_${l[1]}`] = l[2]: DomQuery.prototype._extractProcessJSLine.call(this, t, e, d, f, b, k)
|
|
5311
|
+
}
|
|
5308
5312
|
}
|
|
5309
5313
|
0 < g.length && alert(`\u26a0\ufe0f \uc911\ubcf5\ub41c \uace0\uc720\uac12\uc774 ${g.length}\uac1c \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n` + "\ucf58\uc194 \ub85c\uadf8\ub97c \ud655\uc778\ud558\uc5ec \uc911\ubcf5 \uc704\uce58\ub97c \ud655\uc778\ud558\uc138\uc694.\n\n" + `\ud30c\uc77c: ${b}`);
|
|
5310
|
-
b = DomQuery.prototype._extractDownloadJSON.call(this,
|
|
5314
|
+
b = DomQuery.prototype._extractDownloadJSON.call(this,
|
|
5315
|
+
d, b, "js");
|
|
5311
5316
|
c(!0, b)
|
|
5312
5317
|
},
|
|
5313
5318
|
_extractSingleFile: function(a, b, c) {
|
|
@@ -5315,8 +5320,7 @@ v,x,c)}`;
|
|
|
5315
5320
|
const d = this;
|
|
5316
5321
|
try {
|
|
5317
5322
|
if ("html" === b) {
|
|
5318
|
-
const e = window.location.pathname || window.location.href.split("/").pop() ||
|
|
5319
|
-
"",
|
|
5323
|
+
const e = window.location.pathname || window.location.href.split("/").pop() || "",
|
|
5320
5324
|
f = e.split("/").pop() || "",
|
|
5321
5325
|
h = a.split("/").pop() || a;
|
|
5322
5326
|
f && (f === h || e.includes(h)) ? DomQuery.prototype._extractProcessHTML.call(d, document.body.innerHTML, document.body, a, c) : fetch(a).then(g => {
|
|
@@ -5325,7 +5329,8 @@ v,x,c)}`;
|
|
|
5325
5329
|
}).then(g => {
|
|
5326
5330
|
const l = document.createElement("div");
|
|
5327
5331
|
l.innerHTML = g;
|
|
5328
|
-
DomQuery.prototype._extractProcessHTML.call(d,
|
|
5332
|
+
DomQuery.prototype._extractProcessHTML.call(d,
|
|
5333
|
+
g, l, a, c)
|
|
5329
5334
|
}).catch(g => {
|
|
5330
5335
|
c(!1, {
|
|
5331
5336
|
error: g.message
|
|
@@ -5354,7 +5359,8 @@ v,x,c)}`;
|
|
|
5354
5359
|
if (window.AES_LOADING_IN_PROGRESS) {
|
|
5355
5360
|
let c = 0;
|
|
5356
5361
|
for (; window.AES_LOADING_IN_PROGRESS && 50 > c;) {
|
|
5357
|
-
await new Promise(d =>
|
|
5362
|
+
await new Promise(d =>
|
|
5363
|
+
setTimeout(d, 100));
|
|
5358
5364
|
if ("function" === typeof window.decrypt) {
|
|
5359
5365
|
a();
|
|
5360
5366
|
return
|
|
@@ -5372,7 +5378,8 @@ v,x,c)}`;
|
|
|
5372
5378
|
},
|
|
5373
5379
|
_decryptDecryptChunk: async function(a, b) {
|
|
5374
5380
|
try {
|
|
5375
|
-
if ("function" === typeof window.decrypt) return await window.decrypt(a,
|
|
5381
|
+
if ("function" === typeof window.decrypt) return await window.decrypt(a,
|
|
5382
|
+
b);
|
|
5376
5383
|
throw Error("window.decrypt \ud568\uc218\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4");
|
|
5377
5384
|
} catch (c) {
|
|
5378
5385
|
throw console.error("\uc9c1\uc811 \ubcf5\ud638\ud654 \uc2e4\ud328:", c), c;
|