");
$("form").submit(function (e) {
var emailEl = $(this).find("[name='email']");
var messageEl = $(this).find("[name='message']");
var telEl = $(this).find("[name='contact[tel]']");
var emailValid = false,
messageValid = false,
telValid = false;
function formErrMsg(errText){
$(".error-msg").html(errText);
$(".error-msg").stop().fadeIn(100);
setTimeout(() => {
$(".error-msg").stop().fadeOut(1000);
}, 3000);
}
if ( emailEl.length ) {
if (!/[-\w\.]+@[-\w]+(\.[-\w]+)+/.test(emailEl.val())) {
e.preventDefault();
formErrMsg("Please enter the correct email address!");
} else {
emailValid = true;
}
}
if ( emailValid ) {
if ( messageEl.length ) {
// var value = messageEl.val().trim();
var value = messageEl.val();
if ( !/\S{10,}/g.test(value) ) {
e.preventDefault();
formErrMsg("Please enter your message with more than 10 characters!");
} else {
messageEl.val(value);
messageValid = true;
}
}
}
if ( emailValid && messageValid ) {
var host = window.location.host;
if ( telEl.length ) {
var value = telEl.val().trim();
if( /^(zh\-cn\.)/.test(host) || /\.risingcn\./.test(host) ) {
if( !/^1[3456789]\d{9}$/.test(value) ){
e.preventDefault();
formErrMsg("请输入正确的手机号码!");
}
} else {
if ( value.length ) {
/*
if ( isNaN(value) ) {
e.preventDefault();
formErrMsg("Please enter the correct mobile phone number");
}
*/
}else {
/*
e.preventDefault();
formErrMsg("Please enter your phone number");
*/
}
}
}
}
});
function getTimestamp(){
var d = new Date(),
Y = d.getFullYear(),
M = (d.getMonth()+1) > 9 ? (d.getMonth()+1) : '0' + (d.getMonth()+1),
D = d.getDate() > 9 ? d.getDate() : '0' + d.getDate(),
h = d.getHours() > 9 ? d.getHours() : '0' + d.getHours(),
m = d.getMinutes() > 9 ? d.getMinutes() : '0' + d.getMinutes(),
s = d.getSeconds() > 9 ? d.getSeconds() : '0' + d.getSeconds();
var timestamp = `${Y}/${M}/${D} ${h}:${m}:${s}`;
var rand = Math.random();
rand = rand.toString().substr(3);
return timestamp + ', version=' + rand;
}
if( $('.message-6512b9c3483b8a6c1f8cc635798e9f60').length ){
$('.message-6512b9c3483b8a6c1f8cc635798e9f60').val('来源于页脚询盘: ' + window.location.href + ', 日期: ' + getTimestamp());
}
});
');
}
$('.fixedBoth').css({
'position': $('.sticky-enabled').css('position') == 'absolute' ? 'absolute' : 'relative',
'width': stickyWidth,
'height': stickyHeight,
'z-index': '99',
});
$('.sticky-enabled').css({
'position': 'absolute',
'top': '0px',
'width': '100%'
});
$(window).on('scroll', function () {
if ($(window).scrollTop() > stickyOffsetTop && !($('.sticky-enabled').hasClass(
'sticky-header'))) {
$('.sticky-enabled').addClass('sticky-header');
} else if ($(window).scrollTop() 800) {
el('.scroll_to_top').style = 'visibility: visible;opacity: 1; bottom: 220px;';
} else {
el('.scroll_to_top').style = 'visibility: hidden;opacity: 0; bottom: -50px;';
}
}
}
// back to top
});