1var ApplyBonuses; 2jQuery(function($){ 3 // tot acc bat sim 4 $('.registerTabs>div').hide(); 5 $('.registerTabs #phoneInitial #phoneInput').mask("+7 (999) 999-99-99", {autoclear: 1}); 6 7 // tos 8 $(document).on('click', '.userAgreement .tosBtn', function(e){ 9 e.preventDefault(); 10 $.fancybox.open({ 11 src : '/tos?tmpl=straw', 12 type : 'ajax', 13 opts : { 14 minWidth : 320, 15 minHeight : 400, 16 fitToView : false, 17 autoSize : true, 18 touch : false, 19 } 20 }); 21 }); 22 // bonus tos 23 $(document).on('click', '.userAgreement .btosBtn', function(e){ 24 e.preventDefault(); 25 $.fancybox.open({ 26 src : '/pravila-bonusnoj-programmy-bashmag-bonus?tmpl=straw', 27 type : 'ajax', 28 opts : { 29 minWidth : 320, 30 minHeight : 400, 31 fitToView : false, 32 autoSize : true, 33 touch : false, 34 } 35 }); 36 }); 37 // pdp 38 $(document).on('click', '.userAgreement .pdpBtn', function(e){ 39 e.preventDefault(); 40 $.fancybox.open({ 41 src : '/policy?tmpl=straw', 42 type : 'ajax', 43 opts : { 44 minWidth : 320, 45 minHeight : 400, 46 fitToView : false, 47 autoSize : true, 48 touch : false, 49 } 50 }); 51 }); 52 53 // Disable the old password reset functionality - we now use Flash Call reset system 54 // Our new system is template-based and handles all steps properly 55 // pwd reset 56 $('#pwd, #pwdConfirm').val(''); 57 var confirmedPhonePwd; 58 59 // Handle old reset password links to redirect to the new system 60 $(document).on('click', 'a[href*="option=com_users&view=reset"]', function(e) { 61 // Only redirect links that aren't part of our new system 62 if (!$(this).hasClass('resend-link') && !$(this).hasClass('back-link')) { 63 // Let the browser handle this normally - our template-based reset system will take over 64 } 65 }); 66 67 // check phone 68 var confirmedPhone; 69 $('.phoneChkbtn').html('РегиÑÑÑаÑиÑ'); 70 $('.email-profilegroup, .password-profilegroup, .password2-profilegroup, .last_name-profilegroup, .first_name-profilegroup, .birthdate-profilegroup').show(); 71 function CheckPhone(){ 72 // check if user exists in system 73 var phone = $('#phone_1_field').val(); 74 if(phone == null || !(phone.length > 0)){ 75 return false; 76 } 77 78 $.ajax({ 79 url: '/profile?ajax=1&checkPhone=1', 80 dataType: 'json', 81 data: { phone: phone }, 82 cache: false 83 }).done(function(data) { 84 if(data.e == 0 || data.e == 27){ 85 $('.regInfo').html(data.m); 86 $('.phoneChkbtn').html('РегиÑÑÑаÑиÑ'); 87 $('.email-profilegroup, .password-profilegroup, .password2-profilegroup, .last_name-profilegroup, .first_name-profilegroup, .birthdate-profilegroup').show(); 88 // confirmedPhone = data.d.confirmedPhone; 89 } 90 91 if(data.e == 28){ 92 $('.regInfo').html(data.m); 93 return; 94 } 95 96 if(data.e == 0){ 97 // user is in system 98 // if(data.d.Email != null && data.d.Email.length > 0) 99 // $('#email_field').prop('readonly', true); 100 $('#email_field').val(data.d.Email); 101 $('#last_name_field').val(data.d.lastName).prop('readonly', true); 102 $('#first_name_field, #name_field').val(data.d.firstName).prop('readonly', true); 103 $('#birthdate_field').val(data.d.Birthdate); 104 if(data.d.Birthdate.length > 0 && data.d.Birthdate != '--.--.----') 105 $('#birthdate_field').prop('readonly', true); 106 } else { 107 $('#last_name_field').prop('readonly', false); 108 $('#first_name_field').prop('readonly', false); 109 $('#birthdate_field').prop('readonly', false); 110 } 111 }); 112 } 113 if($('#registerTab')[0]) CheckPhone(); 114 115 // date field mask 116 $('.registerTabs #birthdate_field').mask("99.99.9999"); 117 118 if(!$('#registerTab .ajaxloader')[0]) $('.phoneChkbtn').parent().append('<img style="display:none;" class="ajaxloader" src="/images/ajax-load.gif" alt="" />'); 119 120 // check if email exists in system 121 $(document).on('blur', '.registerTabs #email_field', function(){ 122 var email = $('#email_field').val(); 123 var phone = $('#phone_1_field').val(); 124 if(email == null || !(email.length > 0) || !ValidateEmail(email)){ 125 $('.regInfo').html('<div class="responseError emailExist">УказаннÑй Email невеÑнÑй, пожалÑйÑÑа пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð°.</div>'); 126 $('.email-profilegroup').addClass('has-error'); 127 return false; 128 } 129 130 $('#registerTab .ajaxloader').show(); 131 132 $.ajax({
133 url: '/profile?ajax=1&checkEmailQuick=1', 134 dataType: 'json', 135 data: { phone: phone, email: email }, 136 cache: false 137 }).done(function(data) { 138 if(data.e == 0){ 139 $('.regInfo').html(data.m); 140 $('.email-profilegroup').removeClass('has-error'); 141 } else if(data.e == 30){ 142 $('.regInfo').html(data.m); 143 $('.email-profilegroup').addClass('has-error'); 144 } 145 $('#registerTab .ajaxloader').hide(); 146 }); 147 }); 148 149 // if phone changed 150 // $(document).on('change', '.registerTabs #phone_1_field', function(){ 151 // if($(this).val() == confirmedPhone) { 152 // $('.regInfo').html('<div class="responseError">ÐÐ°Ñ ÑелеÑон ÑÑпеÑно подÑвеÑждÑн.<br>ÐÐ»Ñ Ð¿ÑÐ¾Ð´Ð¾Ð»Ð¶ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½Ð¸Ñе ÑоÑÐ¼Ñ Ð½Ð¸Ð¶Ðµ:</div>'); 153 // $('.phoneChkbtn').html('РегиÑÑÑаÑиÑ'); 154 // // $('#email_field, #last_name_field, #first_name_field, #birthdate_field').val(''); 155 // $('.email-profilegroup, .password-profilegroup, .password2-profilegroup, .last_name-profilegroup, .first_name-profilegroup, .birthdate-profilegroup').show(); 156 // } else if(!$('.regInfo').hasClass('passreset')){ 157 // $('.regInfo').html('ÐÐ»Ñ Ð¿ÑодолжениÑ, пожалÑйÑÑа, подÑвеÑдиÑе Ñвой ÑелеÑон:'); 158 // $('.phoneChkbtn').html('ÐодÑвеÑдиÑÑ'); 159 // $('#email_field, #last_name_field, #first_name_field, #birthdate_field').val(''); 160 // $('.email-profilegroup, .password-profilegroup, .password2-profilegroup, .last_name-profilegroup, .first_name-profilegroup, .birthdate-profilegroup').hide(); 161 // } 162 // }); 163 164 // подÑвеÑждение ÑелеÑона пÑи ÑегиÑÑÑаÑии 165 if($('.phoneChkbtn')[0]){ 166 $("#phone_1_field").keyup(function(event) { 167 if (event.keyCode === 13) { 168 $('.phoneChkbtn').click(); 169 } 170 }); 171 } 172 $(document).on('click', '.phoneChkbtn', function(e){ 173 e.preventDefault(); 174 175 var phone = $('#phone_1_field').val(); 176 if(phone == null || !(phone.length > 0)){ 177 $('.phone_1-profilegroup').addClass('has-error'); 178 return false; 179 } 180 181 // if($('#phone_1_field').val() == confirmedPhone) 182 // $('.regInfo').html('<div class="responseError">ÐÐ°Ñ ÑелеÑон ÑÑпеÑно подÑвеÑждÑн.<br>ÐÐ»Ñ Ð¿ÑÐ¾Ð´Ð¾Ð»Ð¶ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½Ð¸Ñе ÑоÑÐ¼Ñ Ð½Ð¸Ð¶Ðµ:</div>'); 183 184 // check email 185 var email = $('#email_field').val(); 186 if(!ValidateEmail(email)){ // $('#phone_1_field').val() == confirmedPhone && 187 $('.regInfo').html('<div class="responseError emailExist">УказаннÑй Email невеÑнÑй, пожалÑйÑÑа пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð°.</div>'); 188 $('.email-profilegroup').addClass('has-error'); 189 return false; 190 } 191 192 // check pwd 193 var pwd = $('#password_field').val(), pwdConfirm = $('#password2_field').val(); 194 if(pwd != pwdConfirm){ // $('#phone_1_field').val() == confirmedPhone && 195 $('.password-profilegroup, .password2-profilegroup').addClass('has-error'); 196 $('.regInfo').html('<div class="responseError pwdNotMatch">ÐаÑоли не ÑооÑвеÑÑÑвÑÑÑ. ÐожалÑйÑÑа, пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð°.</div>'); 197 return false; 198 } 199 if(pwd.length < 7){ // $('#phone_1_field').val() == confirmedPhone && 200 $('.password-profilegroup, .password2-profilegroup').addClass('has-error'); 201 $('.regInfo').html('<div class="responseError pwdNotMatch">ÐинималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° паÑÐ¾Ð»Ñ 7 Ñимволов. ÐожалÑйÑÑа, пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð°.</div>'); 202 return false; 203 } 204 205 // check birthdate 206 if(($('#birthdate_field').val() != '--.--.----' && !IsDateValid($('#birthdate_field').val()))){ // $('#phone_1_field').val() == confirmedPhone && 207 // $('.birthdate-profilegroup').addClass('has-error'); 208 if($('#birthdate_field').val().length == 0) 209 $('#birthdate_field').prop('readonly', false); 210 // $('.regInfo').html('<div class="responseError pwdNotMatch">ÐаÑа ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ñказана невеÑно. ÐожалÑйÑÑа, пÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð°.</div>'); 211 // return false; 212 } 213 214 // form still not valid 215 if(!myValidator(jQuery('#registerTab form'), true)) // $('#phone_1_field').val() == confirmedPhone && 216 return false; 217 218 // if(grecaptcha !== 'undefined') { 219 // if (!grecaptcha.getResponse()) { 220 // $('.g-recaptcha iframe').css('box-shadow', '0px 0px 5px 1px #f00'); 221 // return false; 222 // } else { 223 // $('.g-recaptcha iframe').css('box-shadow', 'none'); 224 // } 225 // } 226 227 $('#registerTab .ajaxloader').show(); 228 229 // check email and add contact
230 if(myValidator(jQuery('#registerTab form'), true)){ // $('#phone_1_field').val() == confirmedPhone && 231 232 $.ajax({ 233 url: '/profile?ajax=1&checkEmail=1', 234 dataType: 'json', 235 data: { phone: phone, email: email, lastname: $('#last_name_field').val(), firstname: $('#first_name_field').val(), birthdate: $('#birthdate_field').val() }, 236 cache: false 237 }).done(function(data) { 238 if(data.e == 0){ 239 // $('.regInfo').html('ÐÑÑ Ð¾Ðº!'); 240 $('.regbtn').click(); 241 } else if(data.e == 30){ 242 $('.regInfo').html(data.m); 243 } 244 $('#registerTab .ajaxloader').hide(); 245 }); 246 return; 247 } 248 249 // check phone 250 $.ajax({ 251 url: '/profile?ajax=1&checkPhone=1', 252 dataType: 'json', 253 data: { phone: phone }, 254 cache: false 255 }).done(function(data) { 256 $('.regInfo').removeClass('passreset'); 257 if(data.e == 0 || data.e == 27){ 258 CheckPhone(); 259 } else if(data.e == 28){ 260 $('.regInfo').html(data.m); 261 $('.regInfo').addClass('passreset'); 262 } else if(data.e == 1){ 263 $.ajax({
264 url: '/profile?ajax=1&genCode=1', 265 type: "POST", 266 dataType: 'json', 267 data: { 268 phone: phone, 269 'g-recaptcha-response': $('#g-recaptcha-response').val() 270 }, 271 cache: false 272 }).done(function(data) { 273 $('.g-recaptcha iframe').css('box-shadow', 'none'); 274 if(data.e == 0){ 275 $.fancybox.open('<div class="codeCheckDlg"><div class="dlgContent"><div class="codeCheckErr"></div><div>Ðа ÐÐ°Ñ ÑелеÑон бÑл оÑпÑавлен пÑовеÑоÑнÑй код.</div><div><label for="codeConfirm">ÐведиÑе код: </label><input id="codeConfirm" maxlength="4" name="codeConfirm" placeholder="____" type="text" pattern="\d*" /></div><button class="sendCode" type="button">ÐÑовеÑиÑÑ</button></div></div>', { 276 type : 'html', 277 minWidth : 320, 278 minHeight : 400, 279 fitToView : false, 280 autoSize : false, 281 touch : false, 282 afterShow: function(instance, current){ 283 // $('#codeConfirm').mask("9999", {autoclear:1}).focus(); 284 285 // check code 286 $("#codeConfirm").keyup(function(event) { 287 if (event.keyCode === 13) { 288 SendCode(); 289 } 290 });
291 $('.sendCode').click(function(e){ 292 e.preventDefault(); 293 SendCode(); 294 }); 295 296 function SendCode(){ 297 $('.codeCheckErr').html(''); 298 299 var confirmCode = parseInt($('#codeConfirm').val(), 10); 300 if(!(confirmCode >= 1000 && confirmCode <= 9999)){ 301 $('.codeCheckErr').html('ÐÑибка Ð´Ð»Ð¸Ð½Ñ ÐºÐ¾Ð´Ð°, ÑÑо должно бÑÑÑ ÑеÑÑÑÑÑ Ð·Ð½Ð°Ñное ÑиÑло.') 302 return false; 303 } 304 305 $.ajax({ 306 url: '/profile?ajax=1&confirmCode='+confirmCode, 307 dataType: 'json', 308 cache: false 309 }).done(function(data) { 310 if(data.e == 0){ 311 // phone confirmed 312 $('.codeCheckDlg .dlgContent').html(data.m); 313 setTimeout(function(){ instance.close(); }, 3000); 314 315 confirmedPhone = phone; 316 CheckPhone(); 317 } else { 318 if(data.e == 12){ 319 $('.codeCheckDlg .dlgContent').html(data.m); 320 $('.genCode').click(function(e){ 321 e.preventDefault(); 322 instance.close(); 323 $('.confirmPhone').click(); 324 }); 325 } else if(data.e == 13){ 326 instance.close(); 327 $('.confirmPhone').click(); 328 } else { 329 $('.codeCheckDlg .codeCheckErr').html(data.m); 330 $(".wrongCode .countdown").countdown($('.wrongCode .countdown').data('counter'), function(e) { $(this).text(e.strftime('%M:%S')); }); 331 } 332 } 333 }); 334 } 335 336 } 337 }); 338 } else if(data.e == 26){ 339 $.fancybox.open(data.m, { 340 type : 'html', 341 minWidth : 320, 342 minHeight : 400, 343 fitToView : false, 344 autoSize : false, 345 touch : false, 346 afterShow: function(instance, current){ 347 $(".wrongCode .countdown").countdown($('.wrongCode .countdown').data('counter'), function(e) { $(this).text(e.strftime('%M:%S')); }); 348 $('.genCode').click(function(e){ 349 e.preventDefault(); 350 instance.close(); 351 $('.confirmPhone').click(); 352 });
353 } 354 }); 355 } else if(data.e == 6){ 356 $.fancybox.open(data.m, { 357 type : 'html', 358 minWidth : 320, 359 minHeight : 400, 360 fitToView : false, 361 autoSize : false, 362 touch : false 363 }); 364 } else if(data.e === 7){ 365 $('.g-recaptcha iframe').css('box-shadow', '0px 0px 5px 1px #f00'); 366 if(grecaptcha != 'undefined'){ 367 grecaptcha.reset(); 368 } 369 } 370 }); 371 } 372 $('#registerTab .ajaxloader').hide(); 373 }); 374 }); 375 376 // radio select 377 $(document).on('click', '.proopc-procards .proopc-nonothing, .proopc-procards .proopc-card, .proopc-procards .proopc-promocode', function(e){ 378 // if(!$(this).hasClass('proopc-card')) 379 // e.preventDefault(); 380 381 $(this).find('.pro-radio input[type="radio"]').prop("checked", true); 382 }); 383 384 385 // get available coupons 386 GetCoupons = function(){ 387 // ProOPC.addloader('#proopc-promocode'); 388 $.ajax({ 389 url: '/profile?isin=1', 390 dataType: 'json', 391 cache: false 392 }).done(function(data) { 393 if(data.e == 0){ 394 $.ajax({
395 url: '/cart?ajax=1&getCoupons=1', 396 dataType: 'json', 397 cache: false 398 }).done(function(data) { 399 if(data.e == 0){ 400 $('.couponList').html(data.m); 401 } 402 // ProOPC.removeloader('#proopc-promocode'); 403 }); 404 } 405 }); 406 } 407 if($('.couponList')[0]) 408 GetCoupons(); 409 410 // apply coupon in cart 411 $(document).on('change', '.couponList select[name="availableCoupons"]', function(e){ 412 e.preventDefault(); 413 414 ApplyCoupon(); 415 }); 416 417 function ApplyCoupon(){ 418 var coupon = $('.couponList select[name="availableCoupons"] option:selected').val(); 419 var couponName = $('.couponList select[name="availableCoupons"] option:selected').text(); 420 if(coupon){ 421 $('#proopc-promocode-in').val(''); 422 $('.couponList select[name="availableCoupons"]').addClass('selected'); 423 ApplyPromocode(coupon, true, couponName); 424 } else { 425 ResetPromocode(); 426 } 427 } 428 429 // apply promocode in cart 430 $(document).on('click', '#proopc-task-promocode', function(e){ 431 e.preventDefault(); 432 ApplyPromocode(); 433 }); 434 $(document).on('keyup', "#proopc-promocode-in", function(event) { 435 if (event.keyCode === 13) { 436 ApplyPromocode(); 437 } 438 }); 439 ApplyPromocode = function(promocode, isCoupon, couponName){ 440 if(!promocode) 441 promocode = $('#proopc-promocode-in').val(); 442 if(promocode != null && promocode.length > 0){ 443 ProOPC.addloader('#proopc-pricelist, .proopc-procards'); 444 445 $.ajax({ 446 url: '/profile?isin=1', 447 dataType: 'json', 448 cache: false 449 }).done(function(data) { 450 if(data.e == 0){ 451 $.ajax({
452 url: '/cart?ajax=1&isCoupon='+(isCoupon ? 1 : 0)+(isCoupon && couponName.length > 0 ? '&couponName='+couponName : '')+'&promocode='+promocode, 453 dataType: 'json', 454 cache: false 455 }).done(function(data) { 456 if(data.e == 0){ 457 if(!isCoupon) 458 $('#proopc-promocode-in').val(data.m); 459 $('#proopc-bonusAmount').val(''); 460 ProOPC.getcartsummery(); 461 } else { 462 ProOPC.setmsg(1, data.m); 463 ProOPC.removeloader('#proopc-pricelist'); 464 } 465 ProOPC.removeloader('.proopc-procards'); 466 }); 467 } else window.location.reload(); 468 }); 469 470 } else ProOPC.setmsg(1, 'ÐожалÑйÑÑа, ÑкажиÑе веÑнÑй пÑомокод.'); 471 } 472 473 // reset applied promocode 474 $(document).on('click', '#proopc-task-resetpromocode', function(e){ 475 e.preventDefault(); 476 477 ResetPromocode(); 478 }); 479 480 ResetPromocode = function(){ 481 // ProOPC.addloader('#proopc-pricelist, .proopc-procards'); 482 $.ajax({ 483 url: '/profile?isin=1', 484 dataType: 'json', 485 cache: false 486 }).done(function(data) { 487 if(data.e == 0){ 488 $.ajax({
489 url: '/cart?ajax=1&resetPromocode=1', 490 dataType: 'json', 491 cache: false 492 }).done(function(data) { 493 if(data.e == 0){ 494 $('#proopc-promocode-in').val(''); 495 if($('.couponList select')[0]){ 496 $('.couponList select[name="availableCoupons"]').prop('selectedIndex',0); 497 $('.couponList select[name="availableCoupons"]').removeClass('selected'); 498 $('.couponList select[name="availableCoupons"] option.selected').removeClass('selected'); 499 } 500 ProOPC.getcartsummery(); 501 } else { 502 ProOPC.setmsg(1, data.m); 503 // ProOPC.removeloader('#proopc-pricelist, .proopc-procards'); 504 } 505 }); 506 } else window.location.reload(); 507 }); 508 } 509 510 // apply bonuses in cart 511 $(document).on('click', '#proopc-task-savebonuses', function(e){ 512 e.preventDefault(); 513 ApplyBonuses(); 514 }); 515 $(document).on('keyup', "#proopc-bonusAmount", function(event) { 516 if (event.keyCode === 13) { 517 ApplyBonuses(); 518 } 519 }); 520 ApplyBonuses = function(){ 521 var bonusAmount = parseInt($('#proopc-bonusAmount').val(), 10); 522 if(bonusAmount > 0){ 523 ProOPC.addloader('#proopc-pricelist, .proopc-procards'); 524 $.ajax({ 525 url: '/profile?isin=1', 526 dataType: 'json', 527 cache: false 528 }).done(function(data) { 529 if(data.e == 0){ 530 $.ajax({
531 url: '/cart?ajax=1&bonuses='+bonusAmount, 532 dataType: 'json', 533 cache: false 534 }).done(function(data) { 535 if(data.e == 0){ 536 if(bonusAmount != parseInt(data.m, 10)){ 537 $('#proopc-bonusAmount').val(data.m); 538 } 539 $('#proopc-promocode-in').val(''); 540 ProOPC.getcartsummery(); 541 } else { 542 ProOPC.setmsg(1, data.m); 543 ProOPC.removeloader('#proopc-pricelist'); 544 } 545 ProOPC.removeloader('.proopc-procards'); 546 }); 547 } else window.location.reload(); 548 }); 549 } else ProOPC.setmsg(1, 'ÐожалÑйÑÑа, введиÑе колиÑеÑÑво болÑÑе 0.'); 550 } 551 552 // reset applied bonuses 553 $(document).on('click', '#proopc-task-resetbonuses', function(e){ 554 e.preventDefault(); 555 556 ProOPC.addloader('#proopc-pricelist'); 557 $.ajax({ 558 url: '/profile?isin=1', 559 dataType: 'json', 560 cache: false 561 }).done(function(data) { 562 if(data.e == 0){ 563 $.ajax({ 564 url: '/cart?ajax=1&resetBonuses=1', 565 dataType: 'json', 566 cache: false 567 }).done(function(data) { 568 if(data.e == 0){ 569 $('#proopc-bonusAmount').val(''); 570 ProOPC.getcartsummery(); 571 } else { 572 ProOPC.setmsg(1, data.m); 573 ProOPC.removeloader('#proopc-pricelist'); 574 } 575 }); 576 } else window.location.reload(); 577 }); 578 }); 579 580 // order details 581 var orderDetailsShown = false; 582 $(document).on('click', '.cardhistory .orderNumber', function(e){ 583 if(orderDetailsShown) return; 584 orderDetailsShown = true; 585 var orderNum = $(this).text().trim(); 586 $.ajax({ 587 url: '/profile?isin=1', 588 dataType: 'json', 589 cache: false 590 }).done(function(data) { 591 if(data.e == 0){ 592 $.fancybox.open('<div class="orderDetails"><div class="dlgContent"></div></div>', { 593 type : 'html', 594 minWidth : 320, 595 minHeight : 400, 596 fitToView : false, 597 autoSize : false, 598 touch : false, 599 afterLoad: function(instance, current){ current.$slide.find('.orderDetails').hide(); }, 600 afterShow: function(instance, current){ 601 instance.showLoading( current ); 602 $.ajax({
603 url: '/profile?ajax=1&orderNumberInfo='+orderNum, 604 dataType: 'json', 605 cache: false 606 }).done(function(data) { 607 instance.hideLoading(current); 608 current.$slide.find('.orderDetails').show(); 609 current.$slide.find('.dlgContent').html(data.m); 610 }); 611 }, 612 afterClose: function(instance, current){ 613 orderDetailsShown = false; 614 } 615 }); 616 } else window.location = '/profile'; 617 }); 618 }); 619 620 // confirm phone 621 $(document).on('click', '.confirmPhone, .phoneConfirmed.no', function(e){ 622 $.ajax({ 623 url: '/profile?isin=1', 624 dataType: 'json', 625 cache: false 626 }).done(function(data) { 627 if(data.e == 0){ 628 $.ajax({ 629 url: '/profile?ajax=1&genCode=1', 630 dataType: 'json', 631 cache: false 632 }).done(function(data) { 633 if(data.e == 0){ 634 $.fancybox.open('<div class="codeCheckDlg"><div class="dlgContent"><div class="codeCheckErr"></div><div>Ðа ÐÐ°Ñ ÑелеÑон бÑл оÑпÑавлен пÑовеÑоÑнÑй код.</div><div><label for="codeConfirm">ÐведиÑе код: </label><input id="codeConfirm" maxlength="4" name="codeConfirm" placeholder="____" type="text" pattern="\d*" /></div><button class="sendCode" type="button">ÐÑовеÑиÑÑ</button></div></div>', { 635 type : 'html', 636 minWidth : 320, 637 minHeight : 400, 638 fitToView : false, 639 autoSize : false, 640 touch : false, 641 afterShow: function(instance, current){ 642 // $('#codeConfirm').mask("9999", {autoclear:1}).focus(); 643 644 // check code 645 $("#codeConfirm").keyup(function(event) { 646 if (event.keyCode === 13) { 647 SendCode(); 648 } 649 });
650 $('.sendCode').click(function(e){ 651 e.preventDefault(); 652 SendCode(); 653 }); 654 655 function SendCode(){ 656 $('.codeCheckErr').html(''); 657 658 var confirmCode = parseInt($('#codeConfirm').val(), 10); 659 if(!(confirmCode >= 1000 && confirmCode <= 9999)){ 660 $('.codeCheckErr').html('ÐÑибка Ð´Ð»Ð¸Ð½Ñ ÐºÐ¾Ð´Ð°, ÑÑо должно бÑÑÑ ÑеÑÑÑÑÑ Ð·Ð½Ð°Ñное ÑиÑло.') 661 return false; 662 } 663 664 $.ajax({ 665 url: '/profile?ajax=1&confirmCode='+confirmCode, 666 dataType: 'json', 667 cache: false 668 }).done(function(data) { 669 if(data.e == 0){ 670 $('.codeCheckDlg .dlgContent').html(data.m); 671 // IsPhoneConfirmed(true); 672 GetCards(); 673 setTimeout(function(){ instance.close(); }, 3000); 674 } else { 675 if(data.e == 12){ 676 $('.codeCheckDlg .dlgContent').html(data.m); 677 $('.genCode').click(function(e){ 678 e.preventDefault(); 679 instance.close(); 680 $('.confirmPhone').click(); 681 }); 682 } else if(data.e == 13){ 683 instance.close(); 684 $('.confirmPhone').click(); 685 } else { 686 $('.codeCheckDlg .codeCheckErr').html(data.m); 687 $(".wrongCode .countdown").countdown($('.wrongCode .countdown').data('counter'), function(e) { $(this).text(e.strftime('%M:%S')); }); 688 } 689 } 690 }); 691 } 692 693 } 694 }); 695 } else if(data.e == 26){ 696 $.fancybox.open(data.m, { 697 type : 'html', 698 minWidth : 320, 699 minHeight : 400, 700 fitToView : false, 701 autoSize : false, 702 touch : false, 703 afterShow: function(instance, current){ 704 $(".wrongCode .countdown").countdown($('.wrongCode .countdown').data('counter'), function(e) { $(this).text(e.strftime('%M:%S')); }); 705 $('.genCode').click(function(e){ 706 e.preventDefault(); 707 instance.close(); 708 $('.confirmPhone').click(); 709 });
710 } 711 }); 712 } else if(data.e == 6){ 713 $.fancybox.open(data.m, { 714 type : 'html', 715 minWidth : 320, 716 minHeight : 400, 717 fitToView : false, 718 autoSize : false, 719 touch : false 720 }); 721 } 722 }); 723 } else window.location = '/profile'; 724 }); 725 }); 726 727 // get new card 728 $(document).on('click', '.addCard', function(e){ 729 e.preventDefault(); 730 $.ajax({ 731 url: '/profile?isin=1', 732 dataType: 'json', 733 cache: false 734 }).done(function(data) { 735 if(data.e == 0){ 736 if(!$('.bonuscards .ajaxloader')[0]) $('.bonuscards .cards').prepend('<img class="ajaxloader" src="/images/ajax-load.gif" alt="" />'); 737 $.ajax({ 738 url: '/profile?ajax=1&addCard=1', 739 cache: false 740 }).done(function(data) { 741 if(data.e == 0){ 742 $('.bonuscards .cards').html(data.m); 743 GetCards(); 744 } else { 745 $('.bonuscards .cards').html(data.m); 746 } 747 }); 748 } else window.location = '/profile'; 749 }); 750 }); 751 752 // get card details 753 var getCardsInterval; 754 function GetCards(){ 755 if(!$('.bonuscards .cards')[0]) 756 return; 757 //if(!$('.bonuscards .ajaxloader')[0]) $('.bonuscards .cards').prepend('<img class="ajaxloader" src="/images/ajax-load.gif" alt="" />'); 758 $.ajax({ 759 url: '/profile?isin=1', 760 dataType: 'json', 761 cache: false 762 }).done(function(data) { 763 if(data.e == 0){ 764 var fh = getURLParameter('fh') == 1 ? 1 : 0; 765 $.ajax({
766 url: '/profile?ajax=1&getCards=1&fh='+fh, 767 cache: false 768 }).done(function(data) { 769 // clearInterval(getCardsInterval); 770 $('.bonuscards .cards').html(data.m); 771 772 $('.bonuscards .cards .ajaxloader').hide(); 773 IsPhoneConfirmed(data.e == 1 ? false : true); 774 }); 775 } else window.location = '/profile'; 776 }); 777 } 778 if($('.bonuscards .cards')[0]){ 779 getCardsInterval = setInterval(GetCards, 30000); 780 GetCards(); 781 } 782 783 // render if phone confirmed 784 function IsPhoneConfirmed(confirmed){ 785 if(!$('.phoneConfirmed')[0]){ 786 $('.phone_1-profilegroup #phone_1_field').parent().append('<div class="phoneConfirmed"></div>') 787 } 788 if(confirmed){ 789 $('#phone_1_field').removeClass('toConfirm').addClass('confirmed'); 790 $('.phoneConfirmed').removeClass('no icon-eshop-cancel-circled2').addClass('yes icon-eshop-ok-circled2').prop('title', 'ТелеÑон подÑвеÑждÑн, вÑÑ ÐºÐ»Ð°ÑÑно :)'); 791 } else { 792 $('#phone_1_field').removeClass('confirmed').addClass('toConfirm'); 793 $('.phoneConfirmed').removeClass('yes icon-eshop-ok-circled2').addClass('no icon-eshop-cancel-circled2').prop('title', 'ÐÐ°Ñ ÑелеÑон ÑÑебÑÐµÑ Ð¿Ð¾Ð´ÑвеÑждениÑ. ÐажмиÑе ÑÑда, ÑÑÐ¾Ð±Ñ ÑделаÑÑ ÑÑо ÑейÑÐ°Ñ :)'); 794 } 795 } 796 797 // get card details in cart 798 var getCardCartInterval; 799 function GetCardCart(){ 800 $.ajax({ 801 url: '/cart?ajax=1&getCardCart=1', 802 cache: false 803 }).done(function(data) { 804 if(data.e >= 0){ 805 $('.proopc-card .proopc-input-append').html(data.m); 806 $('.proopc-bonus-title .hasTooltip').tooltip({ 807 'html': true, 808 'container': 'body' 809 }); 810 clearInterval(getCardCartInterval); 811 } 812 }); 813 } 814 if($('.proopc-card')[0]){ 815 getCardCartInterval = setInterval(GetCardCart, 5000); 816 GetCardCart(); 817 } 818 819 // get name 820 function GetName(){ 821 $.ajax({ 822 url: '/profile?isin=1', 823 dataType: 'json', 824 cache: false 825 }).done(function(data) { 826 if(data.e == 0){ 827 $.ajax({
828 url: '/profile?ajax=1&getName=1', 829 cache: false 830 }).done(function(data) { 831 if(data.e == 0){ 832 $('.loginBtn.loggedIn.fname').html(data.m); 833 } else { 834 $('.loginBtn.loggedIn.fname').remove(); 835 $('.loginBtn.loggedIn.leftBtn').show(); 836 } 837 838 }); 839 } else $('.loginBtn.loggedIn.leftBtn').show(); 840 }); 841 } 842 GetName(); 843 844}); 845 846function IsDateValid(str){ 847 var regexp = /^\d{1,2}\.\d{1,2}\.\d{1,4}$/; 848 if ( regexp.test( str ) ){ 849 var values = str.split('.'); 850 var d = values[0] - 0; 851 var m = values[1] - 0; 852 var y = values[2] - 0; 853 var daysInMonth = 0; 854 855 var yearMax = (new Date()).getFullYear(); 856 857 if ( m < 1 || m > 12 || y < 1 || y > yearMax ){ 858 return false; 859 } else { 860 if ( m == 2 ){ 861 daysInMonth = ( ( y % 4 ) == 0 ) ? 29 : 28; 862 } else if ( m == 4 || m == 6 || m == 9 || m == 11 ) { 863 daysInMonth = 30; 864 } else daysInMonth = 31; 865 return ( d <= daysInMonth ); 866 } 867 } 868 return false; 869} 870function ValidateEmail(email) { 871 var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 872 return re.test(String(email).toLowerCase()); 873}
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.