try to take over the world!
当前为
// ==UserScript==
// @name 微信防撤销
// @namespace http://tampermonkey.net/
// @version 1.0.0.1002
// @description try to take over the world!
// @author nkxyz
// @match https://wx.qq.com/*
// @grant none
// ==/UserScript==
function modifyResponse(response) {
var original_response, modified_response;
if (this.readyState === 4) {
if (this.requestURL && this.requestURL.indexOf("mmwebwx-bin/webwxsync") > 0 && this.requestMethod === "POST") {
original_response = response.target.responseText;
// try{
modified_response = JSON.parse(original_response);
//console.log(modified_response)
if(modified_response.AddMsgList && modified_response.AddMsgList.length > 0){
var msgType = modified_response.AddMsgList[0].MsgType;
var info = modified_response.AddMsgList[0];
if ( msgType === 10002){
Object.defineProperty(this, "response", {writable: true});
modified_response.AddMsgList[0].MsgType = 1;
modified_response = JSON.stringify(modified_response);
this.response = modified_response;
}
}
// }catch(e){
// this.responseText = original_response
// }
}
}
}
function openBypass(original_function) {
return function(method, url, async) {
// 保存请求相关参数
this.requestMethod = method;
this.requestURL = url;
this.addEventListener("readystatechange", modifyResponse);
return original_function.apply(this, arguments);
};
}
function sendBypass(original_function) {
return function(data) {
// 保存请求相关参数
this.requestData = data;
return original_function.apply(this, arguments);
};
}
XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
//XMLHttpRequest.prototype.send = sendBypass(XMLHttpRequest.prototype.send);