@whitesev/utils 1.4.3 → 1.4.4
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 +7 -5
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +7 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +7 -5
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +7 -5
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +7 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +1 -1
- package/src/ajaxHooker/ajaxHooker.js +6 -4
package/dist/index.umd.js
CHANGED
|
@@ -464,13 +464,14 @@
|
|
|
464
464
|
/// <reference path="./index.d.ts" />
|
|
465
465
|
// @name ajaxHooker
|
|
466
466
|
// @author cxxjackie
|
|
467
|
-
// @version 1.4.
|
|
468
|
-
// @updateLog
|
|
467
|
+
// @version 1.4.3
|
|
468
|
+
// @updateLog 修复特殊情况下有部分请求头丢失的问题。
|
|
469
|
+
// @updateLog xhr事件增加currentTarget劫持。
|
|
469
470
|
// @supportURL https://bbs.tampermonkey.net.cn/thread-3284-1-1.html
|
|
470
471
|
|
|
471
472
|
const AjaxHooker = function () {
|
|
472
473
|
return function() {
|
|
473
|
-
const version = '1.4.
|
|
474
|
+
const version = '1.4.3';
|
|
474
475
|
const hookInst = {
|
|
475
476
|
hookFns: [],
|
|
476
477
|
filters: []
|
|
@@ -725,6 +726,7 @@
|
|
|
725
726
|
dispatchEvent(e) {
|
|
726
727
|
e.stopImmediatePropagation = stopImmediatePropagation;
|
|
727
728
|
defineProp(e, 'target', () => this.proxyXhr);
|
|
729
|
+
defineProp(e, 'currentTarget', () => this.proxyXhr);
|
|
728
730
|
this.proxyEvents[e.type] && this.proxyEvents[e.type].forEach(fn => {
|
|
729
731
|
this.resThenable.then(() => !e.ajaxHooker_isStopped && fn.call(this.proxyXhr, e));
|
|
730
732
|
});
|
|
@@ -734,7 +736,7 @@
|
|
|
734
736
|
}
|
|
735
737
|
setRequestHeader(header, value) {
|
|
736
738
|
this.originalXhr.setRequestHeader(header, value);
|
|
737
|
-
if (this.
|
|
739
|
+
if (!this.request) return;
|
|
738
740
|
const headers = this.request.headers;
|
|
739
741
|
headers[header] = header in headers ? `${headers[header]}, ${value}` : value;
|
|
740
742
|
}
|
|
@@ -3063,7 +3065,7 @@
|
|
|
3063
3065
|
UtilsCore.init(option);
|
|
3064
3066
|
}
|
|
3065
3067
|
/** 版本号 */
|
|
3066
|
-
version = "2024.6.
|
|
3068
|
+
version = "2024.6.14";
|
|
3067
3069
|
addStyle(cssText) {
|
|
3068
3070
|
if (typeof cssText !== "string") {
|
|
3069
3071
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|