@whitesev/utils 1.9.5 → 1.9.7
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 +8 -15
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +8 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +8 -15
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +8 -15
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +8 -15
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{src → types/src}/AjaxHookerType.d.ts +0 -0
- /package/dist/{src → types/src}/ColorConversion.d.ts +0 -0
- /package/dist/{src → types/src}/Dictionary.d.ts +0 -0
- /package/dist/{src → types/src}/Event.d.ts +0 -0
- /package/dist/{src → types/src}/GBKEncoder.d.ts +0 -0
- /package/dist/{src → types/src}/Hooks.d.ts +0 -0
- /package/dist/{src → types/src}/Httpx.d.ts +0 -0
- /package/dist/{src → types/src}/LockFunction.d.ts +0 -0
- /package/dist/{src → types/src}/Log.d.ts +0 -0
- /package/dist/{src → types/src}/Progress.d.ts +0 -0
- /package/dist/{src → types/src}/TryCatch.d.ts +0 -0
- /package/dist/{src → types/src}/Utils.d.ts +0 -0
- /package/dist/{src → types/src}/UtilsCommon.d.ts +0 -0
- /package/dist/{src → types/src}/UtilsCore.d.ts +0 -0
- /package/dist/{src → types/src}/UtilsGMCookie.d.ts +0 -0
- /package/dist/{src → types/src}/UtilsGMMenu.d.ts +0 -0
- /package/dist/{src → types/src}/VueObject.d.ts +0 -0
- /package/dist/{src → types/src}/ajaxHooker/ajaxHooker.d.ts +0 -0
- /package/dist/{src → types/src}/indexedDB.d.ts +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -3815,7 +3815,9 @@ class Utils {
|
|
|
3815
3815
|
/* CODE FOR BROWSERS THAT SUPPORT window.find */
|
|
3816
3816
|
let windowFind = UtilsCore.self.find;
|
|
3817
3817
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3818
|
-
if (strFound &&
|
|
3818
|
+
if (strFound &&
|
|
3819
|
+
UtilsCore.self.getSelection &&
|
|
3820
|
+
!UtilsCore.self.getSelection().anchorNode) {
|
|
3819
3821
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3820
3822
|
}
|
|
3821
3823
|
if (!strFound) {
|
|
@@ -4887,7 +4889,8 @@ class Utils {
|
|
|
4887
4889
|
return result;
|
|
4888
4890
|
}
|
|
4889
4891
|
isThemeDark() {
|
|
4890
|
-
return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4892
|
+
return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4893
|
+
.matches;
|
|
4891
4894
|
}
|
|
4892
4895
|
isVisible(element, inView = false) {
|
|
4893
4896
|
let needCheckDomList = [];
|
|
@@ -5086,11 +5089,6 @@ class Utils {
|
|
|
5086
5089
|
}
|
|
5087
5090
|
mutationObserver(target, observer_config) {
|
|
5088
5091
|
let UtilsContext = this;
|
|
5089
|
-
if (!(target instanceof Node) &&
|
|
5090
|
-
!(target instanceof NodeList) &&
|
|
5091
|
-
!UtilsContext.isJQuery(target)) {
|
|
5092
|
-
throw new Error("Utils.mutationObserver 参数 target 必须为 Node|NodeList|jQuery类型");
|
|
5093
|
-
}
|
|
5094
5092
|
let default_obverser_config = {
|
|
5095
5093
|
/* 监听到元素有反馈,需执行的函数 */
|
|
5096
5094
|
callback: () => { },
|
|
@@ -5139,12 +5137,8 @@ class Utils {
|
|
|
5139
5137
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
5140
5138
|
observer_config?.callback(mutations, observer);
|
|
5141
5139
|
});
|
|
5142
|
-
if (target instanceof
|
|
5143
|
-
|
|
5144
|
-
mutationObserver.observe(target, observer_config.config);
|
|
5145
|
-
}
|
|
5146
|
-
else if (target instanceof NodeList) {
|
|
5147
|
-
/* 传入的参数是节点元素数组 */
|
|
5140
|
+
if (Array.isArray(target) || target instanceof NodeList) {
|
|
5141
|
+
// 传入的是数组或者元素数组
|
|
5148
5142
|
target.forEach((item) => {
|
|
5149
5143
|
mutationObserver.observe(item, observer_config.config);
|
|
5150
5144
|
});
|
|
@@ -5156,8 +5150,7 @@ class Utils {
|
|
|
5156
5150
|
});
|
|
5157
5151
|
}
|
|
5158
5152
|
else {
|
|
5159
|
-
|
|
5160
|
-
console.error("Utils.mutationObserver 未知参数", arguments);
|
|
5153
|
+
mutationObserver.observe(target, observer_config.config);
|
|
5161
5154
|
}
|
|
5162
5155
|
if (observer_config.immediate) {
|
|
5163
5156
|
/* 主动触发一次 */
|