初始化注册鼠标事件和注册提交id submit点击事件,鼠标事件记录的数据于注册提交时通过j.reportAq函数提交,和注册提交的数据相差时间很小,估计用于事后是否非法注册判断。
init: function() {
//绑定鼠标事件
j.bindMouseClickEvent();
//绑定点击事件,当注册提交时触发
$.e.add($('submit'), 'click', function() {
if (p) {
p = false;
var a = dataArr0.length,
b = parseInt(a / 50),
c = a % 50;
if (b > 0)
for (var d = 0; d < b; d++) j.reportAq(j.dataToStrity(dataArr0.slice(50 * d, 50 * d + 50), 0));
c > 0 && j.reportAq(j.dataToStrity(dataArr0.slice(50 * b, a - 1), 0));
dataArr1.length && j.reportAq(j.dataToStrity(dataArr1, 1));
dataArr2.length && j.reportAq(j.dataToStrity(dataArr2, 2));
dataArr3.length && j.reportAq(j.dataToStrity(dataArr3, 3));
e = (new Date).getTime();
l.length = 0;
n = new Date;
for (a = 0; a < dataSet.length; a++) j.initData(dataSet[a]);
for (a = 0; a < dataArrSet.length; a++) dataArrSet[a].length = 0
}
})
}
};
注册的鼠标事件,一般只会触发移动和单击事件:
bindMouseClickEvent: function() {
//当鼠标移动时触发的事件
document.onmousemove = function(a) {
a = a || window.event;
new Date - n > 200 && (n = new Date, j.addTargetData(a, 0, new d(0), 0, 0))
};
document.onmouseout = function(a) {
a = a || window.event;
new Date - n > 200 && (n = new Date, j.addTargetData(a, 0, new d(0), 0, 0))
};
document.onmouseover = function(a) {
a = a || window.event;
new Date - n > 200 && (n = new Date, j.addTargetData(a, 0, new d(0), 0, 0))
};
document.onclick = function(c) {
c = c || window.event;
c.target = c.srcElement ? c.srcElement : c.target;
if (l.length > 0) var e = new Date - l[l.length - 1];
c.target && a[c.target.id] ? j.addTargetData(c, 1, new d(1), b[c.target.id], e) : j.addTargetData(c, 1, new d(1), b.none, e)
};
document.ondblclick =
function(c) {
c = c || window.event;
c.target = c.srcElement ? c.srcElement : c.target;
var e;
j.isIE() ? (e = new Date - l[l.length - 1], l.pop()) : (e = new Date - l[l.length - 2], l.pop(), l.pop(), dataArr1.pop());
dataArr1.pop();
c.target && typeof a[c.target.id] != 'undefined' ? j.addTargetData(c, 2, new d(2), b[c.target.id], e) : j.addTargetData(c, 2, new d(2), b.none, e)
};
document.oncontextmenu = function(c) {
c = c || window.event;
c.target = c.srcElement ? c.srcElement : c.target;
var e = new Date - l[l.length - 1];
l.pop();
dataArr1.pop();
c.target && typeof a[c.target.id] !=
'undefined' ? j.addTargetData(c, 3, new d(3), b[c.target.id], e) : j.addTargetData(c, 3, new d(3), b.none, e)
};
document.onmousedown = function() {
l.push(new Date)
};
document.onmouseup = function() {}
},
记录的数据通过addTargetData保存至dataArr数组,移动事件为dataArr0,点击事件为dataArr1,等。
addTargetData: function(a, b, c, d, f) {
a = a || window.event;
point = j.getMousePoint(a);
c.recordCnt += 1;
c.xSeries = point.x;
c.ySeries = point.y;
c.elementIDSeries = d;
c.clickGapSeries = f;
c.browserHeightSeries = j.getBrowser().winHeight;
c.browserWidthSeries = j.getBrowser().winWidth;
c.gapLog = (new Date).getTime() - e;
j.addTargetArrData(b, c)
},
addTargetArrData: function(a, b) {
switch (a) {
case 0:
dataArr0.push(b);
break;
case 1:
dataArr1.push(b);
break;
case 2:
dataArr2.push(b);
break;
case 3:
dataArr3.push(b)
}
},