P4_LED Mât haut

Mât haut P4LED

"); $("body").append(""); //测试欧洲地区 let european = /FI|SE|NO|IS|DK|EE|LV|LT|BY|RU|UA|MD|PL|CS|SK|HU|DE|AT|CH|LI|GB|IE|NL|BE|LU|FR|MC|RO|BG|AL|GR|SI|MT|IT|SM|ES|PT|AD|GI/ig; //测试亚洲地区 let asia = /CN|MN|KP|KP|KR|JP|PH|VN|LA|KH|MM|TH|MY|BN|SG|ID|NP|BD|ID|PK|LK|MV|KZ|KG|TJ|UZ|TM|AF|IQ|IR|SY|JO|LB|IL|BL|SA|BH|QA|KW|AE|OM|YE|GE|AM|AZ|TR|CY/ig; //测试澳洲地区 let australia = /AU|NZ|PG|SB|NR|TO|FJ|PF/ig; //测试美州地区 let america = /US|UA|CA|MX|GT|BZ|SV|HN|NI|CR|PA|BS|CU|JM|HT|DO|AG|LC|VC|GD|BB|TT|PR|AI|MS|BM|CO|VE|GY|GF|SR|EC|PE|BO|BR|CL|AR|UY|PY/ig; //测试非洲地区 let aftica = /DZ|AO|BJ|BF|BI|TD|CG|ET|GA|GM|GH|GN|KE|LY|MG|ML|MA|CG|ST|SN|SC|SL|SO|ZA|SD|TZ|TG|TN|UG/ig; $("form").submit(function(e) { //e.preventDefault(); 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.replace(/\s/g, ""))) { 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"); */ } } } } console.log(e.currentTarget.id); // homeForm 参考捷胜首页底部的发送邮箱的表单
if (e.currentTarget.id == "sendForm") { // alert("asd1f2s1df"); e.preventDefault(); let flag = false; let protocol = window.location.protocol; let backpage = protocol + "//" + document.location.hostname + "/inquiryok?back=" + document.location.pathname; if (emailValid || messageValid) { flag = true; } if (flag) { $.post(protocol + "//inquiry.digoodcms.com/api/save/dianming", $(this).serialize(), function(res, status) { if (res.indexOf('Inquiry Send Success') >= 0) { // window.location.href = backpage; $(".sendForm").hide(); $(".bg-success").show(); } let name = $(this).find('[name="contact[fullname]"]').val(), email = $(this).find('[name="email"]').val(), phone = $(this).find('[name="contact[tel]"]').val(), message = $(this).find('[name="message"]').val(), nation = $(this).find('[name="geoip[countryCode]"]').val(); body = "My nation is" + nation + "%0a%0d" + "My Name is: " + name + "%0a%0d" + "My Email Address is: " + email + "%0a%0d" + "My Phone Number is: " + phone + "%0a%0d" + "Message:" + message + "%0a%0d"; console.log(nation); //测试欧洲和亚洲地区 if (european.test(nation) || asia.test(nation)) { $("#send").attr("href", "mailto:led@darmon.com?body=" + body); } //测试美州地区 和 非洲地区 else if (america.test(nation) || aftica.test(nation)) { $("#send").attr("href", "mailto:?body=" + body); } //测试澳洲地区 else { $("#send").attr("href", "mailto:led@darmon.com;?body=" + body); } document.getElementById("send").click(); }); } } }); 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-3838d68d62bc721f731ec617dde41554').length) { $('.message-3838d68d62bc721f731ec617dde41554').val('from: ' + window.location.href + ', date: ' + getTimestamp()); } }); $(function () { $('.nav_down .nav_box .list_nav .item').mouseover(function () { $(this).addClass('active').siblings().removeClass('active'); $(this).parents('.list_nav').siblings().find('.prodtcts_nav_data').eq($(this).index()).addClass('active').siblings().removeClass('active'); }); })