1(function ($) { 2 'use strict'; 3 4 5 /***************************** Phone Number *******************************************/ 6 7 var phone_VER_buton_send_otp = ''; 8 var phone_VER_buton_resend_otp = ''; 9 var phone_VER_msg_otp_incorrect = ''; 10 var phone_VER__plc_put_otp = ''; 11 var phone_VER__plc_put_otp_change_number = ''; 12 var phone_VER__plc_put_otp_want_to_change = ''; 13 var phone_VER__plc_put_otp_first_time_change_number = ''; 14 var phone_VER_invalid_Number = ''; 15 var phone_VER_invalid_Country_code = ''; 16 var phone_VER_too_short = ''; 17 var phone_VER_too_long = ''; 18 var phone_VER_enter_mobile = ''; 19 var phone_VER_email_IS_invalid = ''; 20 21 if(iS_MARTOO_RTL()){ 22 23 phone_VER_buton_send_otp = "أرس٠ر٠ز Ø§ÙØªØÙÙ"; 24 phone_VER_buton_resend_otp = "إعادة ارسا٠ر٠ز Ø§ÙØªØÙÙ"; 25 phone_VER_msg_otp_incorrect = "ر٠ز Ø§ÙØªØÙÙ ØºÙØ± صØÙØ"; 26 phone_VER__plc_put_otp = "Ø§ÙØ±Ø¬Ø§Ø¡ Ø¥Ø¯Ø®Ø§Ù Ø§ÙØ£Ø±ÙØ§Ù Ø§ÙØ£Ø±Ø¨Ø¹Ø© Ø§ÙØªÙ تÙÙÙØªÙا عÙÙ"; 27 phone_VER__plc_put_otp_change_number = "تغÙÙØ± Ø§ÙØ±ÙÙ "; 28 phone_VER__plc_put_otp_want_to_change = "ÙÙØ³ رÙÙ ÙØ"; 29 phone_VER__plc_put_otp_first_time_change_number = "تغÙÙØ±"; 30 phone_VER_invalid_Number = "ÙØ±Ø¬Ù Ø§Ø¯Ø®Ø§Ù Ø§ÙØ£Ø±ÙØ§Ù Ø§ÙØ¥ÙÙÙÙØ²ÙØ©"; 31 phone_VER_invalid_Country_code = "ر٠ز Ø§ÙØ¨Ùد ØºÙØ± صØÙØ"; 32 phone_VER_too_short = "ÙØµÙر جدا"; 33 phone_VER_too_long = "Ø·ÙÙ٠جدا"; 34 phone_VER_enter_mobile = "ÙØ±Ø¬Ù إدخا٠رÙ٠اÙÙØ§ØªÙ ÙÙØ·"; 35 phone_VER_email_IS_invalid = "Ø§ÙØ¨Ø±Ùد Ø§ÙØ¥ÙÙØªØ±ÙÙÙ ØºÙØ± صØÙØ"; 36 37 } else { 38 39 phone_VER_buton_send_otp = "Send Code"; 40 phone_VER_buton_resend_otp = "Resend Code";
41 phone_VER_msg_otp_incorrect = "OTP is incorrect"; 42 phone_VER__plc_put_otp = "Please enter the 4 digits you received on"; 43 phone_VER__plc_put_otp_change_number = "Change number"; 44 phone_VER__plc_put_otp_want_to_change = "Not your number?"; 45 phone_VER__plc_put_otp_first_time_change_number = "Change"; 46 phone_VER_invalid_Number = "Invalid number"; 47 phone_VER_invalid_Country_code = "Invalid country code"; 48 phone_VER_too_short = "Too short"; 49 phone_VER_too_long = "Too long"; 50 phone_VER_enter_mobile = "Please enter only mobile numbers"; 51 phone_VER_email_IS_invalid = "Email is invalid"; 52 53 } 54 55 $(document).ready(function(){ 56 57 58 59 60 var input = document.querySelector("#phone"), 61 errorMsg = document.querySelector("#error-msg"), 62 validMsg = document.querySelector("#valid-msg"); 63 64 // here, the index maps to the error code returned from getValidationError - see readme 65 var errorMap = [phone_VER_invalid_Number, phone_VER_invalid_Country_code, phone_VER_too_short, phone_VER_too_long, phone_VER_invalid_Number]; 66 67 /*var martoo_phone_fld_placeholder = ''; 68 if(iS_MARTOO_RTL()){ 69 martoo_phone_fld_placeholder = "(Only UAE Numbers)"; 70 }else { 71 martoo_phone_fld_placeholder = "(Only UAE Numbers)"; 72 } 73 customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) { 74 return selectedCountryPlaceholder + " " +martoo_phone_fld_placeholder; 75 }, 76 */ 77 78 // initialise plugin 79 var iti = window.intlTelInput(input, { 80 nationalMode: true, 81 onlyCountries: ["ae"], 82 allowDropdown:false, 83 initialCountry: "ae", 84 customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) { 85 return "05x xxx xxxx"; 86 }, 87 utilsScript: "/wp-content/themes/martoo/assets/js/phone/build/js/utils.js?1603274336113" 88 }); 89 90 var reset = function() { 91 input.classList.remove("error"); 92 errorMsg.innerHTML = ""; 93 /* errorMsg.classList.add("hide"); */ 94 validMsg.classList.add("hide"); 95 }; 96 97 98 // on blur: validate 99 input.addEventListener('keyup', function() { 100 101 if($(input).is('[readonly=""]')){ 102 return false; 103 } 104 reset(); 105 if (input.value.trim()) { 106 if (iti.isValidNumber()) { 107 var numberType = window.intlTelInput.getNumberType; 108 //console.log(numberType); 109 //if (numberType == intlTelInputUtils.numberType.MOBILE) { 110 //alert('true'); 111 112 //} 113 var validreg = /^(?:\+971|00971|0)?(?:50|51|52|54|55|56)\d{7}$/; 114 115 var mobilenumber = input.value; 116 var numbermobile = mobilenumber.replace(/\s+/g, ''); 117 //alert(numbermobile); 118 if(numbermobile.match(validreg)){ 119 120 if( $("#phone").parents(".register-phonenumber").find(".phone_verify_tick").length < 1 ) { 121 122 123 //alert('test'); 124 /* $('#error-msg').hide(); */ 125 $("#phone").parent().find(".phone_verify_tick").remove(); 126 $('#otpvarify').remove(); 127 $("body").addClass("body_blurrr"); 128 setTimeout(function(){ 129 $('#createuser').prop("disabled", true); 130 },1500); 131 132 if ( $('body #resending').val() == '1') { 133 $('#valid-msg').after('<div id="otpvarify"><div id="message"></div><button type="button" name="optbutton" id="optmartoo">'+ phone_VER_buton_resend_otp +'</button><p class="mt-4" id="send_otp_text_edit_p">'+numbermobile+' - '+phone_VER__plc_put_otp_want_to_change+' <span id="phone_redit">'+phone_VER__plc_put_otp_first_time_change_number+'</span></p>'); 134 } 135 else { 136 $('#valid-msg').after('<div id="otpvarify"><div id="message"></div><button type="button" name="optbutton" id="optmartoo">'+ phone_VER_buton_send_otp +'</button><p class="mt-4" id="send_otp_text_edit_p">'+numbermobile+' - '+phone_VER__plc_put_otp_want_to_change+' <span id="phone_redit">'+phone_VER__plc_put_otp_first_time_change_number+'</span></p>'); 137 } 138 139 140 validMsg.classList.remove("hide"); 141 } 142 } 143 else{ 144 $("body").removeClass("body_blurrr"); 145 input.classList.add("error"); 146 var errorCode = iti.getValidationError(); 147 errorMsg.innerHTML = phone_VER_enter_mobile; 148 errorMsg.classList.remove("hide"); 149 $('#otpvarify').remove(); 150 $('body #phone').parents(".register-phonenumber").find(".phone_verify_tick").remove(); 151 setTimeout(function(){ 152 $('#createuser').prop("disabled", true); 153 },1500); 154 155 } 156 } else { 157 $("body").removeClass("body_blurrr"); 158 input.classList.add("error"); 159 var errorCode = iti.getValidationError(); 160 errorMsg.innerHTML = errorMap[errorCode]; 161 errorMsg.classList.remove("hide"); 162 $('#otpvarify').remove(); 163 $('body #phone').parents(".register-phonenumber").find(".phone_verify_tick").remove(); 164 setTimeout(function(){ 165 $('#createuser').prop("disabled", true); 166 },1500); 167 } 168 } 169 170 }); 171 172 // on keyup / change flag: reset 173 input.addEventListener('change', reset); 174 //input.addEventListener('keyup', reset); 175 input.addEventListener('keypress', reset); 176 177 input.addEventListener('keydown', reset); 178 179 }); 180 181 182 183 /******************************** otp ***************************************/ 184 185 186 $(document).ready(function(){ 187 188 189 190 $("body").on('click','#optmartoo',function(){ 191 192 193 var phonenumber = $('#phone').val(); 194 //alert(phonenumber); 195 $.ajax({
196 type: 'POST', 197 url: martoo_phone_ajax_obj.ajaxURL, 198 secure: true, 199 data: {'action':'martoocallotpRestApi', 'phone': phonenumber, 'nonce': martoo_phone_ajax_obj.nonce}, 200 beforeSend: function () { 201 $('body #optmartoo').addClass('loading'); 202 }, 203 complete: function () { 204 $('body #optmartoo').removeClass('loading'); 205 }, 206 success: function (data){ 207 $('body #send_otp_text_edit_p').remove(); 208 $('body #resending').val("1"); 209 $('body #message').show(); 210 $('body #message').html(data); 211 setTimeout(function(){ 212 $('body #message').hide(); 213 }, 2000); 214 //$('body #optmartoo').remove(); 215 $('body #optmartoo').text(phone_VER_buton_resend_otp); 216 if($("input[name='otpvalid']").length <= 0){ 217 $('body #optmartoo').before("<p class='mb-2'>"+ phone_VER__plc_put_otp +" "+phonenumber+". <span id='phone_redit'>"+phone_VER__plc_put_otp_change_number+"</span></p><input type='text' name='otpvalid' maxlength='4' class='form-control rounded' required><small id='otp_message' class='text-danger'></small>"); 218 } 219 $("body input[name='otpvalid']").val("").focus(); 220 221 $('#createuser').prop("disabled", false); 222 } 223 }); 224 }); 225 226 227 228 }); 229 230 /***************************** Phone Number verify *******************************************/ 231 $(document).ready(function(){ 232 $("#optmartoo").on('click',function(){ 233 234 var phonenumber = $('#phone').val(); 235 //alert(phonenumber); 236 $.ajax({
237 type: 'POST', 238 url: martoo_phone_ajax_obj.ajaxURL, 239 secure: true, 240 data: {'action':'martoocallotpverifyRestApi', 'phone': phonenumber, 'nonce': martoo_phone_ajax_obj.nonce}, 241 success: function (data){ 242 243 } 244 }); 245 246 247 248 249 250 /* var data = { 251 'action': 'martoocallotpRestApi', 252 'martoo_search': phonenumber, 253 'nonce': martoo_phone_ajax_obj.nonce 254 }; 255 $.post( martoo_phone_ajax_obj.ajaxURL, data, function( data ) { 256 alert( "Data Loaded: " + data ); 257 258 }); */ 259 260 261 }); 262 263 // $("body").on('keyup','input[name="otpvalid"]',function(){ 264 // detect mobile paste 265 $("body").on('touchend', 'input[name="otpvalid"]', function () { 266 var el = $(this); 267 268 setTimeout(function () { // wait for value to update after paste 269 el.trigger('input'); // re-run your main input handler 270 }, 50); 271 }); 272 273 // your original code (unchanged) 274 $("body").on('input', 'input[name="otpvalid"]', function() { 275 276 if($(this).val().length > 3){ 277 278 var entered_otp = $(this).val(); 279 var base_url = window.location.protocol+"//"+window.location.hostname; 280 281 $.ajax({
282 type: 'POST', 283 url: martoo_phone_ajax_obj.ajaxURL, 284 secure: true, 285 data: {'action':'martoo_otp_VERIFY', 'entered_otp': entered_otp, 'nonce': martoo_phone_ajax_obj.nonce}, 286 beforeSend: function () { 287 $('body #otp_message').addClass('loading'); 288 }, 289 complete: function () { 290 $('body #otp_message').removeClass('loading'); 291 }, 292 success: function (data){ 293 if($.trim(data) == "Code is wrong." || $.trim(data) == "اÙÙÙØ¯ ØºÙØ± صØÙØ") { 294 $('body #phone').parent().find("small.text-success").remove(); 295 $('body #otp_message').html(phone_VER_msg_otp_incorrect); 296 } 297 else { 298 $("body").removeClass("body_blurrr"); 299 $('#createuser').prop("disabled", false); 300 $('body #resending').val(""); 301 $('body #otpvarify').hide(); 302 $('body #optmartoo').remove(); 303 $('body #otp_message').remove(); 304 $('body input[name="otpvalid"]').attr("type","hidden"); 305 $('body #message').html(""); 306 $('body #phone').after('<small class="phone_verify_tick text-success float-right mr-2" style="position:relative;margin-top:-3em;"><img src="'+base_url+'/wp-content/themes/martoo/assets/img/checkmark_green_circle.jpg"></small>'); 307 } 308 } 309 }); 310 } 311 }); 312 313 }); 314 315 /***************************** Phone Number RE-edit *******************************************/ 316 $(document).ready(function(){ 317 $("body").on("click","#phone_redit",function(){ 318 $("body").removeClass("body_blurrr"); 319 $('body #resending').val(""); 320 $('body #otpvarify').remove(); 321 $('body #optmartoo').remove(); 322 $('body #otp_message').remove(); 323 $('body input[name="otpvalid"]').attr("type","hidden"); 324 $('body #message').html(""); 325 $('body input#phone').val("").focus(); 326 }); 327 }); 328 329 330 /***************************** EMAIL already exist *******************************************/ 331 332 $(document).ready(function(){ 333 $(document).on('change', '#registerform #email', function(){ 334 var email_pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([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])\.?$/i; 335 336 var base_url = window.location.protocol+"//"+window.location.hostname; 337 338 if (email_pattern.test($(this).val())){ 339 340 $(this).parent().find(".text-danger").html(""); 341 342 var email_Address = $(this).val(); 343 344 $.ajax({
345 type: 'POST', 346 url: martoo_phone_ajax_obj.ajaxURL, 347 secure: true, 348 data: {'action':'martooemailExists', 'martoo_register_email': email_Address, 'nonce': martoo_phone_ajax_obj.nonce}, 349 success:function(data){ 350 if(data != 0) { 351 $("#registerform #email").parent().find(".text-success").html(""); 352 $("#registerform #email").parent().find(".text-danger").html(data); 353 setTimeout(function(){ 354 $('#createuser').prop("disabled", true); 355 },1500); 356 } 357 else { 358 $(this).parent().find(".text-danger").html(""); 359 $("#registerform #email").parent().find(".text-success").html("<img src='"+base_url+"/wp-content/themes/martoo/assets/img/checkmark_green_circle.jpg'/>"); 360 /* $('#registerform #email').prop("readonly", true); */ 361 $('#createuser').prop("disabled", false); 362 } 363 364 } 365 }); 366 367 368 } 369 else{ 370 371 $(this).parent().find(".text-success").html(""); 372 $(this).parent().find(".text-danger").html(phone_VER_email_IS_invalid); 373 } 374 375 }); 376 377 378 }); 379 380 381 382})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.