fd-gulp-convert-encoding
Version:
convert file to assigned charset
181 lines (147 loc) • 5.89 kB
JavaScript
/**
* @author dongming.jidm
* @date 2013-05-03
* �������û�ע��/��½
* һ��ֻ����һ��
* ���ֺ�20s��ʧ
*/
;(function($) {
var defConfig,self,QU = Qingguo.Utility;
defConfig = {
host: '1688.com',
subDirectory: 'chanpin',
domRoot: '#lead_register',
registUrl: 'http://exodus.1688.com/member/join/common_validate_join.htm',
disappearTime: '20000',
end: 0
}
function LeadRegister(sb) {
Sandbox = sb;
return LeadRegister;
}
$.extend(LeadRegister, {
init: function() {
self = this;
// ����ǵ�½�û���ִ���κ���
if( FE.util.IsLogin() ) {
return;
}
self.initClickParam();
self.isIE6 = false;
if( $.browser.version === "6.0" ) {
self.fromTop = $(window).height() - 90;
self.isIE6 = true;
}else{
self.isIE6 = false;
}
if( self.isOldVisitor() ) {
// ��ʾ����ע��/��½
if( !self.isAppeared() ) {
$(window).bind("scroll.showLead",function(){
if( $(window).scrollTop() > 800 ){
self.createLeadWrapper().show(300);
// �ع���
QU.aliclick(this, "?searchtrace=" + self.exposurePoint);
self.bindEvent();
$(window).unbind('scroll.showLead');
}
});
}
} else {
self.addCookie('aliqingguo','oldvisitor',defConfig.host);
}
},
// �Dz���������Ϸÿ�
isOldVisitor: function() {
var isOld = self.getCookie('aliqingguo'),
isOldBoollen = false;
isOld ? isOldBoollen = true : isOldBoollen = false;
return isOldBoollen;
},
// ����ע�ḡ��24Сʱֻ��ֻ����һ��
isAppeared: function() {
var expireTime = 24 * 60 * 60 * 1000;
if( self.getCookie('aliqingguo_leadregister_delay') ) {
// ������24Сʱ֮�ڣ�����ʾ��ʾ
return true;
} else {
// ����24Сʱ��������ʾ��ʾ
self.addCookie('aliqingguo_leadregister_delay','24hours',defConfig.host,expireTime);
return false;
}
},
// ���������ڵ�
createLeadWrapper: function() {
var html = '<div class="leadRegister">\
<div class="wrapper">\
<div class="content fd-clr">\
<div class="title"></div>\
<a target="_blank" class="register" t="' + self.registPoint + '" href="' + defConfig.registUrl + '"></a>\
<a class="login" href="#" t="' + self.loginPoint + '">ֱ�ӵ�½ ></a>\
<a class="close" href="#" t="' + self.closePoint + '"></a>\
</div>\
<div class="shim"></div>\
</div>\
</div>';
self.leadWrapper = $(defConfig.domRoot).html(html).hide();
self.timer = setTimeout(function() {
self.doCloseLead();
}, defConfig.disappearTime);
return self.leadWrapper;
},
bindEvent: function() {
$('a.login', defConfig.domRoot).click(function(e) {
e.preventDefault();
self.doLogin();
});
$('a.close', defConfig.domRoot).click(function(e) {
e.preventDefault();
self.doCloseLead();
});
if( self.isIE6 ) {
$(window).bind('scroll.ie6', function() {
self.fixIE6();
});
}
},
fixIE6: function() {
var top = $(window).scrollTop() + self.fromTop;
self.leadWrapper.css({
"position": "absolute",
"top": top
});
},
doLogin: function() {
FE.sys.logist({
source: 'qingguo', //����ҳ�����Դ
onLoginSuccess: function(){
//��½�ɹ���ص�����
window.location.reload();
}
});
},
doCloseLead: function() {
$(defConfig.domRoot).remove();
clearTimeout(self.timer);
},
getCookie:function(name) {
var value = document.cookie.match('(?:^|;)\\s*'+name+'=([^;]*)');
return value ? unescape(value[1]): '';
},
addCookie:function(name,v,domainName,expires){
var expDate = new Date,sevenDay= expires || 604800000;
expDate=new Date(expDate.getTime() +sevenDay);
document.cookie = name + ("=" + escape(v) + ";expires=" + expDate.toGMTString() + ";path=/" + defConfig.subDirectory + ";domain=" + domainName);
},
initClickParam: function() {
var showStyle = iPageConfig.exposeTrace === 'w_sale_show' ? 'img' : 'shopwindow';
self.exposurePoint = 'w_sale_' + (showStyle === 'img' ? '' : 's_') + 'btm_bar_exp';
self.registPoint = 'w_sale_' + (showStyle === 'img' ? '' : 's_') + 'reg';
self.loginPoint = 'w_sale_' + (showStyle === 'img' ? '' : 's_') + 'login';
self.closePoint = 'w_sale_' + (showStyle === 'img' ? '' : 's_') + 'cancel';
},
end: 0
});
Qingguo.Widget.LeadRegister = LeadRegister;
AppCore.lazyRegister("qingguo_mod_leadregist", "Qingguo.Widget.LeadRegister", window, 'scroll');
})(jQuery);