1window.grShopGlobal = window.grShopGlobal || { 2 kindAvailable: function() { 3 var sentAjax_preorder = function (data, callback) { 4 $.ajax({ 5 url: '/-/x-api/v1/public/?method=shop2/addKindEmailNotification', 6 method: 'post', 7 xhrFields: { 8 withCredentials: true 9 }, 10 data: data, 11 success: function (result) { 12 callback(result); 13 } 14 }); 15 }; 16 17 var object_preorder = {}; 18 $(document).on('click', '.preorder-btn-js', function (e) { 19 e.preventDefault(); 20 object_preorder.data = {}; 21 22 object_preorder.jQbtn = $(this); 23 object_preorder.data.kind_id = object_preorder.jQbtn.data('product-kind_id'); 24 object_preorder.data.email = object_preorder.jQbtn.data('user-email') || 0; 25 26 if (object_preorder.data.email) { 27 var temp_email = ` 28 <div class="preorder-field preorder-email tpl-field type-email field-required"> 29 <span class="preorder-email_text"> 30 ${shop2.my.preorder_email_text || 'ÐаннÑй email Ñказан пÑи ÑегиÑÑÑаÑии.'} 31 </span> 32 <div class="preorder-email-input"> 33 <div class="preorder-field-title field-title">E-mail: <span class="field-required-mark">*</span></div> 34 <div class="preorder-field-value"> 35 <input type="text" name="email" required value="${object_preorder.data.email}"> 36 </div> 37 </div> 38 </div> 39 `; 40 41 } else { 42 var temp_email = ` 43 <div class="preorder-field preorder-email tpl-field type-email field-required"> 44 <div class="preorder-email-input"> 45 <div class="preorder-field-title field-title">E-mail: <span class="field-required-mark">*</span></div> 46 <div class="preorder-field-value"> 47 <input type="text" name="email" required value=""> 48 </div> 49 </div> 50 </div> 51 `; 52 } 53 if ($('.gr-agreement-link__text').text().trim() != "") { 54 var personalNoteText = $('.gr-agreement-link__text').html(); 55 var temp_personal_note = ` 56 <div class="preorder-field tpl-field preorder-personal-note field-required policy_checkbox type-checkbox"> 57 <div class="field-value"> 58 <ul> 59 <li> 60 <label> 61 <input required type="checkbox" name="preorder_agreement" /> 62 <span>${personalNoteText} <ins class="field-required-mark">*</ins></span> 63 </label> 64 </li> 65 </ul> 66 </div> 67 </div> 68 `; 69 } else { 70 var temp_personal_note = ``; 71 } 72 73 let captchaSiteKey = $('#gr-captcha-sitekey').html() || ''; 74 let temp_html = ` 75 <div class="preorder-form-wrap preorder-block"> 76 <form class="preorder_body" action="/-/x-api/v1/public/?method=shop2/addKindEmailNotification" method="post"> 77 <div class="preorder-title tpl-anketa__title"> 78 ${shop2.my.preorder_form_title || 'УзнаÑÑ Ð¾ поÑÑÑплении'} 79 </div> 80 <div class="preorder_text preorder-field type-html tpl-field type-html"> 81 ${shop2.my.preorder_form_text || 'ÐÑÑавÑÑе поÑÑÑ Ð¸ Ð¼Ñ Ð½Ð°Ð¿Ð¸Ñем вам, когда ÑÐ¾Ð²Ð°Ñ Ð¿Ð¾ÑвиÑÑÑ Ð² налиÑии.'} 82 </div> 83 ${temp_email} 84 ${temp_personal_note} 85 <input type="hidden" name="kind_id" value="${object_preorder.data.kind_id}"> 86 87 <div class="preorder-field tpl-field tpl-field-button"> 88 <button type="submit" class="tpl-form-button">${shop2.my.preorder_form_submitt || 'ÐÑпÑавиÑÑ'}</button> 89 </div> 90 ${captchaSiteKey} 91 </form> 92 <div class="block-recaptcha"></div> 93 </div> 94 `; 95 96 let this_remodal = $('.remodal[data-remodal-id="buy-one-click"]'); 97 98 this_remodal.find('.preorder-form-wrap').add(this_remodal.find('.tpl-anketa')).remove(); 99 100 this_remodal.append(temp_html); 101 102 this_remodal.remodal().open(); 103 104 this_remodal.on('closed.preorder', function (e) { 105 106 this_remodal.find('.preorder-form-wrap').remove(); 107 this_remodal.off('closed.preorder'); 108 }); 109 }); 110 111 $(document).on('submit', '.block-recaptcha form', function (e) { 112 e.preventDefault(); 113 114 var serializeArray = $(this).serializeArray(); 115 116 for (let i = 0; i < serializeArray.length; i++) { 117 if (serializeArray[i]['name'] == '_sitekey') { object_preorder.data['_sitekey'] = serializeArray[i]['value']; } 118 if (serializeArray[i]['name'] == 'g-recaptcha-response') { object_preorder.data['g-recaptcha-response'] = serializeArray[i]['value']; } 119 }; 120 121 sentAjax_preorder(object_preorder.data, (data) => { 122 123 object_preorder.jQbtn.addClass('disabled').get(0).setAttribute('disabled', 'disabled'); 124 125 $('.preorder-form-wrap').html(` 126 <div class="preorder_success tpl-anketa__right tpl-anketa__posted"> 127 <div class="tpl-anketa-success-note">${shop2.my.preorder_form_success || 'СпаÑибо!'}</div> 128 </div> 129 `); 130 131 if (object_preorder.jQbtn.closest('form').length) { 132 let $favorite_btn = object_preorder.jQbtn.closest('form').find('.gr-favorite-btn'); 133 134 if ($favorite_btn.length && !$favorite_btn.is(":hidden")) { 135 $favorite_btn.trigger('click'); 136 }; 137 }; 138 }); 139 140 }); 141 142 shop2.on('afterFavoriteAddItem', function () { 143 if ($('.preorder-form-wrap').length) { 144 $('#shop2-msg').hide(); 145 }; 146 }); 147 148 $(document).on('submit', '.preorder_body', function (e) { 149 e.preventDefault(); 150 var $form = $(this); 151 152 object_preorder.data.email = this.email.value; 153 const _regexEmeil = /^[\w-\.]+@[\w-]+\.[a-z]{2,4}$/i; 154 155 let valid = _regexEmeil.test(object_preorder.data.email); 156 157 object_preorder.data['smart-token'] = $('.preorder_body textarea[name="smart-token"]').text(); 158 159 if (valid) { 160 $.get('/-/x-api/v1/public/?method=shop2/addKindEmailNotification', function (data) { 161 const _regexBody = new RegExp(/<body[^>]*>(.*?)<\/body>/ig); 162 163 let body = data.result.html.match(_regexBody); 164 165 $form.parent('.preorder-block').find('.block-recaptcha').html(body); 166 }); 167 } else { 168 169 if (!$form.find('.preorder-email').hasClass('field-error')) 170 $form 171 .find('.preorder-email') 172 .addClass('field-error') 173 .find('.preorder-email-input .preorder-field-value') 174 .before(`<div class="error-message">ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ Ð°Ð´ÑеÑа ÑлекÑÑонной поÑÑÑ</div>`); 175 } 176 177 }); 178 } 179}
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.