if (typeof jQuery == 'undefined') {
var ls_jquery = document.createElement('script');
ls_jquery.type = 'text/javascript';
ls_jquery.src = 'https://g.gxlesou.com/static/getcustomer/js/jquery.min.js';
document.getElementsByTagName("head")[0].appendChild(ls_jquery);
}
var ls_token = 'e68876b49a4ef0b1d8120a478cf72f95';
var Head = document.getElementsByTagName('head')[0];
var ls_link = document.createElement("link");
ls_link.type = "text/" + ("css");
ls_link.rel = "stylesheet";
ls_link.href = 'https://g.gxlesou.com/static/getcustomer/css/style.css';
Head.insertBefore(ls_link, Head.lastChild);
var ls_style = document.createElement('style');
var ls_csscode = '.customer-side ul li:hover,#zx_box_btn,.icon_keifu,.fd_bgc,#fd-bottom-btn,#hk-btn{background:#e1993b;}.cd_you h3 span{color:#e1993b;}';
ls_style.appendChild(document.createTextNode(ls_csscode));
Head.appendChild(ls_style);
//插入HTML代码
var ls_html = document.createElement("div"), ls_htmlcode;
var ls_htmlcode = '
免费
通话
';
ls_html.innerHTML = ls_htmlcode;
document.body.appendChild(ls_html);
/*弹框JS内容*/
//打开窗口
$('.cd-popup-trigger3').on('click', function(event){
event.preventDefault();
$('.cd-popup3').addClass('is-visible3');
//$(".dialog-addquxiao").hide()
});
//关闭窗口
$('.cd-popup3').on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup3') ) {
event.preventDefault();
$(this).removeClass('is-visible3');
}
});
//ESC关闭
$(document).keyup(function(event){
if(event.which=='27'){
$('.cd-popup3').removeClass('is-visible3');
}
});
// 底部横幅
var KF = $(".footer_kf");
var wkbox = $(".keifu_box");
var kf_close = $(".keifu .keifu_close");
var icon_keifu = $(".icon_keifu");
var kH = wkbox.height();
var kW = wkbox.width();
var wH = $(window).height();
//KF.css({height:kH});
//icon_keifu.css("bottom",parseInt((kH-10)/5));
//var KF_top = (wH-kH)/0;
//if(KF_top<0) KF_top=0;
//KF.css("top",KF_top);
$(kf_close).click(function(){
wkbox.hide();
icon_keifu.show();
});
$(icon_keifu).click(function(){
$(this).hide();
wkbox.show();
//KF.animate({width:kW},50);
});
function trim(str){ //删除左右两端的空格
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function setCookie(cname, cvalue, exminutes) {
var d = new Date();
d.setTime(d.getTime() + (exminutes * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function senddata(data) {
if(getCookie('ls_' + ls_token)) {
alert('您的信息已提交成功,请不要频繁提交!');
return false;
}
data.append('token', ls_token);
data.append('domain', lesoud);
data.append('referer', lesour);
data.append('fangkeid', getCookie('ls_fangke_' + ls_token));
var xmlhttp = new XMLHttpRequest();
var url = 'https://g.gxlesou.com/c/submit';
xmlhttp.open("post", url, true);
xmlhttp.send(data);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj = JSON.parse(xmlhttp.responseText);
if(obj.status == 1) {
setCookie('ls_' + ls_token, obj.siteid, 5);
}
alert(obj.message);
}
}
}
//保存访客信息
function sendfangke() {
if(getCookie('ls_fangke_' + ls_token)) {
return false;
}
data = new FormData();
data.append('token', ls_token);
data.append('domain', lesoud);
data.append('referer', lesour);
var xmlhttp = new XMLHttpRequest();
var url = 'https://g.gxlesou.com/c/fangke';
xmlhttp.open("post", url, true);
xmlhttp.send(data);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj = JSON.parse(xmlhttp.responseText);
if(obj.status == 1) {
setCookie('ls_fangke_' + ls_token, obj.id, 10);
}
}
}
}
//处理数据
sendfangke();
setTimeout(function() {
$(".cd-popup3").addClass('is-visible3');
}, 10000);
$("#zx_box_btn").click(function() {
if(trim($("#zx_text").val()) == '') {
alert('请输入您的电话号码!');
return false;
}
var phonenumber = trim($("#zx_text").val());
var data = new FormData();
data.append('phonenumber', phonenumber);
data.append('fromtype', '1');
senddata(data);
});
$("#fd-bottom-btn").click(function() {
if(trim($("#fd-bottom-input").val()) == '') {
alert('请输入您的电话号码!');
return false;
}
var phonenumber = trim($("#fd-bottom-input").val());
var data = new FormData();
data.append('phonenumber', phonenumber);
data.append('fromtype', '1');
senddata(data);
});
$("#hk-btn").click(function() {
if(trim($("#hk-input-name").val()) == '') {
alert('请输入您的姓名!');
return false;
}
if(trim($("#hk-input-tel").val()) == '') {
alert('请输入您的电话号码!');
return false;
}
var data = new FormData();
//获取性别
var ls_sex = $("input[name='ls_sex']:checked").val();
data.append('phonenumber', trim($("#hk-input-tel").val()));
data.append('contact', trim($("#hk-input-name").val()));
data.append('sex', ls_sex);
data.append('message', trim($("#hk-message").val()));
data.append('fromtype', '1');
senddata(data);
$(".cd-popup3").removeClass('is-visible3');
});
$(window).scroll(function(){
if ($(window).scrollTop() + $(window).height() == $(document).height()) {
$(".icon_keifu").hide();
$(".keifu_box").show();
}
});