Authored by rqq

update for resolve code style issue

... ... @@ -195,7 +195,12 @@ function reMarginFooter(fixedElement) {
'cdn.yoho.cn/yas-jssdk/1.0.15/yas-debug.js', '_yas');
(function() {
var uid = getUid();
var uid = getUid(),
hasParentBp = false, // 判断是否有父级埋点,如果有,点击子埋点,不处罚父埋点。
basicBpDataLength = 3;
var sendBpData,
bindBpEvent;
uid = uid === 0 ? '' : uid;
... ... @@ -203,31 +208,68 @@ function reMarginFooter(fixedElement) {
if (window._yas) {
window._yas(1 * new Date(), '1.0.15', 'yohobuy_m', uid, '', '');
$(document).on('click', 'a.buriedpoint', function(e) {
var bpIdArr = $(this).attr('data-bp-id').split('_');
var jsonData = {
page: bpIdArr[0],
floor: bpIdArr[1],
data: bpIdArr[2]
};
window._yas.sendCustomInfo(jsonData, Boolean(parseInt(bpIdArr[3])));
document.location.href = $(this).attr('href');
// 发送埋点数据
sendBpData = function(bpIdArr) {
var jsonData = {};
if (bpIdArr && (bpIdArr && bpIdArr.length > basicBpDataLength)) {
jsonData = {
page: bpIdArr[0],
floor: bpIdArr[1],
data: bpIdArr[2]
};
window._yas.sendCustomInfo(jsonData, Boolean(parseInt(bpIdArr[3]) || 1));
}
};
// 绑定埋点点击事件
bindBpEvent = function() {
hasParentBp = false;
$(document).off('click').on('click', '.buriedpoint', function(e) {
var databpid = $(this).attr('data-bp-id') || '',
bpIdArr = databpid.split('_');
if (!hasParentBp && bpIdArr && bpIdArr.length >= basicBpDataLength) {
sendBpData(bpIdArr);
} else {
hasParentBp = false;
}
if ($(e.target).closest('.buriedpoint').length >= 1) {
hasParentBp = true;
}
});
};
bindBpEvent();
// 对异步加载的埋点,绑定埋点事件
$(document).on('rebindBpEvent', bindBpEvent);
// 处理无法直接绑定的埋点
$(document).on('shouldSendBpData', function(e, dataPbId) {
var bpIdArr;
if (dataPbId && (dataPbId.length && dataPbId.length > 0)) {
hasParentBp = false;
bpIdArr = dataPbId.split('_');
sendBpData(bpIdArr);
}
});
}
}());
$(document).ready(function() {
/*$(document).ready(function() {
setTimeout(function() {
var arr = document.querySelectorAll('a.buriedpoint'),
var arr = document.querySelectorAll('.buriedpoint').find('a'),
i;
for (i = 0; i < arr.length; i++) {
arr[i].setAttribute('onclick', 'return false');
}
}, 2000);
});
});*/
$header.on('touchstart', 'a', function() {
$header.find('a').removeClass('highlight');
$(this).addClass('highlight');
... ...
... ... @@ -346,8 +346,6 @@ $listNav.on('touchend touchcancel', function(e) {
nav,
navType,
$active;
var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
if ($this.hasClass('filter')) {
... ...
... ... @@ -389,6 +389,9 @@ $(window).load(function() {
}, 1000);
});
function bindGoodThumbClick() {
$(document).trigger('rebindBpEvent');
}
function search(opt) {
var setting = {},
... ... @@ -528,8 +531,6 @@ function search(opt) {
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
}
... ... @@ -598,8 +599,9 @@ $subNav.on('touchend touchcancel', function(e) {
cname,
nav,
navType,
$active;
var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
$active;
var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
e.preventDefault();
$(document).trigger('shouldSendBpData', [bpIdData]);
... ... @@ -867,8 +869,4 @@ $('#collect').on('touchstart', function(e) {
} else {
collectShop();
}
});
function bindGoodThumbClick() {
$(document).trigger('rebindBpEvent');
}
});
\ No newline at end of file
... ...