1$(function () { 2 $('.js-purchase-solution').click(function (e) { 3 e.preventDefault(); 4 const $this = $(this); 5 const v = $this.data('v'); 6 if (parseInt(v) === 2) { 7 return false; 8 } 9 const c = $this.parent().data('code'); 10 $('.js-change-variants-desc').hide(); 11 $.get('/ajax/_get.php', {a: 'getPurchaseSolutionHtml', i: $this.data('v'), c: c}, function (data) { 12 if (data.status === 'success') { 13 $('.js-purchase-solution').removeClass('active'); 14 $this.addClass('active'); 15 $('.js-purchase-solution-form').html(data.html); 16 } 17 }, 'json'); 18 }); 19 20 21 $(document).on('input', '.js-steam-link', $.debounce(500, function() { 22 checkLink($(this).val()); 23 })); 24 25 function checkLink(link) { 26 const button = $('.js-solution-link-form').find('.js-solution-confirm'); 27 const input = $(".js-steam-link"); 28 const errorText = $(".js-error-text"); 29 if (link.length < 1) { 30 input.removeClass("js-steam-link_error"); 31 button.addClass('confirm_inactive'); 32 errorText.hide(); 33 return false; 34 } 35 $.get("/ajax/_check.php?rnd=" + Math.random(), {a: "check_link", link: link}, function (data) { 36 if (data.status === "success") { 37 input.removeClass("js-steam-link_error"); 38 input.addClass("js-steam-link_success"); 39 button.removeClass('confirm_inactive'); 40 errorText.hide(); 41 } else { 42 input.addClass("js-steam-link_error"); 43 input.removeClass("js-steam-link_success"); 44 button.addClass('confirm_inactive'); 45 errorText.show(); 46 } 47 }, "json"); 48 } 49 50 $(document).on('input', '.js-steam-login', $.debounce(500, function() { 51 checkLogin($(this).val()); 52 })); 53 54 function checkLogin(login) { 55 const button = $('.js-solution-replenishment-form').find('.js-solution-confirm'); 56 const input = $(".js-steam-login"); 57 const errorText = $(".js-error-text"); 58 59 const pattern = /^[a-zA-Z0-9_@]{3,50}$/; 60 if (pattern.test(login)) { 61 input.removeClass("js-steam-link_error"); 62 input.addClass("js-steam-link_success"); 63 button.removeClass('confirm_inactive'); 64 errorText.hide(); 65 } else if (login === '') { 66 input.removeClass("js-steam-link_error"); 67 button.addClass('confirm_inactive'); 68 errorText.hide(); 69 } else { 70 input.addClass("js-steam-link_error"); 71 input.removeClass("js-steam-link_success"); 72 button.addClass('confirm_inactive'); 73 errorText.show(); 74 } 75 } 76 77 $(document).on('input', '.js-solution-return-form input', $.debounce(500, function() { 78 checkReturnForms($(this).attr("name"), $(this).val()); 79 })); 80 81 function checkReturnForms(type, value) { 82 const button = $('.js-solution-return-form').find('.js-solution-confirm'); 83 const inputBank = $(".js-steam-bank"); 84 const inputPhone = $(".js-steam-phone"); 85 const errorText = $(".js-error-text"); 86 const regexPhone = /^\+7\d{10}$/; 87 let error = false; 88 if (type === 'phone') { 89 if (value === '' || regexPhone.test(value)) { 90 inputPhone.removeClass("js-steam-link_error"); 91 inputPhone.addClass("js-steam-link_success"); 92 errorText.hide(); 93 error = false; 94 } else { 95 inputPhone.addClass("js-steam-link_error"); 96 inputPhone.removeClass("js-steam-link_success"); 97 errorText.show(); 98 error = true; 99 } 100 } 101 if ($('.js-steam-bank').val().length > 0 && $('.js-steam-phone').val().length > 0 && !error) { 102 button.removeClass('confirm_inactive'); 103 } else { 104 button.addClass('confirm_inactive'); 105 } 106 } 107 108 $(document).on('click', '.js-solution-confirm', function (e) { 109 e.preventDefault(); 110 const $this = $(this); 111 112 if ($this.hasClass('confirm_inactive')) { 113 return; 114 } 115 116 const v = $this.attr('data-v'); 117 const c = $this.attr('data-code'); 118 const f = $this.parents('form:first'); 119 120 const post = {}; 121 post['a'] = 'purchaseSolution'; 122 post['i'] = v; 123 post['c'] = c; 124 f.find('input').each(function() { 125 const input = $(this); 126 post[input.attr('name')] = input.val(); 127 }); 128 129 $.each(post, function(index, value) { 130 f.find('input[name="' + index + '"]').removeClass('js-steam-link_error'); 131 }); 132 $.post('/ajax/_post.php', post, function (data) { 133 if (data.status === 'error') { 134 $.each(data.errors, function(index, value) { 135 f.find('input[name="' + value + '"]').addClass('js-steam-link_error'); 136 }); 137 } else { 138 location.reload(); 139 } 140 }, 'json'); 141 }); 142 143 $(document).on('click', '.js-refund-confirm', function (e) { 144 e.preventDefault(); 145 const $this = $(this); 146 const c = $this.attr('data-code'); 147 const post = {}; 148 post['a'] = 'purchaseRefund'; 149 post['c'] = c; 150 151 $.post('/ajax/_post.php', post, function (data) { 152 location.reload(); 153 }, 'json'); 154 155 return false;
156 }); 157});
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.