@whitesev/utils 1.9.3 → 1.9.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/dist/index.amd.js +72 -64
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +72 -64
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +72 -64
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +72 -64
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +72 -64
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +72 -64
- package/dist/index.umd.js.map +1 -1
- package/dist/src/UtilsCore.d.ts +6 -6
- package/package.json +47 -47
package/dist/index.amd.js
CHANGED
|
@@ -272,7 +272,7 @@ define((function () { 'use strict';
|
|
|
272
272
|
if (typeof cookieName !== "string") {
|
|
273
273
|
throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
|
|
274
274
|
}
|
|
275
|
-
let cookies = document.cookie.split(";");
|
|
275
|
+
let cookies = UtilsCore.document.cookie.split(";");
|
|
276
276
|
let findValue = void 0;
|
|
277
277
|
for (const cookieItem of cookies) {
|
|
278
278
|
let item = cookieItem.trim();
|
|
@@ -282,7 +282,7 @@ define((function () { 'use strict';
|
|
|
282
282
|
let itemValue = decodeURIComponent(itemSplit.join(""));
|
|
283
283
|
if (itemName === cookieName) {
|
|
284
284
|
findValue = {
|
|
285
|
-
domain: globalThis.location.hostname,
|
|
285
|
+
domain: UtilsCore.globalThis.location.hostname,
|
|
286
286
|
expirationDate: null,
|
|
287
287
|
hostOnly: true,
|
|
288
288
|
httpOnly: false,
|
|
@@ -312,13 +312,13 @@ define((function () { 'use strict';
|
|
|
312
312
|
let resultData = [];
|
|
313
313
|
try {
|
|
314
314
|
let details = {
|
|
315
|
-
url: globalThis.location.href,
|
|
316
|
-
domain: globalThis.location.hostname,
|
|
315
|
+
url: UtilsCore.globalThis.location.href,
|
|
316
|
+
domain: UtilsCore.globalThis.location.hostname,
|
|
317
317
|
name: "",
|
|
318
318
|
path: "/",
|
|
319
319
|
};
|
|
320
320
|
details = utils.assign(details, paramDetails);
|
|
321
|
-
let cookies = document.cookie.split(";");
|
|
321
|
+
let cookies = UtilsCore.document.cookie.split(";");
|
|
322
322
|
cookies.forEach((item) => {
|
|
323
323
|
item = item.trim();
|
|
324
324
|
let itemSplit = item.split("=");
|
|
@@ -330,7 +330,7 @@ define((function () { 'use strict';
|
|
|
330
330
|
: new RegExp("^" + details.name, "g");
|
|
331
331
|
if (itemName.match(nameRegexp)) {
|
|
332
332
|
resultData.push({
|
|
333
|
-
domain: globalThis.location.hostname,
|
|
333
|
+
domain: UtilsCore.globalThis.location.hostname,
|
|
334
334
|
expirationDate: null,
|
|
335
335
|
hostOnly: true,
|
|
336
336
|
httpOnly: false,
|
|
@@ -363,13 +363,13 @@ define((function () { 'use strict';
|
|
|
363
363
|
}
|
|
364
364
|
let resultData = [];
|
|
365
365
|
let details = {
|
|
366
|
-
url: globalThis.location.href,
|
|
367
|
-
domain: globalThis.location.hostname,
|
|
366
|
+
url: UtilsCore.globalThis.location.href,
|
|
367
|
+
domain: UtilsCore.globalThis.location.hostname,
|
|
368
368
|
name: "",
|
|
369
369
|
path: "/",
|
|
370
370
|
};
|
|
371
371
|
details = utils.assign(details, paramDetails);
|
|
372
|
-
let cookies = document.cookie.split(";");
|
|
372
|
+
let cookies = UtilsCore.document.cookie.split(";");
|
|
373
373
|
cookies.forEach((item) => {
|
|
374
374
|
item = item.trim();
|
|
375
375
|
let itemSplit = item.split("=");
|
|
@@ -381,7 +381,7 @@ define((function () { 'use strict';
|
|
|
381
381
|
: new RegExp("^" + details.name, "g");
|
|
382
382
|
if (itemName.match(nameRegexp)) {
|
|
383
383
|
resultData.push({
|
|
384
|
-
domain: globalThis.location.hostname,
|
|
384
|
+
domain: UtilsCore.globalThis.location.hostname,
|
|
385
385
|
expirationDate: null,
|
|
386
386
|
hostOnly: true,
|
|
387
387
|
httpOnly: false,
|
|
@@ -404,10 +404,10 @@ define((function () { 'use strict';
|
|
|
404
404
|
set(paramDetails, callback = (error) => { }) {
|
|
405
405
|
try {
|
|
406
406
|
let details = {
|
|
407
|
-
url: window.location.href,
|
|
407
|
+
url: UtilsCore.window.location.href,
|
|
408
408
|
name: "",
|
|
409
409
|
value: "",
|
|
410
|
-
domain: window.location.hostname,
|
|
410
|
+
domain: UtilsCore.window.location.hostname,
|
|
411
411
|
path: "/",
|
|
412
412
|
secure: true,
|
|
413
413
|
httpOnly: false,
|
|
@@ -426,7 +426,7 @@ define((function () { 'use strict';
|
|
|
426
426
|
";expires=" +
|
|
427
427
|
new Date(life).toGMTString() +
|
|
428
428
|
"; path=/";
|
|
429
|
-
document.cookie = cookieStr;
|
|
429
|
+
UtilsCore.document.cookie = cookieStr;
|
|
430
430
|
callback();
|
|
431
431
|
}
|
|
432
432
|
catch (error) {
|
|
@@ -441,14 +441,14 @@ define((function () { 'use strict';
|
|
|
441
441
|
delete(paramDetails, callback = (error) => { }) {
|
|
442
442
|
try {
|
|
443
443
|
let details = {
|
|
444
|
-
url: window.location.href,
|
|
444
|
+
url: UtilsCore.window.location.href,
|
|
445
445
|
name: "",
|
|
446
446
|
// @ts-ignore
|
|
447
447
|
firstPartyDomain: "",
|
|
448
448
|
};
|
|
449
449
|
details = utils.assign(details, paramDetails);
|
|
450
450
|
let cookieStr = details.name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
451
|
-
document.cookie = cookieStr;
|
|
451
|
+
UtilsCore.document.cookie = cookieStr;
|
|
452
452
|
callback();
|
|
453
453
|
}
|
|
454
454
|
catch (error) {
|
|
@@ -1217,7 +1217,7 @@ define((function () { 'use strict';
|
|
|
1217
1217
|
}
|
|
1218
1218
|
/* 不刷新网页就刷新菜单 */
|
|
1219
1219
|
if (menuOption.autoReload) {
|
|
1220
|
-
window.location.reload();
|
|
1220
|
+
UtilsCore.window.location.reload();
|
|
1221
1221
|
}
|
|
1222
1222
|
else {
|
|
1223
1223
|
that.context.update();
|
|
@@ -1909,13 +1909,14 @@ define((function () { 'use strict';
|
|
|
1909
1909
|
}
|
|
1910
1910
|
catch (error) {
|
|
1911
1911
|
if (details.url.startsWith("//")) {
|
|
1912
|
-
details.url = globalThis.location.protocol + details.url;
|
|
1912
|
+
details.url = UtilsCore.globalThis.location.protocol + details.url;
|
|
1913
1913
|
}
|
|
1914
1914
|
else if (details.url.startsWith("/")) {
|
|
1915
|
-
details.url = globalThis.location.origin + details.url;
|
|
1915
|
+
details.url = UtilsCore.globalThis.location.origin + details.url;
|
|
1916
1916
|
}
|
|
1917
1917
|
else {
|
|
1918
|
-
details.url =
|
|
1918
|
+
details.url =
|
|
1919
|
+
UtilsCore.globalThis.location.origin + "/" + details.url;
|
|
1919
1920
|
}
|
|
1920
1921
|
}
|
|
1921
1922
|
return details;
|
|
@@ -2540,10 +2541,10 @@ define((function () { 'use strict';
|
|
|
2540
2541
|
/* websql的版本号,由于ios的问题,版本号的写法不一样 */
|
|
2541
2542
|
#slqVersion = "1";
|
|
2542
2543
|
/* 监听IndexDB */
|
|
2543
|
-
#indexedDB = window.indexedDB ||
|
|
2544
|
-
window.mozIndexedDB ||
|
|
2545
|
-
window.webkitIndexedDB ||
|
|
2546
|
-
window.msIndexedDB;
|
|
2544
|
+
#indexedDB = UtilsCore.window.indexedDB ||
|
|
2545
|
+
UtilsCore.window.mozIndexedDB ||
|
|
2546
|
+
UtilsCore.window.webkitIndexedDB ||
|
|
2547
|
+
UtilsCore.window.msIndexedDB;
|
|
2547
2548
|
/* 缓存数据库,避免同一个页面重复创建和销毁 */
|
|
2548
2549
|
#db = {};
|
|
2549
2550
|
#store = null;
|
|
@@ -2967,7 +2968,7 @@ define((function () { 'use strict';
|
|
|
2967
2968
|
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}},或者直接是一个字符串
|
|
2968
2969
|
* @param console 可指定console对象为unsafeWindow下的console或者是油猴window下的console
|
|
2969
2970
|
*/
|
|
2970
|
-
constructor(_GM_info_, console =
|
|
2971
|
+
constructor(_GM_info_, console = UtilsCore.window.console) {
|
|
2971
2972
|
if (typeof _GM_info_ === "string") {
|
|
2972
2973
|
this.tag = _GM_info_;
|
|
2973
2974
|
}
|
|
@@ -3228,12 +3229,14 @@ define((function () { 'use strict';
|
|
|
3228
3229
|
/* 元素高度 */
|
|
3229
3230
|
this.#height = this.#config.canvasNode.height;
|
|
3230
3231
|
/* 清除锯齿 */
|
|
3231
|
-
if (window.devicePixelRatio) {
|
|
3232
|
+
if (UtilsCore.window.devicePixelRatio) {
|
|
3232
3233
|
this.#config.canvasNode.style.width = this.#width + "px";
|
|
3233
3234
|
this.#config.canvasNode.style.height = this.#height + "px";
|
|
3234
|
-
this.#config.canvasNode.height =
|
|
3235
|
-
|
|
3236
|
-
this.#
|
|
3235
|
+
this.#config.canvasNode.height =
|
|
3236
|
+
this.#height * UtilsCore.window.devicePixelRatio;
|
|
3237
|
+
this.#config.canvasNode.width =
|
|
3238
|
+
this.#width * UtilsCore.window.devicePixelRatio;
|
|
3239
|
+
this.#ctx.scale(UtilsCore.window.devicePixelRatio, UtilsCore.window.devicePixelRatio);
|
|
3237
3240
|
}
|
|
3238
3241
|
/* 设置线宽 */
|
|
3239
3242
|
this.#ctx.lineWidth = this.#config.lineWidth;
|
|
@@ -3512,24 +3515,24 @@ define((function () { 'use strict';
|
|
|
3512
3515
|
if (typeof cssText !== "string") {
|
|
3513
3516
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
3514
3517
|
}
|
|
3515
|
-
let cssNode = document.createElement("style");
|
|
3518
|
+
let cssNode = UtilsCore.document.createElement("style");
|
|
3516
3519
|
cssNode.setAttribute("type", "text/css");
|
|
3517
3520
|
cssNode.innerHTML = cssText;
|
|
3518
|
-
if (document.head) {
|
|
3521
|
+
if (UtilsCore.document.head) {
|
|
3519
3522
|
/* 插入head最后 */
|
|
3520
|
-
document.head.appendChild(cssNode);
|
|
3523
|
+
UtilsCore.document.head.appendChild(cssNode);
|
|
3521
3524
|
}
|
|
3522
|
-
else if (document.body) {
|
|
3525
|
+
else if (UtilsCore.document.body) {
|
|
3523
3526
|
/* 插入body后 */
|
|
3524
|
-
document.body.appendChild(cssNode);
|
|
3527
|
+
UtilsCore.document.body.appendChild(cssNode);
|
|
3525
3528
|
}
|
|
3526
|
-
else if (document.documentElement.childNodes.length === 0) {
|
|
3529
|
+
else if (UtilsCore.document.documentElement.childNodes.length === 0) {
|
|
3527
3530
|
/* 插入#html第一个元素后 */
|
|
3528
|
-
document.documentElement.appendChild(cssNode);
|
|
3531
|
+
UtilsCore.document.documentElement.appendChild(cssNode);
|
|
3529
3532
|
}
|
|
3530
3533
|
else {
|
|
3531
3534
|
/* 插入head前面 */
|
|
3532
|
-
document.documentElement.insertBefore(cssNode, document.documentElement.childNodes[0]);
|
|
3535
|
+
UtilsCore.document.documentElement.insertBefore(cssNode, UtilsCore.document.documentElement.childNodes[0]);
|
|
3533
3536
|
}
|
|
3534
3537
|
return cssNode;
|
|
3535
3538
|
}
|
|
@@ -3660,7 +3663,8 @@ define((function () { 'use strict';
|
|
|
3660
3663
|
let elementPosXRight = Number(element.getBoundingClientRect().right); /* 要检测的元素的相对屏幕的横坐标最右边 */
|
|
3661
3664
|
let elementPosYTop = Number(element.getBoundingClientRect().top); /* 要检测的元素的相对屏幕的纵坐标最上边 */
|
|
3662
3665
|
let elementPosYBottom = Number(element.getBoundingClientRect().bottom); /* 要检测的元素的相对屏幕的纵坐标最下边 */
|
|
3663
|
-
let clickNodeHTML = window.event.target
|
|
3666
|
+
let clickNodeHTML = UtilsCore.window.event.target
|
|
3667
|
+
.innerHTML;
|
|
3664
3668
|
if (mouseClickPosX >= elementPosXLeft &&
|
|
3665
3669
|
mouseClickPosX <= elementPosXRight &&
|
|
3666
3670
|
mouseClickPosY >= elementPosYTop &&
|
|
@@ -3788,18 +3792,18 @@ define((function () { 'use strict';
|
|
|
3788
3792
|
}
|
|
3789
3793
|
if (isIFrame) {
|
|
3790
3794
|
/* 使用iframe */
|
|
3791
|
-
const iframeElement = document.createElement("iframe");
|
|
3795
|
+
const iframeElement = UtilsCore.document.createElement("iframe");
|
|
3792
3796
|
iframeElement.style.display = "none";
|
|
3793
3797
|
iframeElement.src = base64Data;
|
|
3794
|
-
document.body.appendChild(iframeElement);
|
|
3798
|
+
UtilsCore.document.body.appendChild(iframeElement);
|
|
3795
3799
|
setTimeout(() => {
|
|
3796
3800
|
iframeElement.contentWindow.document.execCommand("SaveAs", true, fileName);
|
|
3797
|
-
document.body.removeChild(iframeElement);
|
|
3801
|
+
UtilsCore.document.body.removeChild(iframeElement);
|
|
3798
3802
|
}, 100);
|
|
3799
3803
|
}
|
|
3800
3804
|
else {
|
|
3801
3805
|
/* 使用A标签 */
|
|
3802
|
-
const linkElement = document.createElement("a");
|
|
3806
|
+
const linkElement = UtilsCore.document.createElement("a");
|
|
3803
3807
|
linkElement.setAttribute("target", "_blank");
|
|
3804
3808
|
linkElement.download = fileName;
|
|
3805
3809
|
linkElement.href = base64Data;
|
|
@@ -3813,7 +3817,7 @@ define((function () { 'use strict';
|
|
|
3813
3817
|
/* CODE FOR BROWSERS THAT SUPPORT window.find */
|
|
3814
3818
|
let windowFind = UtilsCore.self.find;
|
|
3815
3819
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3816
|
-
if (strFound && self.getSelection && !self.getSelection().anchorNode) {
|
|
3820
|
+
if (strFound && UtilsCore.self.getSelection && !UtilsCore.self.getSelection().anchorNode) {
|
|
3817
3821
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3818
3822
|
}
|
|
3819
3823
|
if (!strFound) {
|
|
@@ -4208,8 +4212,8 @@ define((function () { 'use strict';
|
|
|
4208
4212
|
let maxZIndexCompare = 2 * Math.pow(10, 9);
|
|
4209
4213
|
// 当前页面最大的z-index
|
|
4210
4214
|
let zIndex = 0;
|
|
4211
|
-
document.querySelectorAll("*").forEach((
|
|
4212
|
-
let nodeStyle = window.getComputedStyle(
|
|
4215
|
+
UtilsCore.document.querySelectorAll("*").forEach(($ele, index) => {
|
|
4216
|
+
let nodeStyle = UtilsCore.window.getComputedStyle($ele);
|
|
4213
4217
|
/* 不对position为static和display为none的元素进行获取它们的z-index */
|
|
4214
4218
|
if (nodeStyle.position !== "static" && nodeStyle.display !== "none") {
|
|
4215
4219
|
let nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
@@ -4423,7 +4427,7 @@ define((function () { 'use strict';
|
|
|
4423
4427
|
if (url.trim() === "") {
|
|
4424
4428
|
throw new TypeError("url不能为空字符串或纯空格");
|
|
4425
4429
|
}
|
|
4426
|
-
return `thunder://${globalThis.btoa("AA" + url + "ZZ")}`;
|
|
4430
|
+
return `thunder://${UtilsCore.globalThis.btoa("AA" + url + "ZZ")}`;
|
|
4427
4431
|
}
|
|
4428
4432
|
/**
|
|
4429
4433
|
* 对于GM_cookie的兼容写法,当无法使用GM_cookie时可以使用这个,但是并不完全兼容,有些写不出来且限制了httponly是无法访问的
|
|
@@ -4638,9 +4642,11 @@ define((function () { 'use strict';
|
|
|
4638
4642
|
return Boolean(target.toString().match(/^function .*\(\) { \[native code\] }$/));
|
|
4639
4643
|
}
|
|
4640
4644
|
isNearBottom(nearValue = 50) {
|
|
4641
|
-
var scrollTop = window.pageYOffset ||
|
|
4642
|
-
|
|
4643
|
-
var
|
|
4645
|
+
var scrollTop = UtilsCore.window.pageYOffset ||
|
|
4646
|
+
UtilsCore.document.documentElement.scrollTop;
|
|
4647
|
+
var windowHeight = UtilsCore.window.innerHeight ||
|
|
4648
|
+
UtilsCore.document.documentElement.clientHeight;
|
|
4649
|
+
var documentHeight = UtilsCore.document.documentElement.scrollHeight;
|
|
4644
4650
|
return scrollTop + windowHeight >= documentHeight - nearValue;
|
|
4645
4651
|
}
|
|
4646
4652
|
isDOM(target) {
|
|
@@ -4883,7 +4889,7 @@ define((function () { 'use strict';
|
|
|
4883
4889
|
return result;
|
|
4884
4890
|
}
|
|
4885
4891
|
isThemeDark() {
|
|
4886
|
-
return globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
4892
|
+
return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
4887
4893
|
}
|
|
4888
4894
|
isVisible(element, inView = false) {
|
|
4889
4895
|
let needCheckDomList = [];
|
|
@@ -4896,15 +4902,17 @@ define((function () { 'use strict';
|
|
|
4896
4902
|
}
|
|
4897
4903
|
let result = true;
|
|
4898
4904
|
for (const domItem of needCheckDomList) {
|
|
4899
|
-
let domDisplay = window.getComputedStyle(domItem);
|
|
4905
|
+
let domDisplay = UtilsCore.window.getComputedStyle(domItem);
|
|
4900
4906
|
if (domDisplay.display === "none") {
|
|
4901
4907
|
result = false;
|
|
4902
4908
|
}
|
|
4903
4909
|
else {
|
|
4904
4910
|
let domClientRect = domItem.getBoundingClientRect();
|
|
4905
4911
|
if (inView) {
|
|
4906
|
-
let viewportWidth = window.innerWidth ||
|
|
4907
|
-
|
|
4912
|
+
let viewportWidth = UtilsCore.window.innerWidth ||
|
|
4913
|
+
UtilsCore.document.documentElement.clientWidth;
|
|
4914
|
+
let viewportHeight = UtilsCore.window.innerHeight ||
|
|
4915
|
+
UtilsCore.document.documentElement.clientHeight;
|
|
4908
4916
|
result = !(domClientRect.right < 0 ||
|
|
4909
4917
|
domClientRect.left > viewportWidth ||
|
|
4910
4918
|
domClientRect.bottom < 0 ||
|
|
@@ -5127,7 +5135,7 @@ define((function () { 'use strict';
|
|
|
5127
5135
|
immediate: false,
|
|
5128
5136
|
};
|
|
5129
5137
|
observer_config = UtilsContext.assign(default_obverser_config, observer_config);
|
|
5130
|
-
let windowMutationObserver = window.MutationObserver ||
|
|
5138
|
+
let windowMutationObserver = UtilsCore.window.MutationObserver ||
|
|
5131
5139
|
UtilsCore.window.webkitMutationObserver ||
|
|
5132
5140
|
UtilsCore.window.MozMutationObserver;
|
|
5133
5141
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
@@ -5446,7 +5454,7 @@ define((function () { 'use strict';
|
|
|
5446
5454
|
return isNegative ? -reversedNum : reversedNum;
|
|
5447
5455
|
}
|
|
5448
5456
|
selectElementText(element, childTextNode, startIndex, endIndex) {
|
|
5449
|
-
let range = document.createRange();
|
|
5457
|
+
let range = UtilsCore.document.createRange();
|
|
5450
5458
|
range.selectNodeContents(element);
|
|
5451
5459
|
if (childTextNode) {
|
|
5452
5460
|
if (childTextNode.nodeType !== Node.TEXT_NODE) {
|
|
@@ -5457,7 +5465,7 @@ define((function () { 'use strict';
|
|
|
5457
5465
|
range.setEnd(childTextNode, endIndex);
|
|
5458
5466
|
}
|
|
5459
5467
|
}
|
|
5460
|
-
let selection = globalThis.getSelection();
|
|
5468
|
+
let selection = UtilsCore.globalThis.getSelection();
|
|
5461
5469
|
if (selection) {
|
|
5462
5470
|
selection.removeAllRanges();
|
|
5463
5471
|
selection.addRange(range);
|
|
@@ -5538,15 +5546,15 @@ define((function () { 'use strict';
|
|
|
5538
5546
|
*/
|
|
5539
5547
|
copyTextByTextArea() {
|
|
5540
5548
|
try {
|
|
5541
|
-
let copyElement = document.createElement("textarea");
|
|
5549
|
+
let copyElement = UtilsCore.document.createElement("textarea");
|
|
5542
5550
|
copyElement.value = this.#copyData;
|
|
5543
5551
|
copyElement.setAttribute("type", "text");
|
|
5544
5552
|
copyElement.setAttribute("style", "opacity:0;position:absolute;");
|
|
5545
5553
|
copyElement.setAttribute("readonly", "readonly");
|
|
5546
|
-
document.body.appendChild(copyElement);
|
|
5554
|
+
UtilsCore.document.body.appendChild(copyElement);
|
|
5547
5555
|
copyElement.select();
|
|
5548
|
-
document.execCommand("copy");
|
|
5549
|
-
document.body.removeChild(copyElement);
|
|
5556
|
+
UtilsCore.document.execCommand("copy");
|
|
5557
|
+
UtilsCore.document.body.removeChild(copyElement);
|
|
5550
5558
|
return true;
|
|
5551
5559
|
}
|
|
5552
5560
|
catch (error) {
|
|
@@ -5623,11 +5631,11 @@ define((function () { 'use strict';
|
|
|
5623
5631
|
}
|
|
5624
5632
|
return new Promise((resolve) => {
|
|
5625
5633
|
const utilsClipboard = new UtilsClipboard(resolve, data, textType);
|
|
5626
|
-
if (document.hasFocus()) {
|
|
5634
|
+
if (UtilsCore.document.hasFocus()) {
|
|
5627
5635
|
utilsClipboard.init();
|
|
5628
5636
|
}
|
|
5629
5637
|
else {
|
|
5630
|
-
window.addEventListener("focus", () => {
|
|
5638
|
+
UtilsCore.window.addEventListener("focus", () => {
|
|
5631
5639
|
utilsClipboard.init();
|
|
5632
5640
|
}, { once: true });
|
|
5633
5641
|
}
|
|
@@ -5660,12 +5668,12 @@ define((function () { 'use strict';
|
|
|
5660
5668
|
dragSlider(selector, offsetX = UtilsCore.window.innerWidth) {
|
|
5661
5669
|
function initMouseEvent(eventName, offSetX, offSetY) {
|
|
5662
5670
|
let win = unsafeWindow || window;
|
|
5663
|
-
let mouseEvent = document.createEvent("MouseEvents");
|
|
5671
|
+
let mouseEvent = UtilsCore.document.createEvent("MouseEvents");
|
|
5664
5672
|
mouseEvent.initMouseEvent(eventName, true, true, win, 0, offSetX, offSetY, offSetX, offSetY, false, false, false, false, 0, null);
|
|
5665
5673
|
return mouseEvent;
|
|
5666
5674
|
}
|
|
5667
5675
|
let sliderElement = typeof selector === "string"
|
|
5668
|
-
? document.querySelector(selector)
|
|
5676
|
+
? UtilsCore.document.querySelector(selector)
|
|
5669
5677
|
: selector;
|
|
5670
5678
|
if (!(sliderElement instanceof Node) ||
|
|
5671
5679
|
!(sliderElement instanceof Element)) {
|
|
@@ -5699,7 +5707,7 @@ define((function () { 'use strict';
|
|
|
5699
5707
|
console.error(err);
|
|
5700
5708
|
}
|
|
5701
5709
|
}
|
|
5702
|
-
exitFullScreen(element = document.documentElement) {
|
|
5710
|
+
exitFullScreen(element = UtilsCore.document.documentElement) {
|
|
5703
5711
|
if (UtilsCore.document.exitFullscreen) {
|
|
5704
5712
|
return UtilsCore.document.exitFullscreen();
|
|
5705
5713
|
}
|