Preview: script_reg.js
Size: 12.18 KB
/home/justbyquicklly-old/justbyquicklly/www/js/script_reg.js
$("document").ready(function() {
regValidator = $("#reg-form").validate({
submitHandler: function() {
var msg = "";
var chk_verify_sts = $("#chk_verify_sts").val();
//alert(chk_verify_sts);
if ($("#street_number").val() == '') {
msg = ("Google does not recognize your address. Your street name needs to be revised.");
}
/* if ($("#locality").val() == '') {
msg = ("Google does not recognize your address. Your city name needs to be revised.");
} */
if ($("#administrative_area_level_1").val() == '') {
msg = ("Google does not recognize your address. Your state name needs to be revised.");
}
if ($("#postal_code").val() == '') {
msg = ("Google does not recognize your address. Your Zip code is not valid.");
}
if (isAddressSelected == false) {
msg = ("Your current address does not look right. Please select a valid address!");
}
if (msg != "") {
regValidator.showErrors({
street_address: msg
});
} else {
if(chk_verify_sts==12) {
var widgetId3 = grecaptcha.render('btn-reg', {
'sitekey': '6LdsnYkaAAAAANxKtW6Zr8qHphwL5WvQCCp8sBLU',
'size': "invisible"
});
grecaptcha.reset(widgetId3);
grecaptcha.execute(widgetId3);
}
var n = $("#reg-form").serialize();
//alert(n);
return $.ajax({
type: "POST",
url: "/reg_process.php",
data: n,
beforeSend: function() {
$("#regerror").fadeOut(), $("#btn-reg").html('<span class="glyphicon glyphicon-transfer"></span> sending ...')
},
success: function(n) {
//alert('ok');
//$objvv = $.parseJSON(n);
if(chk_verify_sts ==0) {
$objvv = $.parseJSON(n);
var n = $objvv['vrcdechk'];
if($objvv['very_popen']==0) {
$("#regerror").show();
$("#regerror").html($objvv['vrcdechk']);
}
if($objvv['very_popen']==2) {
//alert('Verify your account.');
$('#signuppanel').hide();
$('#acc_verify_btn').show();
//$("#chk_verifycd").html =$objvv['vrcdechk'];
$("#chk_verifycd").val($objvv['vrcdechk']);
$("#chk_qcphn").val(window.btoa($objvv['mobile']));
$("#chk_qceml").val($objvv['email']);
$("#chk_qcctr_cd").val(window.btoa($objvv['code']));
$("#regerror").html('<div style="background:green; padding:7px; color:#fff"> Please verify ypur account. </div>');
return false;
}
}
//alert(n);
// alert('Verify your account.');
//alert($objvv['vrcdechk']);die;
//var chk_verify_sts = $("#chk_verify_sts").val();
//alert('hell');
/*if($objvv['very_popen'] !=0)
{
window.location.href= n;
}*/
if(getCookie('pincode').trim() != getCookie('postalcode').trim()) {
var cur_zipcode = getCookie('pincode').trim();
var old_zipcode = getCookie('postalcode').trim();
//changeZipcode(cookie_zipcode, current_zipcode);
if('https://www.quicklly.com/'!=extracUrl(n))
{
updateMiniCart();
resetPhpCart();
}
window.location.href= extracUrl(n);
return false;
}
if($objvv['very_popen'] !=0 && validateURLRD(n))
{
window.location.href= extracUrl(n);
}else if(validateURLRD(n)) {
window.location.href= extracUrl(n);
}
"ok" == n ? ($("#btn-reg").html('<img src="btn-ajax-loader.gif" /> Signing Up ...'), setTimeout(' window.location.href = "index.php"; ', 1)) : $("#regerror").fadeIn(1e3, function() {
$("#regerror").html('<div style="background:green; padding:7px; color:#fff"> ' + n + " </div>"), $("#btn-reg").html('<span class="glyphicon glyphicon-log-in"></span> Sign In')
})
}
}), !1
}
}
});
veriCodeValidator = $("#vrfy_otp_cd_frm").validate({
submitHandler: function() {
var msg = "";
var u_act_type = $("#frm_action_type").val();
//alert(u_act_type);
if(u_act_type=='guestu') {
if ($("#street_number2").val() == '') {
msg = "Google does not recognize your address. Your street name needs to be revised.";
}
}else {
if ($("#street_number").val() == '') {
msg = "Google does not recognize your address. Your street name needs to be revised.";
}
}
//alert(msg);
if (msg != "") {
//alert('eee1111');
regValidator.showErrors({
street_address: msg
});
} else {
var vricd_frm_data = $("#vrfy_otp_cd_frm").serialize();
return $.ajax({
type: "POST",
url: "/verifyotp_process.php",
data: vricd_frm_data,
beforeSend: function() {
//$("#regerror").fadeOut(), $("#btn-reg").html('<span class="glyphicon glyphicon-transfer"></span> sending ...')
},
success: function(n) {
//alert(n);
//alert('eee22');
$("#chk_verify_sts").val(1);
$("#chk_verify_sts_gst").val(1);
if(n=='success') {
//$("#btn-reg").html('<span class="glyphicon glyphicon-log-in"></span> Sign In');
if(u_act_type=='guestu') {
//alert('gstsubmt');
$('#frmGuestAddress').submit();
}else {
//alert('signsubmit');
$('#reg-form').submit();
}
}else{
$("#vrferror").html('<div style="background:green; padding:7px; color:#fff"> ' + n + " </div>");
}
}
}), !1
}
}
});
//Resend code validator
$('#vr_btn').click(function(e){
e.preventDefault();
var resenMnum = $("#chk_qcphn").val();
var countryCd = $("#chk_qcctr_cd").val();
var resenEml = $("#chk_qceml").val();
var smsg = 'OTP Sent Successfully on Your Mobile Number';
$('#vrcode1').val('');
$('#vrcode2').val('');
$('#vrcode3').val('');
$('#vrcode4').val('');
$('#vrcode5').val('');
$.ajax({
url: "/qc_resend_otp.php",
type: "POST",//type of posting the data
data: 'mnum='+resenMnum+'&countryCpde='+countryCd+'&qcreml='+resenEml,
success: function (data) {
// alert('success');
$objvv = $.parseJSON(data);
//$("#vrferror").html('<div style="background:green; padding:7px; color:#fff"> ' + smsg + " </div>");
if ($objvv['msg']) {
smsg = $objvv['msg'];
}
$("#chk_verifycd").val($objvv['vrcdechk']);
$("#vrferror").html('<div style="background:green; padding:7px; color:#fff"> ' + smsg + " </div>");
//$('#vr_btn').hide();
clearInterval(id);
},
error: function(xhr, ajaxOptions, thrownError){
// alert('error');
clearInterval(id);
},
timeout : 15000//timeout of the ajax call
});
});
});
$(document).ready(function () {
var counter = 60;
var id = setInterval(function() {
counter--;
if(counter > 0) {
var msg = 'You can resend new code in ' + counter + ' seconds';
$('#notice').text(msg);
} else {
$('#notice').hide();
$('#vr_btn').show();
clearInterval(id);
}
}, 1000);
});
function getVarOtpc(resenMnum,countryCd) {
//var resenMnum = 9958210996;
//alert(countryCd);
//var countryCd = encodeURIComponent(countryCd);
//var resenMnum= window.btoa(resenMnum);
//var countryCd= window.btoa(countryCd);
var smsg = 'OTP Sent Successfully on Your Mobile Number';
$.ajax({
url: "/qc_resend_otp.php",
type: "POST",//type of posting the data
data: 'mnum='+resenMnum+'&countryCpde='+countryCd,
success: function (data) {
$objvv = $.parseJSON(data);
if ($objvv['msg']) {
smsg = $objvv['msg'];
}
// alert('success');
$("#chk_verifycd").val($objvv['vrcdechk']);
$("#vrferror").html('<div style="background:green; padding:7px; color:#fff"> ' + smsg + " </div>");
//clearInterval(id);
},
error: function(xhr, ajaxOptions, thrownError){
//alert('error');
//clearInterval(id);
},
timeout : 15000//timeout of the ajax call
});
}
function getGuestOtpc(resenMnum,countryCd,resenEml) {
//var resenMnum = 9958210996;
//alert(countryCd);
//var countryCd = encodeURIComponent(countryCd);
//var resenMnum= window.btoa(resenMnum);
//var countryCd= window.btoa(countryCd);
var smsg = 'OTP Sent Successfully on Your Mobile Number';
$.ajax({
url: "/qc_gst_send_otp.php",
type: "POST",//type of posting the data
data: 'mnum='+resenMnum+'&countryCpde='+countryCd+'&gstEmil='+resenEml,
success: function (data) {
$objvv = $.parseJSON(data);
if ($objvv['msg']) {
smsg = $objvv['msg'];
}
// alert('success');
if($objvv['very_popen']==0) {
$('#loginpanelguess').show();
$("#gstregerror").html('<div style="background:green; padding:7px; color:#fff"> ' + smsg + " </div>");
$('#acc_verify_btn').hide();
}else{
$('#loginpanelguess').hide();
$('#acc_verify_btn').show();
$("#vrferror").html('<div style="background:green; padding:7px; color:#fff"> ' + smsg + " </div>");
$("#chk_verifycd").val($objvv['vrcdechk']);
}
//clearInterval(id);
},
error: function(xhr, ajaxOptions, thrownError){
//alert('error');
//clearInterval(id);
},
timeout : 15000//timeout of the ajax call
});
}
$(".vr_inpt").keyup(function () {
if (this.value.length == this.maxLength) {
$(this).next('.vr_inpt').focus();
}
});
function validateURLRD_vvvv(value) {
return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
}
function validateURLRD(s) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(s);
}
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return url;
})
// or alternatively
// return text.replace(urlRegex, '<a href="$1">$1</a>')
}
function extracUrl(input){
var urlRegex = /(https?:\/\/[^ ]*)/;
var url = input.match(urlRegex)[1];
return url;
}
Directory Contents
Dirs: 1 × Files: 76