Greasy Fork is available in English.

阿里云盘字幕

让你的视频文件和字幕文件梦幻联动!

< 脚本阿里云盘字幕的反馈

提问/评论

Deleted user 442467
§
发表于:2021-12-30
编辑于:2021-12-30

我们两个的脚本都有监听网络的行为,可能直观上所见有互相影响的诱因,所以恕我直言
const nativeSend = window.XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.send = function() {
console.log("this.openParams", this.openParams);
/*
整个网络连接中,有 this.openParams 的屈指可数
下面一行直接 this.openParams[1] 。。。大多数情况下this.openParams的值是undefined,undefined怎么可以直接this.openParams[1]
这里是影响网络通畅的根本原因,要命的是造成的影响并不能肉眼所见每次都能看见异常
*/
if (this.openParams[1].includes('file/list')) {
//即使是特定的网址之后绑定事件,但后续没有解除事件,这个事件是持续的,先判断固定的网址没有意义
this.addEventListener("load", function(event) {
let target = event.currentTarget
if (target.readyState == 4 && target.status == 200) {

}
})
}
nativeSend.apply(this, arguments)
}
恳请您使用下面或类似的代码
var send = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(data) {
this.addEventListener("load", function(event) {
if (this.readyState == 4 && this.status == 200) {
var response, responseURL = this.responseURL;
if (responseURL.indexOf("/file/list") > 0) {
response = JSON.parse(this.response);

}
}
}, false);
send.apply(this, arguments);
};

§
发表于:2021-12-30

谢谢啊 这里只是简单劫持 其实有很多问题
感谢建议

发表回复

登录以发表回复。