1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//ARMS监控开始===================================
!(function (c, b, d, a) {
c[a] || (c[a] = {}); c[a].config = { //disabledHook:true, 加上此属性 api将只能手动上报
pid: "ihdx2@043e593cad8efa9", appType: "web", imgUrl: "https://arms-retcode.aliyuncs.com/r.png?", sendResource: true, behavior: true, enableConsole: true, enableLinkTrace:true,
ignore: {
ignoreApis:
function(str) { // 方法
if (str && (str && (str.toLocaleLowerCase().indexOf('acadsoc') < 0 && str.indexOf("/")!=0)))
{
return true; //忽略不是acadsoc的api
}
return false;
}
},
urlHelper:function(page){
return page;
}
};
with (b) with (body) with (insertBefore(createElement("script"), firstChild)) setAttribute("crossorigin", "", src = d)
})(window, document, "https://retcode.alicdn.com/retcode/bl.js", "__bl");
//ARMS监控结束===================================
/* 因和53客服冲突 暂时禁用
//api 监控开始===================================
var open = window.XMLHttpRequest.prototype.open,
send = window.XMLHttpRequest.prototype.send,
onReadyStateChange;
var timeList = [];
function openReplacement(method, url, async, user, password) {
var syncMode = async !== false ? 'async' : 'sync';
console.warn(
'Preparing ' +
syncMode +
' HTTP request : ' +
method +
' ' +
url
);
if (url && (/(http.*:\/\/.*acadsoc.com.cn\/ajax\/|^\/)/gi.test(url)))
{
timeList.push({url:url , begin:Date.now()});
}
console.log("reqopenReplacementuest:"+url);
return open.apply(this, arguments);
}
function sendReplacement(data) {
//console.warn('Sending HTTP request data : ', data);
if(this.onreadystatechange) {
this._onreadystatechange = this.onreadystatechange;
}
this.onreadystatechange = onReadyStateChangeReplacement;
console.log("sendReplacement:");
return send.apply(this, arguments);
}
function onReadyStateChangeReplacement() {
//console.warn('HTTP request ready state changed : ' + this.readyState);
if (this.responseURL && (/(http.*:\/\/.*acadsoc.com.cn\/ajax\/|^\/)/gi.test(this.responseURL))) //忽略不是acadsoc的api
{
var currentUrl = this.responseURL;
var current = timeList.filter(function(item){
return currentUrl.indexOf(item.url) >= 0;
});
var execTime = current&¤t.length>0 ? Date.now() - current[0].begin: -1;
//校验返回值
var respone = this.responseText;
if(this.status != 200)
{
window.__bl && __bl.api(currentUrl, false, execTime, 'lps ERROR-status:' + this.status, respone);
}
try {
var obj = JSON.parse(respone);
if(typeof obj == 'object' && obj)
{
//json/对象
if(currentUrl.indexOf("SMSCode")>0) //验证码发送出错
{
if("code" in obj && obj["code"] ==-3 ){
window.__bl && __bl.api(currentUrl, false, execTime, "-3 验证码发送出错", respone);
}
else if("value" in obj && obj["value"]["code"] ==-3){
window.__bl && __bl.api(currentUrl, false, execTime, "-3 验证码发送出错", respone);
}
}
else if(currentUrl.indexOf("Register")>0){ //注册出错
if("_r" in obj&& obj[_r] == -4)
{
window.__bl && __bl.api(currentUrl, false, execTime, "-4 注册出错", respone);
}
}
}
else if (typeof obj == 'number')
{
//数字
}
else if (typeof obj == 'boolean')
{
//bool
}
else{
console.log("api monitor else " + respone);
window.__bl && __bl.api(currentUrl, true, execTime, "api monitor else", respone);
}
} catch(e) {
window.__bl && __bl.api(currentUrl, false, execTime, 'lps respone ERROR:' + e.message, respone);
}
}
if(this._onreadystatechange) {
return this._onreadystatechange.apply(this, arguments);
}
}
window.XMLHttpRequest.prototype.open = openReplacement;
window.XMLHttpRequest.prototype.send = sendReplacement;
//api 监控结束===================================
*/
//按钮监控开始===================================
var currentEle=null;
window.onerror = function (errorMessage, scriptURI, lineNo, columNo, error) {
if(currentEle&¤tEle.indexOf("button")>=0){
window.__bl && __bl.error(new Error('lps 功能异常 ' + error.stack), {
filename: scriptURI,
lineno: lineNo,
colno: columNo,
stack: error,
element: currentEle
});
}
}
document.addEventListener('mousedown', function (ev) {
currentEle = ev.target.type + "_" + ev.target.tagName + "_" + ev.target.name + "_" + ev.target.value + "_" + ev.target.id;
//console.log(333+"_click_" + ev.target.type + "_" + ev.target.tagName + "_" + ev.target.name + "_" + ev.target.value + "_" + ev.target.id);
})
//按钮监控结束===================================