if (location.href.indexOf("?fast=1") > -1) { alert("Your search frequency is too high, please slow down"); } // 询盘框提示配置 "undefined" != typeof toastr && (toastr.options = { closeButton: !1, debug: !1, newestOnTop: !1, progressBar: !1, positionClass: "toast-center-center", preventDuplicates: !1, onclick: null, showDuration: "300", hideDuration: "500", timeOut: "1300", extendedTimeOut: "700", showEasing: "swing", hideEasing: "linear", showMethod: "fadeIn", hideMethod: "fadeOut" }); $('.mmenu').click(function () { $('.bodylay').fadeToggle() $('header').toggleClass('head-act') $('body').toggleClass('noscroll') }) function PSearch() { var e = $.trim($("#txtSearch").val()); return "" == e ? ($("#txtSearch").addClass('search-error'), $("#txtSearch").focus(), !1) : !(e.length <= 1) && !(e.indexOf("<") > -1 || e.indexOf(">") > -1) && (e = e.replace("/", "XieXian"), void(location.href = "http://" + document.domain + "/search/" + encodeURIComponent(e.replace(/\+/g, "((()))")) + ".html")) } $("#txtSearch").keydown(function (e) { 13 == e.which && PSearch() }); function ownKeys(e, t) { var n, r = Object.keys(e); return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(e), t && (n = n.filter(function (t) { return Object.getOwnPropertyDescriptor(e, t).enumerable; })), r.push.apply(r, n)), r; } function _objectSpread(e) { for (var t = 1; t < arguments.length; t++) { var n = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(n), !0).forEach(function (t) { _defineProperty(e, t, n[t]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys(Object(n)).forEach(function (t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); }); } return e; } function _defineProperty(t, e, n) { return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t; } var sendData; var $lang = { msgTooLongName: "The name of the number of characters can not be more than 400", msgInputName: "Please enter the your name", msgInputPhone: "Please enter the phone", msgInputCompany: "Please enter the company", msgInputTitle: "Please enter the title", msgInputEmail: "Please enter the email", msgCheckEmail: "Please enter a valid email format", msgCheckEmailConfirm: "Two email inconsistencies", msgTooLongTitle: "The title of the number of characters can not be more than 340!", msgInputContent: "Please enter the content!", msgTooLongContent: "Contents of the number of characters can not be more than 2000!", txtSubmit: "Is being submitted...", msgSendFailed: "Send failed, please re submit!", msgSendSucess: "Sent successfully, we will contact you soon!", msgSameContent: "Please don't send the same inqury again!", msgFrequentlyContent: "Send failure, send too frequently!", msgSensitiveContent: "Send failed, content containing sensitive words!" } // 提交成功 input清空 function clearForm() { $('#in-name').val(''), $('#in-email').val(''), $('#in-content').val(''), $('#in-phone').val(''), $('#in-title').val(''), $('#in-company').val(''); } // 提交信息 function sendInquiry() { var t = formValidated(); if ($(this).attr('disabled', 'disabled'), t) { var e, n = { email: $.trim($('#in-email').val()), name: $.trim($('#in-name').val()), phone: $.trim($('#in-phone').val()), content: $.trim($('#in-content').val()), title: $.trim($('#in-title').val()), proId: $.trim($('#productID').val()), company: $.trim($('#in-company').val()) }; for (e in n) { n[e] = escape(n[e]); } $.ajax({ type: 'POST', url: '/OutOpen/AddInquiry', data: _objectSpread(_objectSpread({}, n), {}, { pageUrl: document.URL }), dataType: 'json', error: function error() { toastr.error($lang.msgSendFailed); }, success: function success(t) { $(this).removeAttr('disabled', 'disabled'), '1' == t ? (toastr.success($lang.msgSendSucess), clearForm()) : '2' == t ? toastr.info($lang.msgSameContent) : '3' == t ? location.href = '/Code' : '4' == t ? toastr.info($lang.msgSensitiveContent) : '5' == t ? toastr.info($lang.msgtoolongcontent) : '-1' == t ? toastr.info($lang.msgFrequentlyContent) : toastr.info($lang.msgSendFailed); }, async: !1 }); } return !1; } // 提交验证input function formValidated() { var t = !0; return $('.feedbackForm input, .feedbackForm textarea').each(function () { $(this).validate() || (t = !1); }), t; } $(function () { $('.feedbackForm input, .feedbackForm textarea').on('blur', function () { $(this).validate(); }), $('#ImgSend').on('click', function () { sendInquiry(); }); }), $.fn.validate = function () { var t = !0, e = $(this).attr('id'), n = $(this).val(); return 'in-email' == e ? '' === n ? (t = !1, $(this).addClass('input-error'), toastr.warning($lang.msgInputEmail)) : /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(n) ? $(this).removeClass('input-error') : (t = !1, $(this).addClass('input-error'), toastr.warning($lang.msgCheckEmail)) : 'in-name' == e ? '' === n ? (t = !1, $(this).addClass('input-error'), toastr.warning($lang.msgInputName)) : 400 < n.length ? (toastr.warning($lang.msgTooLongName), $(this).addClass('input-error'), t = !1) : $(this).removeClass('input-error') : 'in-content' == e ? '' === n ? (toastr.warning($lang.msgInputContent), $(this).addClass('input-error'), t = !1) : 2e3 < n.length ? (toastr.warning($lang.msgTooLongContent), $(this).addClass('input-error'), t = !1) : $(this).removeClass('input-error') : 'in-title' == e && (340 < n.length ? (toastr.warning($lang.msgTooLongTitle), $(this).addClass('input-error'), t = !1) : $(this).removeClass('input-error')), t; };;