@whitesev/utils 2.0.2 → 2.1.1
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/index.amd.js +186 -175
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +186 -175
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +186 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +186 -175
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +186 -175
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +186 -175
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Utils.d.ts +6 -5
- package/dist/types/src/UtilsGMCookie.d.ts +6 -0
- package/dist/types/src/WindowApi.d.ts +22 -0
- package/dist/types/src/types/global.d.ts +1 -0
- package/package.json +1 -1
- package/src/Httpx.ts +3 -5
- package/src/Log.ts +1 -2
- package/src/Progress.ts +4 -10
- package/src/Utils.ts +150 -119
- package/src/UtilsCommon.ts +2 -4
- package/src/UtilsGMCookie.ts +29 -16
- package/src/UtilsGMMenu.ts +1 -2
- package/src/WindowApi.ts +44 -0
- package/src/indexedDB.ts +4 -6
- package/src/types/global.d.ts +1 -0
- package/dist/types/src/UtilsCore.d.ts +0 -16
- package/src/UtilsCore.ts +0 -47
package/dist/index.system.js
CHANGED
|
@@ -229,45 +229,16 @@ System.register('Utils', [], (function (exports) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const UtilsCoreDefaultEnv = {
|
|
233
|
-
document: document,
|
|
234
|
-
window: window,
|
|
235
|
-
globalThis: globalThis,
|
|
236
|
-
self: self,
|
|
237
|
-
top: top,
|
|
238
|
-
};
|
|
239
|
-
const UtilsCoreEnv = {
|
|
240
|
-
document: document,
|
|
241
|
-
window: window,
|
|
242
|
-
globalThis: globalThis,
|
|
243
|
-
self: self,
|
|
244
|
-
top: top,
|
|
245
|
-
};
|
|
246
|
-
const UtilsCore = {
|
|
247
|
-
init(option) {
|
|
248
|
-
if (!option) {
|
|
249
|
-
option = Object.assign({}, UtilsCoreDefaultEnv);
|
|
250
|
-
}
|
|
251
|
-
Object.assign(UtilsCoreEnv, option);
|
|
252
|
-
},
|
|
253
|
-
get document() {
|
|
254
|
-
return UtilsCoreEnv.document;
|
|
255
|
-
},
|
|
256
|
-
get window() {
|
|
257
|
-
return UtilsCoreEnv.window;
|
|
258
|
-
},
|
|
259
|
-
get globalThis() {
|
|
260
|
-
return UtilsCoreEnv.globalThis;
|
|
261
|
-
},
|
|
262
|
-
get self() {
|
|
263
|
-
return UtilsCoreEnv.self;
|
|
264
|
-
},
|
|
265
|
-
get top() {
|
|
266
|
-
return UtilsCoreEnv.top;
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
|
|
270
232
|
class UtilsGMCookie {
|
|
233
|
+
windowApi = {
|
|
234
|
+
window: window,
|
|
235
|
+
document: document,
|
|
236
|
+
};
|
|
237
|
+
constructor(windowApiOption) {
|
|
238
|
+
if (windowApiOption) {
|
|
239
|
+
this.windowApi = Object.assign({}, windowApiOption);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
271
242
|
/**
|
|
272
243
|
* 获取单个cookie
|
|
273
244
|
* @param cookieName cookie名
|
|
@@ -276,7 +247,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
276
247
|
if (typeof cookieName !== "string") {
|
|
277
248
|
throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
|
|
278
249
|
}
|
|
279
|
-
let cookies =
|
|
250
|
+
let cookies = this.windowApi.document.cookie.split(";");
|
|
280
251
|
let findValue = void 0;
|
|
281
252
|
for (const cookieItem of cookies) {
|
|
282
253
|
let item = cookieItem.trim();
|
|
@@ -286,7 +257,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
286
257
|
let itemValue = decodeURIComponent(itemSplit.join(""));
|
|
287
258
|
if (itemName === cookieName) {
|
|
288
259
|
findValue = {
|
|
289
|
-
domain:
|
|
260
|
+
domain: this.windowApi.window.location.hostname,
|
|
290
261
|
expirationDate: null,
|
|
291
262
|
hostOnly: true,
|
|
292
263
|
httpOnly: false,
|
|
@@ -316,13 +287,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
316
287
|
let resultData = [];
|
|
317
288
|
try {
|
|
318
289
|
let details = {
|
|
319
|
-
url:
|
|
320
|
-
domain:
|
|
290
|
+
url: this.windowApi.window.location.href,
|
|
291
|
+
domain: this.windowApi.window.location.hostname,
|
|
321
292
|
name: "",
|
|
322
293
|
path: "/",
|
|
323
294
|
};
|
|
324
295
|
details = utils.assign(details, paramDetails);
|
|
325
|
-
let cookies =
|
|
296
|
+
let cookies = this.windowApi.document.cookie.split(";");
|
|
326
297
|
cookies.forEach((item) => {
|
|
327
298
|
item = item.trim();
|
|
328
299
|
let itemSplit = item.split("=");
|
|
@@ -334,7 +305,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
334
305
|
: new RegExp("^" + details.name, "g");
|
|
335
306
|
if (itemName.match(nameRegexp)) {
|
|
336
307
|
resultData.push({
|
|
337
|
-
domain:
|
|
308
|
+
domain: this.windowApi.window.location.hostname,
|
|
338
309
|
expirationDate: null,
|
|
339
310
|
hostOnly: true,
|
|
340
311
|
httpOnly: false,
|
|
@@ -367,13 +338,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
367
338
|
}
|
|
368
339
|
let resultData = [];
|
|
369
340
|
let details = {
|
|
370
|
-
url:
|
|
371
|
-
domain:
|
|
341
|
+
url: this.windowApi.window.location.href,
|
|
342
|
+
domain: this.windowApi.window.location.hostname,
|
|
372
343
|
name: "",
|
|
373
344
|
path: "/",
|
|
374
345
|
};
|
|
375
346
|
details = utils.assign(details, paramDetails);
|
|
376
|
-
let cookies =
|
|
347
|
+
let cookies = this.windowApi.document.cookie.split(";");
|
|
377
348
|
cookies.forEach((item) => {
|
|
378
349
|
item = item.trim();
|
|
379
350
|
let itemSplit = item.split("=");
|
|
@@ -385,7 +356,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
385
356
|
: new RegExp("^" + details.name, "g");
|
|
386
357
|
if (itemName.match(nameRegexp)) {
|
|
387
358
|
resultData.push({
|
|
388
|
-
domain:
|
|
359
|
+
domain: this.windowApi.window.location.hostname,
|
|
389
360
|
expirationDate: null,
|
|
390
361
|
hostOnly: true,
|
|
391
362
|
httpOnly: false,
|
|
@@ -408,10 +379,10 @@ System.register('Utils', [], (function (exports) {
|
|
|
408
379
|
set(paramDetails, callback = (error) => { }) {
|
|
409
380
|
try {
|
|
410
381
|
let details = {
|
|
411
|
-
url:
|
|
382
|
+
url: this.windowApi.window.location.href,
|
|
412
383
|
name: "",
|
|
413
384
|
value: "",
|
|
414
|
-
domain:
|
|
385
|
+
domain: this.windowApi.window.location.hostname,
|
|
415
386
|
path: "/",
|
|
416
387
|
secure: true,
|
|
417
388
|
httpOnly: false,
|
|
@@ -430,7 +401,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
430
401
|
";expires=" +
|
|
431
402
|
new Date(life).toGMTString() +
|
|
432
403
|
"; path=/";
|
|
433
|
-
|
|
404
|
+
this.windowApi.document.cookie = cookieStr;
|
|
434
405
|
callback();
|
|
435
406
|
}
|
|
436
407
|
catch (error) {
|
|
@@ -445,14 +416,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
445
416
|
delete(paramDetails, callback = (error) => { }) {
|
|
446
417
|
try {
|
|
447
418
|
let details = {
|
|
448
|
-
url:
|
|
419
|
+
url: this.windowApi.window.location.href,
|
|
449
420
|
name: "",
|
|
450
421
|
// @ts-ignore
|
|
451
422
|
firstPartyDomain: "",
|
|
452
423
|
};
|
|
453
424
|
details = utils.assign(details, paramDetails);
|
|
454
425
|
let cookieStr = details.name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
455
|
-
|
|
426
|
+
this.windowApi.document.cookie = cookieStr;
|
|
456
427
|
callback();
|
|
457
428
|
}
|
|
458
429
|
catch (error) {
|
|
@@ -1222,7 +1193,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1222
1193
|
}
|
|
1223
1194
|
/* 不刷新网页就刷新菜单 */
|
|
1224
1195
|
if (menuOption.autoReload) {
|
|
1225
|
-
|
|
1196
|
+
window.location.reload();
|
|
1226
1197
|
}
|
|
1227
1198
|
else {
|
|
1228
1199
|
that.context.update();
|
|
@@ -1541,8 +1512,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
1541
1512
|
* 生成uuid
|
|
1542
1513
|
*/
|
|
1543
1514
|
const GenerateUUID = function () {
|
|
1544
|
-
if (typeof
|
|
1545
|
-
return
|
|
1515
|
+
if (typeof window?.crypto?.randomUUID === "function") {
|
|
1516
|
+
return window.crypto.randomUUID();
|
|
1546
1517
|
}
|
|
1547
1518
|
else {
|
|
1548
1519
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (charStr) {
|
|
@@ -1914,14 +1885,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
1914
1885
|
}
|
|
1915
1886
|
catch (error) {
|
|
1916
1887
|
if (details.url.startsWith("//")) {
|
|
1917
|
-
details.url =
|
|
1888
|
+
details.url = window.location.protocol + details.url;
|
|
1918
1889
|
}
|
|
1919
1890
|
else if (details.url.startsWith("/")) {
|
|
1920
|
-
details.url =
|
|
1891
|
+
details.url = window.location.origin + details.url;
|
|
1921
1892
|
}
|
|
1922
1893
|
else {
|
|
1923
|
-
details.url =
|
|
1924
|
-
UtilsCore.globalThis.location.origin + "/" + details.url;
|
|
1894
|
+
details.url = window.location.origin + "/" + details.url;
|
|
1925
1895
|
}
|
|
1926
1896
|
}
|
|
1927
1897
|
return details;
|
|
@@ -2547,10 +2517,10 @@ System.register('Utils', [], (function (exports) {
|
|
|
2547
2517
|
// @ts-ignore
|
|
2548
2518
|
#slqVersion = "1";
|
|
2549
2519
|
/* 监听IndexDB */
|
|
2550
|
-
#indexedDB =
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2520
|
+
#indexedDB = window.indexedDB ||
|
|
2521
|
+
window.mozIndexedDB ||
|
|
2522
|
+
window.webkitIndexedDB ||
|
|
2523
|
+
window.msIndexedDB;
|
|
2554
2524
|
/* 缓存数据库,避免同一个页面重复创建和销毁 */
|
|
2555
2525
|
#db = {};
|
|
2556
2526
|
// @ts-ignore
|
|
@@ -2980,7 +2950,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2980
2950
|
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}},或者直接是一个字符串
|
|
2981
2951
|
* @param console 可指定console对象为unsafeWindow下的console或者是油猴window下的console
|
|
2982
2952
|
*/
|
|
2983
|
-
constructor(_GM_info_, console =
|
|
2953
|
+
constructor(_GM_info_, console = window.console) {
|
|
2984
2954
|
if (typeof _GM_info_ === "string") {
|
|
2985
2955
|
this.tag = _GM_info_;
|
|
2986
2956
|
}
|
|
@@ -3241,14 +3211,12 @@ System.register('Utils', [], (function (exports) {
|
|
|
3241
3211
|
/* 元素高度 */
|
|
3242
3212
|
this.#height = this.#config.canvasNode.height;
|
|
3243
3213
|
/* 清除锯齿 */
|
|
3244
|
-
if (
|
|
3214
|
+
if (window.devicePixelRatio) {
|
|
3245
3215
|
this.#config.canvasNode.style.width = this.#width + "px";
|
|
3246
3216
|
this.#config.canvasNode.style.height = this.#height + "px";
|
|
3247
|
-
this.#config.canvasNode.height =
|
|
3248
|
-
|
|
3249
|
-
this.#
|
|
3250
|
-
this.#width * UtilsCore.window.devicePixelRatio;
|
|
3251
|
-
this.#ctx.scale(UtilsCore.window.devicePixelRatio, UtilsCore.window.devicePixelRatio);
|
|
3217
|
+
this.#config.canvasNode.height = this.#height * window.devicePixelRatio;
|
|
3218
|
+
this.#config.canvasNode.width = this.#width * window.devicePixelRatio;
|
|
3219
|
+
this.#ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
|
3252
3220
|
}
|
|
3253
3221
|
/* 设置线宽 */
|
|
3254
3222
|
this.#ctx.lineWidth = this.#config.lineWidth;
|
|
@@ -3517,34 +3485,69 @@ System.register('Utils', [], (function (exports) {
|
|
|
3517
3485
|
}
|
|
3518
3486
|
}
|
|
3519
3487
|
|
|
3488
|
+
class WindowApi {
|
|
3489
|
+
/** 默认的配置 */
|
|
3490
|
+
defaultApi = {
|
|
3491
|
+
document: document,
|
|
3492
|
+
window: window,
|
|
3493
|
+
globalThis: globalThis,
|
|
3494
|
+
self: self,
|
|
3495
|
+
top: top,
|
|
3496
|
+
};
|
|
3497
|
+
/** 使用的配置 */
|
|
3498
|
+
api;
|
|
3499
|
+
constructor(option) {
|
|
3500
|
+
if (!option) {
|
|
3501
|
+
option = Object.assign({}, this.defaultApi);
|
|
3502
|
+
}
|
|
3503
|
+
this.api = Object.assign({}, option);
|
|
3504
|
+
}
|
|
3505
|
+
get document() {
|
|
3506
|
+
return this.api.document;
|
|
3507
|
+
}
|
|
3508
|
+
get window() {
|
|
3509
|
+
return this.api.window;
|
|
3510
|
+
}
|
|
3511
|
+
get globalThis() {
|
|
3512
|
+
return this.api.globalThis;
|
|
3513
|
+
}
|
|
3514
|
+
get self() {
|
|
3515
|
+
return this.api.self;
|
|
3516
|
+
}
|
|
3517
|
+
get top() {
|
|
3518
|
+
return this.api.top;
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3520
3522
|
class Utils {
|
|
3523
|
+
windowApi;
|
|
3521
3524
|
constructor(option) {
|
|
3522
|
-
|
|
3525
|
+
this.windowApi = new WindowApi(option);
|
|
3523
3526
|
}
|
|
3524
3527
|
/** 版本号 */
|
|
3525
|
-
version = "2024.7.
|
|
3528
|
+
version = "2024.7.24";
|
|
3526
3529
|
addStyle(cssText) {
|
|
3527
3530
|
if (typeof cssText !== "string") {
|
|
3528
3531
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
3529
3532
|
}
|
|
3530
|
-
let cssNode =
|
|
3533
|
+
let cssNode = this.windowApi.document.createElement("style");
|
|
3531
3534
|
cssNode.setAttribute("type", "text/css");
|
|
3532
3535
|
cssNode.innerHTML = cssText;
|
|
3533
|
-
if (
|
|
3536
|
+
if (this.windowApi.document.head) {
|
|
3534
3537
|
/* 插入head最后 */
|
|
3535
|
-
|
|
3538
|
+
this.windowApi.document.head.appendChild(cssNode);
|
|
3536
3539
|
}
|
|
3537
|
-
else if (
|
|
3540
|
+
else if (this.windowApi.document.body) {
|
|
3538
3541
|
/* 插入body后 */
|
|
3539
|
-
|
|
3542
|
+
this.windowApi.document.body.appendChild(cssNode);
|
|
3540
3543
|
}
|
|
3541
|
-
else if (
|
|
3544
|
+
else if (this.windowApi.document.documentElement.childNodes.length === 0) {
|
|
3542
3545
|
/* 插入#html第一个元素后 */
|
|
3543
|
-
|
|
3546
|
+
this.windowApi.document.documentElement.appendChild(cssNode);
|
|
3544
3547
|
}
|
|
3545
3548
|
else {
|
|
3546
3549
|
/* 插入head前面 */
|
|
3547
|
-
|
|
3550
|
+
this.windowApi.document.documentElement.insertBefore(cssNode, this.windowApi.document.documentElement.childNodes[0]);
|
|
3548
3551
|
}
|
|
3549
3552
|
return cssNode;
|
|
3550
3553
|
}
|
|
@@ -3675,7 +3678,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3675
3678
|
let elementPosXRight = Number(element.getBoundingClientRect().right); /* 要检测的元素的相对屏幕的横坐标最右边 */
|
|
3676
3679
|
let elementPosYTop = Number(element.getBoundingClientRect().top); /* 要检测的元素的相对屏幕的纵坐标最上边 */
|
|
3677
3680
|
let elementPosYBottom = Number(element.getBoundingClientRect().bottom); /* 要检测的元素的相对屏幕的纵坐标最下边 */
|
|
3678
|
-
let clickNodeHTML =
|
|
3681
|
+
let clickNodeHTML = this.windowApi.window.event.target
|
|
3679
3682
|
.innerHTML;
|
|
3680
3683
|
if (mouseClickPosX >= elementPosXLeft &&
|
|
3681
3684
|
mouseClickPosX <= elementPosXRight &&
|
|
@@ -3804,18 +3807,18 @@ System.register('Utils', [], (function (exports) {
|
|
|
3804
3807
|
}
|
|
3805
3808
|
if (isIFrame) {
|
|
3806
3809
|
/* 使用iframe */
|
|
3807
|
-
const iframeElement =
|
|
3810
|
+
const iframeElement = this.windowApi.document.createElement("iframe");
|
|
3808
3811
|
iframeElement.style.display = "none";
|
|
3809
3812
|
iframeElement.src = base64Data;
|
|
3810
|
-
|
|
3813
|
+
this.windowApi.document.body.appendChild(iframeElement);
|
|
3811
3814
|
setTimeout(() => {
|
|
3812
3815
|
iframeElement.contentWindow.document.execCommand("SaveAs", true, fileName);
|
|
3813
|
-
|
|
3816
|
+
this.windowApi.document.body.removeChild(iframeElement);
|
|
3814
3817
|
}, 100);
|
|
3815
3818
|
}
|
|
3816
3819
|
else {
|
|
3817
3820
|
/* 使用A标签 */
|
|
3818
|
-
const linkElement =
|
|
3821
|
+
const linkElement = this.windowApi.document.createElement("a");
|
|
3819
3822
|
linkElement.setAttribute("target", "_blank");
|
|
3820
3823
|
linkElement.download = fileName;
|
|
3821
3824
|
linkElement.href = base64Data;
|
|
@@ -3825,13 +3828,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
3825
3828
|
findWebPageVisibleText(str = "", caseSensitive = false) {
|
|
3826
3829
|
let TRange = null;
|
|
3827
3830
|
let strFound;
|
|
3828
|
-
if (
|
|
3831
|
+
if (this.windowApi.globalThis.find) {
|
|
3829
3832
|
/* CODE FOR BROWSERS THAT SUPPORT window.find */
|
|
3830
|
-
let windowFind =
|
|
3833
|
+
let windowFind = this.windowApi.self.find;
|
|
3831
3834
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3832
3835
|
if (strFound &&
|
|
3833
|
-
|
|
3834
|
-
!
|
|
3836
|
+
this.windowApi.self.getSelection &&
|
|
3837
|
+
!this.windowApi.self.getSelection().anchorNode) {
|
|
3835
3838
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3836
3839
|
}
|
|
3837
3840
|
if (!strFound) {
|
|
@@ -3850,7 +3853,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3850
3853
|
TRange.select();
|
|
3851
3854
|
}
|
|
3852
3855
|
if (TRange == null || strFound == 0) {
|
|
3853
|
-
TRange =
|
|
3856
|
+
TRange = this.windowApi.self.document.body.createTextRange();
|
|
3854
3857
|
strFound = TRange.findText(str);
|
|
3855
3858
|
if (strFound)
|
|
3856
3859
|
TRange.select();
|
|
@@ -4226,8 +4229,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
4226
4229
|
let maxZIndexCompare = 2 * Math.pow(10, 9);
|
|
4227
4230
|
// 当前页面最大的z-index
|
|
4228
4231
|
let zIndex = 0;
|
|
4229
|
-
|
|
4230
|
-
let nodeStyle =
|
|
4232
|
+
this.windowApi.document.querySelectorAll("*").forEach(($ele, index) => {
|
|
4233
|
+
let nodeStyle = this.windowApi.window.getComputedStyle($ele);
|
|
4231
4234
|
/* 不对position为static和display为none的元素进行获取它们的z-index */
|
|
4232
4235
|
if (nodeStyle.position !== "static" && nodeStyle.display !== "none") {
|
|
4233
4236
|
let nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
@@ -4441,7 +4444,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
4441
4444
|
if (url.trim() === "") {
|
|
4442
4445
|
throw new TypeError("url不能为空字符串或纯空格");
|
|
4443
4446
|
}
|
|
4444
|
-
return `thunder://${
|
|
4447
|
+
return `thunder://${this.windowApi.globalThis.btoa("AA" + url + "ZZ")}`;
|
|
4445
4448
|
}
|
|
4446
4449
|
/**
|
|
4447
4450
|
* 对于GM_cookie的兼容写法,当无法使用GM_cookie时可以使用这个,但是并不完全兼容,有些写不出来且限制了httponly是无法访问的
|
|
@@ -4656,21 +4659,21 @@ System.register('Utils', [], (function (exports) {
|
|
|
4656
4659
|
return Boolean(target.toString().match(/^function .*\(\) { \[native code\] }$/));
|
|
4657
4660
|
}
|
|
4658
4661
|
isNearBottom(nearValue = 50) {
|
|
4659
|
-
var scrollTop =
|
|
4660
|
-
|
|
4661
|
-
var windowHeight =
|
|
4662
|
-
|
|
4663
|
-
var documentHeight =
|
|
4662
|
+
var scrollTop = this.windowApi.window.pageYOffset ||
|
|
4663
|
+
this.windowApi.document.documentElement.scrollTop;
|
|
4664
|
+
var windowHeight = this.windowApi.window.innerHeight ||
|
|
4665
|
+
this.windowApi.document.documentElement.clientHeight;
|
|
4666
|
+
var documentHeight = this.windowApi.document.documentElement.scrollHeight;
|
|
4664
4667
|
return scrollTop + windowHeight >= documentHeight - nearValue;
|
|
4665
4668
|
}
|
|
4666
4669
|
isDOM(target) {
|
|
4667
4670
|
return target instanceof Node;
|
|
4668
4671
|
}
|
|
4669
4672
|
isFullscreenEnabled() {
|
|
4670
|
-
return !!(
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4673
|
+
return !!(this.windowApi.document.fullscreenEnabled ||
|
|
4674
|
+
this.windowApi.document.webkitFullScreenEnabled ||
|
|
4675
|
+
this.windowApi.document.mozFullScreenEnabled ||
|
|
4676
|
+
this.windowApi.document.msFullScreenEnabled);
|
|
4674
4677
|
}
|
|
4675
4678
|
isJQuery(target) {
|
|
4676
4679
|
let result = false;
|
|
@@ -4903,7 +4906,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
4903
4906
|
return result;
|
|
4904
4907
|
}
|
|
4905
4908
|
isThemeDark() {
|
|
4906
|
-
return
|
|
4909
|
+
return this.windowApi.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4907
4910
|
.matches;
|
|
4908
4911
|
}
|
|
4909
4912
|
isVisible(element, inView = false) {
|
|
@@ -4917,17 +4920,17 @@ System.register('Utils', [], (function (exports) {
|
|
|
4917
4920
|
}
|
|
4918
4921
|
let result = true;
|
|
4919
4922
|
for (const domItem of needCheckDomList) {
|
|
4920
|
-
let domDisplay =
|
|
4923
|
+
let domDisplay = this.windowApi.window.getComputedStyle(domItem);
|
|
4921
4924
|
if (domDisplay.display === "none") {
|
|
4922
4925
|
result = false;
|
|
4923
4926
|
}
|
|
4924
4927
|
else {
|
|
4925
4928
|
let domClientRect = domItem.getBoundingClientRect();
|
|
4926
4929
|
if (inView) {
|
|
4927
|
-
let viewportWidth =
|
|
4928
|
-
|
|
4929
|
-
let viewportHeight =
|
|
4930
|
-
|
|
4930
|
+
let viewportWidth = this.windowApi.window.innerWidth ||
|
|
4931
|
+
this.windowApi.document.documentElement.clientWidth;
|
|
4932
|
+
let viewportHeight = this.windowApi.window.innerHeight ||
|
|
4933
|
+
this.windowApi.document.documentElement.clientHeight;
|
|
4931
4934
|
result = !(domClientRect.right < 0 ||
|
|
4932
4935
|
domClientRect.left > viewportWidth ||
|
|
4933
4936
|
domClientRect.bottom < 0 ||
|
|
@@ -4947,10 +4950,10 @@ System.register('Utils', [], (function (exports) {
|
|
|
4947
4950
|
isWebView_Via() {
|
|
4948
4951
|
let result = true;
|
|
4949
4952
|
let UtilsContext = this;
|
|
4950
|
-
if (typeof
|
|
4951
|
-
for (const key in Object.values(
|
|
4952
|
-
if (Reflect.has(
|
|
4953
|
-
let objValueFunc =
|
|
4953
|
+
if (typeof this.windowApi.top.window.via === "object") {
|
|
4954
|
+
for (const key in Object.values(this.windowApi.top.window.via)) {
|
|
4955
|
+
if (Reflect.has(this.windowApi.top.window.via, key)) {
|
|
4956
|
+
let objValueFunc = this.windowApi.top.window.via[key];
|
|
4954
4957
|
if (typeof objValueFunc === "function" &&
|
|
4955
4958
|
UtilsContext.isNativeFunc(objValueFunc)) {
|
|
4956
4959
|
result = true;
|
|
@@ -4970,10 +4973,10 @@ System.register('Utils', [], (function (exports) {
|
|
|
4970
4973
|
isWebView_X() {
|
|
4971
4974
|
let result = true;
|
|
4972
4975
|
let UtilsContext = this;
|
|
4973
|
-
if (typeof
|
|
4974
|
-
for (const key in Object.values(
|
|
4975
|
-
if (Reflect.has(
|
|
4976
|
-
let objValueFunc =
|
|
4976
|
+
if (typeof this.windowApi.top.window.mbrowser === "object") {
|
|
4977
|
+
for (const key in Object.values(this.windowApi.top.window.mbrowser)) {
|
|
4978
|
+
if (Reflect.has(this.windowApi.top.window.mbrowser, key)) {
|
|
4979
|
+
let objValueFunc = this.windowApi.top.window.mbrowser[key];
|
|
4977
4980
|
if (typeof objValueFunc === "function" &&
|
|
4978
4981
|
UtilsContext.isNativeFunc(objValueFunc)) {
|
|
4979
4982
|
result = true;
|
|
@@ -5145,9 +5148,9 @@ System.register('Utils', [], (function (exports) {
|
|
|
5145
5148
|
immediate: false,
|
|
5146
5149
|
};
|
|
5147
5150
|
observer_config = UtilsContext.assign(default_obverser_config, observer_config);
|
|
5148
|
-
let windowMutationObserver =
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
+
let windowMutationObserver = this.windowApi.window.MutationObserver ||
|
|
5152
|
+
this.windowApi.window.webkitMutationObserver ||
|
|
5153
|
+
this.windowApi.window.MozMutationObserver;
|
|
5151
5154
|
// 观察者对象
|
|
5152
5155
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
5153
5156
|
if (typeof observer_config.callback === "function") {
|
|
@@ -5183,13 +5186,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
5183
5186
|
* let utils = Utils.noConflict();
|
|
5184
5187
|
* > ...
|
|
5185
5188
|
*/
|
|
5186
|
-
noConflict
|
|
5187
|
-
if (
|
|
5188
|
-
Reflect.deleteProperty(
|
|
5189
|
+
noConflict() {
|
|
5190
|
+
if (this.windowApi.window.Utils) {
|
|
5191
|
+
Reflect.deleteProperty(this.windowApi.window, "Utils");
|
|
5189
5192
|
}
|
|
5190
|
-
|
|
5193
|
+
this.windowApi.window.Utils = utils;
|
|
5191
5194
|
return utils;
|
|
5192
|
-
}
|
|
5195
|
+
}
|
|
5193
5196
|
noConflictFunc(needReleaseObject, needReleaseName, functionNameList = [], release = true) {
|
|
5194
5197
|
let UtilsContext = this;
|
|
5195
5198
|
if (typeof needReleaseObject !== "object") {
|
|
@@ -5206,11 +5209,12 @@ System.register('Utils', [], (function (exports) {
|
|
|
5206
5209
|
* 释放所有
|
|
5207
5210
|
*/
|
|
5208
5211
|
function releaseAll() {
|
|
5209
|
-
if (typeof
|
|
5212
|
+
if (typeof UtilsContext.windowApi.window[needReleaseKey] !==
|
|
5213
|
+
"undefined") {
|
|
5210
5214
|
/* 已存在 */
|
|
5211
5215
|
return;
|
|
5212
5216
|
}
|
|
5213
|
-
|
|
5217
|
+
UtilsContext.windowApi.window[needReleaseKey] =
|
|
5214
5218
|
UtilsContext.deepClone(needReleaseObject);
|
|
5215
5219
|
Object.values(needReleaseObject).forEach((value) => {
|
|
5216
5220
|
if (typeof value === "function") {
|
|
@@ -5225,11 +5229,12 @@ System.register('Utils', [], (function (exports) {
|
|
|
5225
5229
|
Array.from(functionNameList).forEach((item) => {
|
|
5226
5230
|
Object.values(needReleaseObject).forEach((value) => {
|
|
5227
5231
|
if (typeof value === "function") {
|
|
5228
|
-
if (typeof
|
|
5229
|
-
|
|
5232
|
+
if (typeof UtilsContext.windowApi.window[needReleaseKey] ===
|
|
5233
|
+
"undefined") {
|
|
5234
|
+
UtilsContext.windowApi.window[needReleaseKey] = {};
|
|
5230
5235
|
}
|
|
5231
5236
|
if (item === value.name) {
|
|
5232
|
-
|
|
5237
|
+
UtilsContext.windowApi.window[needReleaseKey][value.name] = needReleaseObject[value.name];
|
|
5233
5238
|
needReleaseObject[value.name] = () => { };
|
|
5234
5239
|
}
|
|
5235
5240
|
}
|
|
@@ -5240,26 +5245,29 @@ System.register('Utils', [], (function (exports) {
|
|
|
5240
5245
|
* 恢复所有
|
|
5241
5246
|
*/
|
|
5242
5247
|
function recoveryAll() {
|
|
5243
|
-
if (typeof
|
|
5248
|
+
if (typeof UtilsContext.windowApi.window[needReleaseKey] ===
|
|
5249
|
+
"undefined") {
|
|
5244
5250
|
/* 未存在 */
|
|
5245
5251
|
return;
|
|
5246
5252
|
}
|
|
5247
|
-
Object.assign(needReleaseObject,
|
|
5248
|
-
Reflect.deleteProperty(
|
|
5253
|
+
Object.assign(needReleaseObject, UtilsContext.windowApi.window[needReleaseKey]);
|
|
5254
|
+
Reflect.deleteProperty(UtilsContext.windowApi.window, "needReleaseKey");
|
|
5249
5255
|
}
|
|
5250
5256
|
/**
|
|
5251
5257
|
* 恢复单个
|
|
5252
5258
|
*/
|
|
5253
5259
|
function recoveryOne() {
|
|
5254
|
-
if (typeof
|
|
5260
|
+
if (typeof UtilsContext.windowApi.window[needReleaseKey] ===
|
|
5261
|
+
"undefined") {
|
|
5255
5262
|
/* 未存在 */
|
|
5256
5263
|
return;
|
|
5257
5264
|
}
|
|
5258
5265
|
Array.from(functionNameList).forEach((item) => {
|
|
5259
|
-
if (
|
|
5260
|
-
needReleaseObject[item] =
|
|
5261
|
-
Reflect.deleteProperty(
|
|
5262
|
-
if (Object.keys(
|
|
5266
|
+
if (UtilsContext.windowApi.window[needReleaseKey][item]) {
|
|
5267
|
+
needReleaseObject[item] = UtilsContext.windowApi.window[needReleaseKey][item];
|
|
5268
|
+
Reflect.deleteProperty(UtilsContext.windowApi.window[needReleaseKey], item);
|
|
5269
|
+
if (Object.keys(UtilsContext.windowApi.window[needReleaseKey])
|
|
5270
|
+
.length === 0) {
|
|
5263
5271
|
Reflect.deleteProperty(window, needReleaseKey);
|
|
5264
5272
|
}
|
|
5265
5273
|
}
|
|
@@ -5465,7 +5473,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
5465
5473
|
return isNegative ? -reversedNum : reversedNum;
|
|
5466
5474
|
}
|
|
5467
5475
|
selectElementText(element, childTextNode, startIndex, endIndex) {
|
|
5468
|
-
let range =
|
|
5476
|
+
let range = this.windowApi.document.createRange();
|
|
5469
5477
|
range.selectNodeContents(element);
|
|
5470
5478
|
if (childTextNode) {
|
|
5471
5479
|
if (childTextNode.nodeType !== Node.TEXT_NODE) {
|
|
@@ -5476,7 +5484,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
5476
5484
|
range.setEnd(childTextNode, endIndex);
|
|
5477
5485
|
}
|
|
5478
5486
|
}
|
|
5479
|
-
let selection =
|
|
5487
|
+
let selection = this.windowApi.globalThis.getSelection();
|
|
5480
5488
|
if (selection) {
|
|
5481
5489
|
selection.removeAllRanges();
|
|
5482
5490
|
selection.addRange(range);
|
|
@@ -5504,6 +5512,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
5504
5512
|
else {
|
|
5505
5513
|
textType = "text/plain";
|
|
5506
5514
|
}
|
|
5515
|
+
let UtilsContext = this;
|
|
5507
5516
|
class UtilsClipboard {
|
|
5508
5517
|
#resolve;
|
|
5509
5518
|
#copyData;
|
|
@@ -5558,15 +5567,15 @@ System.register('Utils', [], (function (exports) {
|
|
|
5558
5567
|
*/
|
|
5559
5568
|
copyTextByTextArea() {
|
|
5560
5569
|
try {
|
|
5561
|
-
let copyElement =
|
|
5570
|
+
let copyElement = UtilsContext.windowApi.document.createElement("textarea");
|
|
5562
5571
|
copyElement.value = this.#copyData;
|
|
5563
5572
|
copyElement.setAttribute("type", "text");
|
|
5564
5573
|
copyElement.setAttribute("style", "opacity:0;position:absolute;");
|
|
5565
5574
|
copyElement.setAttribute("readonly", "readonly");
|
|
5566
|
-
|
|
5575
|
+
UtilsContext.windowApi.document.body.appendChild(copyElement);
|
|
5567
5576
|
copyElement.select();
|
|
5568
|
-
|
|
5569
|
-
|
|
5577
|
+
UtilsContext.windowApi.document.execCommand("copy");
|
|
5578
|
+
UtilsContext.windowApi.document.body.removeChild(copyElement);
|
|
5570
5579
|
return true;
|
|
5571
5580
|
}
|
|
5572
5581
|
catch (error) {
|
|
@@ -5643,11 +5652,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
5643
5652
|
}
|
|
5644
5653
|
return new Promise((resolve) => {
|
|
5645
5654
|
const utilsClipboard = new UtilsClipboard(resolve, data, textType);
|
|
5646
|
-
if (
|
|
5655
|
+
if (UtilsContext.windowApi.document.hasFocus()) {
|
|
5647
5656
|
utilsClipboard.init();
|
|
5648
5657
|
}
|
|
5649
5658
|
else {
|
|
5650
|
-
|
|
5659
|
+
UtilsContext.windowApi.window.addEventListener("focus", () => {
|
|
5651
5660
|
utilsClipboard.init();
|
|
5652
5661
|
}, { once: true });
|
|
5653
5662
|
}
|
|
@@ -5677,15 +5686,16 @@ System.register('Utils', [], (function (exports) {
|
|
|
5677
5686
|
}, delayTime);
|
|
5678
5687
|
});
|
|
5679
5688
|
}
|
|
5680
|
-
dragSlider(selector, offsetX =
|
|
5689
|
+
dragSlider(selector, offsetX = this.windowApi.window.innerWidth) {
|
|
5690
|
+
let UtilsContext = this;
|
|
5681
5691
|
function initMouseEvent(eventName, offSetX, offSetY) {
|
|
5682
5692
|
let win = unsafeWindow || window;
|
|
5683
|
-
let mouseEvent =
|
|
5693
|
+
let mouseEvent = UtilsContext.windowApi.document.createEvent("MouseEvents");
|
|
5684
5694
|
mouseEvent.initMouseEvent(eventName, true, true, win, 0, offSetX, offSetY, offSetX, offSetY, false, false, false, false, 0, null);
|
|
5685
5695
|
return mouseEvent;
|
|
5686
5696
|
}
|
|
5687
5697
|
let sliderElement = typeof selector === "string"
|
|
5688
|
-
?
|
|
5698
|
+
? this.windowApi.document.querySelector(selector)
|
|
5689
5699
|
: selector;
|
|
5690
5700
|
if (!(sliderElement instanceof Node) ||
|
|
5691
5701
|
!(sliderElement instanceof Element)) {
|
|
@@ -5697,7 +5707,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
5697
5707
|
sliderElement.dispatchEvent(initMouseEvent("mouseleave", x1, y1));
|
|
5698
5708
|
sliderElement.dispatchEvent(initMouseEvent("mouseout", x1, y1));
|
|
5699
5709
|
}
|
|
5700
|
-
enterFullScreen(element =
|
|
5710
|
+
enterFullScreen(element = this.windowApi.document.documentElement, options) {
|
|
5701
5711
|
try {
|
|
5702
5712
|
if (element.requestFullscreen) {
|
|
5703
5713
|
element.requestFullscreen(options);
|
|
@@ -5719,18 +5729,18 @@ System.register('Utils', [], (function (exports) {
|
|
|
5719
5729
|
console.error(err);
|
|
5720
5730
|
}
|
|
5721
5731
|
}
|
|
5722
|
-
exitFullScreen(element =
|
|
5723
|
-
if (
|
|
5724
|
-
return
|
|
5732
|
+
exitFullScreen(element = this.windowApi.document.documentElement) {
|
|
5733
|
+
if (this.windowApi.document.exitFullscreen) {
|
|
5734
|
+
return this.windowApi.document.exitFullscreen();
|
|
5725
5735
|
}
|
|
5726
|
-
else if (
|
|
5727
|
-
return
|
|
5736
|
+
else if (this.windowApi.document.msExitFullscreen) {
|
|
5737
|
+
return this.windowApi.document.msExitFullscreen();
|
|
5728
5738
|
}
|
|
5729
|
-
else if (
|
|
5730
|
-
return
|
|
5739
|
+
else if (this.windowApi.document.mozCancelFullScreen) {
|
|
5740
|
+
return this.windowApi.document.mozCancelFullScreen();
|
|
5731
5741
|
}
|
|
5732
|
-
else if (
|
|
5733
|
-
return
|
|
5742
|
+
else if (this.windowApi.document.webkitCancelFullScreen) {
|
|
5743
|
+
return this.windowApi.document.webkitCancelFullScreen();
|
|
5734
5744
|
}
|
|
5735
5745
|
else {
|
|
5736
5746
|
return new Promise((resolve, reject) => {
|
|
@@ -5825,7 +5835,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
5825
5835
|
if (Array.isArray(data)) {
|
|
5826
5836
|
data.sort(sortFunc);
|
|
5827
5837
|
}
|
|
5828
|
-
else if (data instanceof NodeList ||
|
|
5838
|
+
else if (data instanceof NodeList ||
|
|
5839
|
+
UtilsContext.isJQuery(data)) {
|
|
5829
5840
|
sortNodeFunc(data, getDataFunc);
|
|
5830
5841
|
result = getDataFunc();
|
|
5831
5842
|
}
|
|
@@ -5906,7 +5917,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
5906
5917
|
UtilsContext.tryCatch()
|
|
5907
5918
|
.error(() => {
|
|
5908
5919
|
try {
|
|
5909
|
-
result =
|
|
5920
|
+
result = UtilsContext.windowApi.window.eval("(" + data + ")");
|
|
5910
5921
|
}
|
|
5911
5922
|
catch (error2) {
|
|
5912
5923
|
if (typeof errorCallBack === "function") {
|
|
@@ -5983,11 +5994,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
5983
5994
|
waitNode(...args) {
|
|
5984
5995
|
// 过滤掉undefined
|
|
5985
5996
|
args = args.filter((arg) => arg !== void 0);
|
|
5986
|
-
let
|
|
5997
|
+
let UtilsContext = this;
|
|
5987
5998
|
// 选择器
|
|
5988
5999
|
let selector = args[0];
|
|
5989
6000
|
// 父元素(监听的元素)
|
|
5990
|
-
let parent =
|
|
6001
|
+
let parent = UtilsContext.windowApi.document;
|
|
5991
6002
|
// 超时时间
|
|
5992
6003
|
let timeout = 0;
|
|
5993
6004
|
if (typeof args[0] !== "string" && !Array.isArray(args[0])) {
|
|
@@ -6049,7 +6060,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
6049
6060
|
return parent.querySelector(selector);
|
|
6050
6061
|
}
|
|
6051
6062
|
}
|
|
6052
|
-
var observer =
|
|
6063
|
+
var observer = UtilsContext.mutationObserver(parent, {
|
|
6053
6064
|
config: {
|
|
6054
6065
|
subtree: true,
|
|
6055
6066
|
childList: true,
|
|
@@ -6082,11 +6093,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
6082
6093
|
waitAnyNode(...args) {
|
|
6083
6094
|
// 过滤掉undefined
|
|
6084
6095
|
args = args.filter((arg) => arg !== void 0);
|
|
6085
|
-
let
|
|
6096
|
+
let UtilsContext = this;
|
|
6086
6097
|
// 选择器
|
|
6087
6098
|
let selectorList = args[0];
|
|
6088
6099
|
// 父元素(监听的元素)
|
|
6089
|
-
let parent =
|
|
6100
|
+
let parent = UtilsContext.windowApi.document;
|
|
6090
6101
|
// 超时时间
|
|
6091
6102
|
let timeout = 0;
|
|
6092
6103
|
if (typeof args[0] !== "object" && !Array.isArray(args[0])) {
|
|
@@ -6131,18 +6142,18 @@ System.register('Utils', [], (function (exports) {
|
|
|
6131
6142
|
throw new TypeError("Utils.waitAnyNode 参数个数错误");
|
|
6132
6143
|
}
|
|
6133
6144
|
let promiseList = selectorList.map((selector) => {
|
|
6134
|
-
return
|
|
6145
|
+
return UtilsContext.waitNode(selector, parent, timeout);
|
|
6135
6146
|
});
|
|
6136
6147
|
return Promise.any(promiseList);
|
|
6137
6148
|
}
|
|
6138
6149
|
waitNodeList(...args) {
|
|
6139
6150
|
// 过滤掉undefined
|
|
6140
6151
|
args = args.filter((arg) => arg !== void 0);
|
|
6141
|
-
let
|
|
6152
|
+
let UtilsContext = this;
|
|
6142
6153
|
// 选择器数组
|
|
6143
6154
|
let selector = args[0];
|
|
6144
6155
|
// 父元素(监听的元素)
|
|
6145
|
-
let parent =
|
|
6156
|
+
let parent = UtilsContext.windowApi.document;
|
|
6146
6157
|
// 超时时间
|
|
6147
6158
|
let timeout = 0;
|
|
6148
6159
|
if (typeof args[0] !== "string" && !Array.isArray(args[0])) {
|
|
@@ -6207,7 +6218,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
6207
6218
|
}
|
|
6208
6219
|
}
|
|
6209
6220
|
}
|
|
6210
|
-
var observer =
|
|
6221
|
+
var observer = UtilsContext.mutationObserver(parent, {
|
|
6211
6222
|
config: {
|
|
6212
6223
|
subtree: true,
|
|
6213
6224
|
childList: true,
|
|
@@ -6241,11 +6252,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
6241
6252
|
waitAnyNodeList(...args) {
|
|
6242
6253
|
// 过滤掉undefined
|
|
6243
6254
|
args = args.filter((arg) => arg !== void 0);
|
|
6244
|
-
let
|
|
6255
|
+
let UtilsContext = this;
|
|
6245
6256
|
// 选择器数组
|
|
6246
6257
|
let selectorList = args[0];
|
|
6247
6258
|
// 父元素(监听的元素)
|
|
6248
|
-
let parent =
|
|
6259
|
+
let parent = UtilsContext.windowApi.document;
|
|
6249
6260
|
// 超时时间
|
|
6250
6261
|
let timeout = 0;
|
|
6251
6262
|
if (!Array.isArray(args[0])) {
|
|
@@ -6290,7 +6301,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
6290
6301
|
throw new TypeError("Utils.waitAnyNodeList 参数个数错误");
|
|
6291
6302
|
}
|
|
6292
6303
|
let promiseList = selectorList.map((selector) => {
|
|
6293
|
-
return
|
|
6304
|
+
return UtilsContext.waitNodeList(selector, parent, timeout);
|
|
6294
6305
|
});
|
|
6295
6306
|
return Promise.any(promiseList);
|
|
6296
6307
|
}
|
|
@@ -6493,12 +6504,12 @@ System.register('Utils', [], (function (exports) {
|
|
|
6493
6504
|
if (text.startsWith("//")) {
|
|
6494
6505
|
/* //www.baidu.com/xxxxxxx */
|
|
6495
6506
|
/* 没有protocol,加上 */
|
|
6496
|
-
text =
|
|
6507
|
+
text = this.windowApi.globalThis.location.protocol + text;
|
|
6497
6508
|
}
|
|
6498
6509
|
else if (text.startsWith("/")) {
|
|
6499
6510
|
/* /xxx/info?xxx=xxx */
|
|
6500
6511
|
/* 没有Origin,加上 */
|
|
6501
|
-
text =
|
|
6512
|
+
text = this.windowApi.globalThis.location.origin + text;
|
|
6502
6513
|
}
|
|
6503
6514
|
return new URL(text);
|
|
6504
6515
|
}
|