@whitesev/utils 1.9.7 → 1.9.8
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 +35 -18
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +35 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +35 -18
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +35 -18
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +35 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -211,6 +211,7 @@
|
|
|
211
211
|
decode(str) {
|
|
212
212
|
var GBKMatcher = /%[0-9A-F]{2}%[0-9A-F]{2}/;
|
|
213
213
|
var UTFMatcher = /%[0-9A-F]{2}/;
|
|
214
|
+
// @ts-ignore
|
|
214
215
|
var utf = true;
|
|
215
216
|
let that = this;
|
|
216
217
|
while (utf) {
|
|
@@ -1171,6 +1172,7 @@
|
|
|
1171
1172
|
let defaultEnable = Boolean(this.getLocalMenuData(menuLocalDataItemKey, menuOption.enable));
|
|
1172
1173
|
/** 油猴菜单上显示的文本 */
|
|
1173
1174
|
let showText = menuOption.showText(menuOption.text, defaultEnable);
|
|
1175
|
+
// @ts-ignore
|
|
1174
1176
|
({
|
|
1175
1177
|
/**
|
|
1176
1178
|
* 菜单的id
|
|
@@ -2543,6 +2545,7 @@
|
|
|
2543
2545
|
#storeName;
|
|
2544
2546
|
#dbVersion;
|
|
2545
2547
|
/* websql的版本号,由于ios的问题,版本号的写法不一样 */
|
|
2548
|
+
// @ts-ignore
|
|
2546
2549
|
#slqVersion = "1";
|
|
2547
2550
|
/* 监听IndexDB */
|
|
2548
2551
|
#indexedDB = UtilsCore.window.indexedDB ||
|
|
@@ -2551,6 +2554,7 @@
|
|
|
2551
2554
|
UtilsCore.window.msIndexedDB;
|
|
2552
2555
|
/* 缓存数据库,避免同一个页面重复创建和销毁 */
|
|
2553
2556
|
#db = {};
|
|
2557
|
+
// @ts-ignore
|
|
2554
2558
|
#store = null;
|
|
2555
2559
|
#errorCode = {
|
|
2556
2560
|
/* 错误码 */
|
|
@@ -2665,6 +2669,7 @@
|
|
|
2665
2669
|
let request = idbStore.put(inData);
|
|
2666
2670
|
request.onsuccess = function (event) {
|
|
2667
2671
|
/* 保存成功有success 字段 */
|
|
2672
|
+
// @ts-ignore
|
|
2668
2673
|
event.target;
|
|
2669
2674
|
resolve({
|
|
2670
2675
|
success: true,
|
|
@@ -2674,6 +2679,7 @@
|
|
|
2674
2679
|
});
|
|
2675
2680
|
};
|
|
2676
2681
|
request.onerror = function (event) {
|
|
2682
|
+
// @ts-ignore
|
|
2677
2683
|
event.target;
|
|
2678
2684
|
resolve({
|
|
2679
2685
|
success: false,
|
|
@@ -2735,6 +2741,7 @@
|
|
|
2735
2741
|
}
|
|
2736
2742
|
};
|
|
2737
2743
|
request.onerror = function (event) {
|
|
2744
|
+
// @ts-ignore
|
|
2738
2745
|
event.target;
|
|
2739
2746
|
resolve({
|
|
2740
2747
|
success: false,
|
|
@@ -2792,6 +2799,7 @@
|
|
|
2792
2799
|
});
|
|
2793
2800
|
};
|
|
2794
2801
|
request.onerror = function (event) {
|
|
2802
|
+
// @ts-ignore
|
|
2795
2803
|
event.target;
|
|
2796
2804
|
resolve({
|
|
2797
2805
|
success: false,
|
|
@@ -2846,6 +2854,7 @@
|
|
|
2846
2854
|
}
|
|
2847
2855
|
};
|
|
2848
2856
|
request.onerror = function (event) {
|
|
2857
|
+
// @ts-ignore
|
|
2849
2858
|
event.target;
|
|
2850
2859
|
resolve({
|
|
2851
2860
|
success: false,
|
|
@@ -5140,8 +5149,11 @@
|
|
|
5140
5149
|
let windowMutationObserver = UtilsCore.window.MutationObserver ||
|
|
5141
5150
|
UtilsCore.window.webkitMutationObserver ||
|
|
5142
5151
|
UtilsCore.window.MozMutationObserver;
|
|
5152
|
+
// 观察者对象
|
|
5143
5153
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
5144
|
-
observer_config
|
|
5154
|
+
if (typeof observer_config.callback === "function") {
|
|
5155
|
+
observer_config.callback(mutations, observer);
|
|
5156
|
+
}
|
|
5145
5157
|
});
|
|
5146
5158
|
if (Array.isArray(target) || target instanceof NodeList) {
|
|
5147
5159
|
// 传入的是数组或者元素数组
|
|
@@ -5160,7 +5172,9 @@
|
|
|
5160
5172
|
}
|
|
5161
5173
|
if (observer_config.immediate) {
|
|
5162
5174
|
/* 主动触发一次 */
|
|
5163
|
-
observer_config.callback
|
|
5175
|
+
if (typeof observer_config.callback === "function") {
|
|
5176
|
+
observer_config.callback([], mutationObserver);
|
|
5177
|
+
}
|
|
5164
5178
|
}
|
|
5165
5179
|
return mutationObserver;
|
|
5166
5180
|
}
|
|
@@ -5408,6 +5422,7 @@
|
|
|
5408
5422
|
EventTarget.prototype.addEventListener = function (...args) {
|
|
5409
5423
|
let type = args[0];
|
|
5410
5424
|
let callback = args[1];
|
|
5425
|
+
// @ts-ignore
|
|
5411
5426
|
args[2];
|
|
5412
5427
|
if (filter(type)) {
|
|
5413
5428
|
if (typeof callback === "function") {
|
|
@@ -5501,6 +5516,7 @@
|
|
|
5501
5516
|
}
|
|
5502
5517
|
async init() {
|
|
5503
5518
|
let copyStatus = false;
|
|
5519
|
+
// @ts-ignore
|
|
5504
5520
|
await this.requestClipboardPermission();
|
|
5505
5521
|
if (this.hasClipboard() &&
|
|
5506
5522
|
(this.hasClipboardWrite() || this.hasClipboardWriteText())) {
|
|
@@ -6034,12 +6050,7 @@
|
|
|
6034
6050
|
return parent.querySelector(selector);
|
|
6035
6051
|
}
|
|
6036
6052
|
}
|
|
6037
|
-
|
|
6038
|
-
if (node) {
|
|
6039
|
-
resolve(node);
|
|
6040
|
-
return;
|
|
6041
|
-
}
|
|
6042
|
-
let observer = that.mutationObserver(parent, {
|
|
6053
|
+
var observer = that.mutationObserver(parent, {
|
|
6043
6054
|
config: {
|
|
6044
6055
|
subtree: true,
|
|
6045
6056
|
childList: true,
|
|
@@ -6049,16 +6060,21 @@
|
|
|
6049
6060
|
let node = getNode();
|
|
6050
6061
|
if (node) {
|
|
6051
6062
|
// 取消观察器
|
|
6052
|
-
observer
|
|
6063
|
+
if (typeof observer?.disconnect === "function") {
|
|
6064
|
+
observer.disconnect();
|
|
6065
|
+
}
|
|
6053
6066
|
resolve(node);
|
|
6054
6067
|
return;
|
|
6055
6068
|
}
|
|
6056
6069
|
},
|
|
6070
|
+
immediate: true,
|
|
6057
6071
|
});
|
|
6058
6072
|
if (timeout > 0) {
|
|
6059
6073
|
setTimeout(() => {
|
|
6060
6074
|
// 取消观察器
|
|
6061
|
-
observer
|
|
6075
|
+
if (typeof observer?.disconnect === "function") {
|
|
6076
|
+
observer.disconnect();
|
|
6077
|
+
}
|
|
6062
6078
|
resolve(null);
|
|
6063
6079
|
}, timeout);
|
|
6064
6080
|
}
|
|
@@ -6192,12 +6208,7 @@
|
|
|
6192
6208
|
}
|
|
6193
6209
|
}
|
|
6194
6210
|
}
|
|
6195
|
-
|
|
6196
|
-
if (nodeList) {
|
|
6197
|
-
resolve(nodeList);
|
|
6198
|
-
return;
|
|
6199
|
-
}
|
|
6200
|
-
let observer = that.mutationObserver(parent, {
|
|
6211
|
+
var observer = that.mutationObserver(parent, {
|
|
6201
6212
|
config: {
|
|
6202
6213
|
subtree: true,
|
|
6203
6214
|
childList: true,
|
|
@@ -6207,16 +6218,22 @@
|
|
|
6207
6218
|
let node = getNodeList();
|
|
6208
6219
|
if (node) {
|
|
6209
6220
|
// 取消观察器
|
|
6210
|
-
|
|
6221
|
+
try {
|
|
6222
|
+
observer.disconnect();
|
|
6223
|
+
}
|
|
6224
|
+
catch (error) { }
|
|
6211
6225
|
resolve(node);
|
|
6212
6226
|
return;
|
|
6213
6227
|
}
|
|
6214
6228
|
},
|
|
6229
|
+
immediate: true,
|
|
6215
6230
|
});
|
|
6216
6231
|
if (timeout > 0) {
|
|
6217
6232
|
setTimeout(() => {
|
|
6218
6233
|
// 取消观察器
|
|
6219
|
-
observer
|
|
6234
|
+
if (typeof observer?.disconnect === "function") {
|
|
6235
|
+
observer.disconnect();
|
|
6236
|
+
}
|
|
6220
6237
|
resolve(null);
|
|
6221
6238
|
}, timeout);
|
|
6222
6239
|
}
|