1var obCallback = { 2 recaptchaSiteKey: '6LerBTYpAAAAAD_v9T3Iiiesc2ba9AXLXgZ9x6Qu', 3 recaptchaPromise: null, 4 5 loadRecaptcha: function () { 6 'use strict'; 7 8 if (window.grecaptcha) { 9 return new Promise(function (resolve) { 10 grecaptcha.ready(function () { 11 resolve(grecaptcha); 12 }); 13 }); 14 } 15 16 if (this.recaptchaPromise) { 17 return this.recaptchaPromise; 18 } 19 20 this.recaptchaPromise = new Promise(function (resolve, reject) { 21 var script = document.createElement('script'); 22 script.src = 'https://www.google.com/recaptcha/api.js?render=' + encodeURIComponent(obCallback.recaptchaSiteKey); 23 script.async = true; 24 script.defer = true; 25 26 script.onload = function () { 27 grecaptcha.ready(function () { 28 resolve(grecaptcha); 29 }); 30 }; 31 32 script.onerror = function () { 33 obCallback.recaptchaPromise = null; 34 reject(new Error('Failed to load reCAPTCHA')); 35 }; 36 37 document.head.appendChild(script); 38 }); 39 40 return this.recaptchaPromise; 41 }, 42 43 show: function (self) { 44 'use strict'; 45 46 obCallback.loadRecaptcha().catch(function (error) { 47 if (window.console) { 48 console.error(error); 49 } 50 }); 51 52 var $self = $(self); 53 54 55 var selector = $self.hasAttr("data-div") ? $self.data("div") : ".dCallbackForm:last"; 56 var $div = $(selector).clone(); 57 obPlaceHolder.destroy($div.find("[tpr]")); 58 obPlaceHolder.bind(); 59 60 var $title = $div.find("h3"); 61 if ($self.hasAttr("data-title")) { 62 var sTitle = $self.hasAttr("data-title") ? $self.data("title") : "ÐаказаÑÑ Ð·Ð²Ð¾Ð½Ð¾Ðº"; 63 $title.text(sTitle); 64 } 65 66 var iTemplateID = 7; 67 var $inputTemplate = $div.find("[data-clb-template]"); 68 if ($self.hasAttr("data-template-id") && (iTemplateID = IntVal($self.data("template-id")))) { 69 if ($inputTemplate.length) { 70 $inputTemplate.val(iTemplateID); 71 } 72 } 73 var iConfigID = 0; 74 if ((iConfigID = IntVal($self.data('config-id'))) && (!!obMailConfig)) { 75 if (array_key_exists(iConfigID, obMailConfig)) { 76 var obMail = obMailConfig[iConfigID]; 77 if ((!!obMail["TITLE"]) && ($title.length)) { 78 $title.text(obMail["TITLE"]); 79 } 80 var $button = $div.find("button"); 81 if ((!!obMail["BUTTON_TEXT"]) && ($button.length)) { 82 $button.text(obMail["BUTTON_TEXT"]); 83 } 84 85 if (iConfigID == '13') { 86 87 var el = $div.find(".input_box:gt(1)"); 88 //el.prepend('<div class="input_box"><input type="email" placeholder="ÐÐ°Ñ email" name="CALLBACK[EMAIL]" class="tx form-control "></div>'); 89 var file = $div.find('.file-input-name'); 90 var file1 = $div.find('.file-input-wrapper'); 91 92 file.html("ÐÑиложиÑÑ ÑеквизиÑÑ Ð¸Ð»Ð¸ заÑвкÑ"); 93 file1.children().html("ÐÑбÑаÑÑ Ñайл"); 94 95 var comment = $div.find(".textarea_box"); 96 //comment.hide(); 97 98 } 99 100 if ((!!obMail["INGATE_CB"])) { 101 $div.find("[data-ingate-target]").val(obMail["INGATE_CB"]); 102 } 103 104 105 var $form = $div.find("form"); 106 var $input = $form.find("[name='CALLBACK[CONFIG_ID]']"); 107 if ($input.length) $input.prop("value", iConfigID); 108 else $form.append("<input type='hidden' name='CALLBACK[CONFIG_ID]' value='" + iConfigID + "'/>"); 109 if ((!!obMail["TEMPLATE_ID"]) && ($inputTemplate.length)) { 110 $inputTemplate.val(obMail["TEMPLATE_ID"]); 111 } 112 } 113 } 114 115 116 if ($self.data("managerId")) { 117 $div.find(".managerId").val($self.data("managerId")); 118 } 119 if ($self.data("managerEmail")) { 120 $div.find(".managerEmail").val($self.data("managerEmail")); 121 } 122 var $titleInput = $div.find("[data-clb-title]"); 123 if ($titleInput.length) { 124 $titleInput.val($title.text()); 125 } 126 127 if ($self.hasAttr("data-small-toggle")) { 128 var $next = $self.next(); 129 if ($next.hasAttr("data-callback")) { 130 $next.slideToggle(300); 131 } else { 132 $self.after($div); 133 $div.slideToggle(300); 134 } 135 136 137 } else { 138 $.fancybox({ 139 content: $div, 140 afterShow: function () { 141 obCallback.bind(); 142 }, 143 helpers: { 144 overlay: {
145 locked: false 146 } 147 } 148 }); 149 } 150 151 setTimeout(() => { 152 $('[data-js="callback-phone"]').mask("+7 (999) 999-99-99"); 153 }) 154 }, 155 156 submit: function (self) { 157 'use strict'; 158 var $form = $(self); 159 160 if (!$form.hasClass("loading")) { 161 var $target = $form.find("[data-clb-target]"); 162 var target = "callback_origin"; 163 if ($target.length) { 164 target = $target.val(); 165 } 166 167 var $ingateCB = $form.find("[data-ingate-target]"); 168 var ingateTarget = "zvonok"; 169 if ($ingateCB.length) { 170 ingateTarget = $ingateCB.val(); 171 } 172 var $parent = $form.parents(".dCallback"); 173 $form.validate({ 174 rules: { 175 "CALLBACK[PHONE]": { 176 phone: 10 177 } 178 } 179 }); 180 if ($form.valid()) { 181 var $sess = $("<input type='hidden' name='sessid' value='" + BX.bitrix_sessid() + "'/>"); 182 $sess.appendTo($form); 183 184 if ($form.find('.g-recaptcha-response').length > 0) { 185 obCallback.loadRecaptcha().then(function () { 186 return grecaptcha.execute(obCallback.recaptchaSiteKey, {action: 'submit'}); 187 }).then(function (token) { 188 $form.find('.g-recaptcha-response').val(token); 189 190 var obData = new FormData(self); 191 192 //return false; 193 //obData.append("sessid",BX.bitrix_sessid()); 194 $.ajax({ 195 url: $form.attr("action"), 196 data: obData, 197 processData: false, 198 contentType: false, 199 type: "post", 200 timeout: 30000, 201 beforeSend: function () { 202 $form.addClass("loading"); 203 }, 204 205 success: function (data) { 206 var $replace = $(data).find("[data-callback] form"); 207 $form.replaceWith($replace); 208 obCallback.bind(); 209 210 if (ingateTarget) { 211 ym(7500958, 'reachGoal', ingateTarget); 212 } 213 } 214 }); 215 }).catch(function (error) { 216 $form.removeClass("loading"); 217 if (window.console) { 218 console.error(error); 219 } 220 alert('Ðе ÑдалоÑÑ Ð²ÑполниÑÑ Ð¿ÑовеÑкÑ. ÐбновиÑе ÑÑÑаниÑÑ Ð¸ попÑобÑйÑе Ñнова.'); 221 }); 222 } else { 223 var obData = new FormData(self); 224 225 //return false; 226 //obData.append("sessid",BX.bitrix_sessid()); 227 $.ajax({ 228 url: $form.attr("action"), 229 data: obData, 230 processData: false, 231 contentType: false, 232 type: "post", 233 timeout: 30000, 234 beforeSend: function () { 235 $form.addClass("loading"); 236 }, 237 238 success: function (data) { 239 var $replace = $(data).find("[data-callback] form"); 240 $form.replaceWith($replace); 241 obCallback.bind(); 242 243 if (ingateTarget) { 244 ym(7500958, 'reachGoal', ingateTarget); 245 } 246 } 247 }); 248 } 249 250 251 } 252 } 253 return false;
254 }, 255 256 bind: function () { 257 obPlaceHolder.bind(); 258 }, 259 260 // init:(function(){ 261 // $(function(){ 262 // obCallback.bind(); 263 // }); 264 // })() 265};
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.