1;(function ($) { 2 3 $(document).ready(function () { 4 5 var CForm = { 6 error: new Array(), 7 8 formParent: '.js-web-form', 9 form: '.js-web-form form', 10 url: '/local/tools/ajax/web_form.php', 11 urlCheckCaptha: '/local/tools/ajax/captcha_check.php', 12 email: '.js-email', 13 name: 'js-name', 14 phone: 'js-phone', 15 captcha_word: '.js-captcha-word', 16 captcha_sid: '.js-captcha-sid', 17 fileName: '.js-file-name', 18 file: '.js-file-input', 19 fileRemove: '.js-file-drop', 20 fileBtn: '.js-file-mask', 21 required: '.js-required', 22 23 // ÐÑпÑавка ÑоÑÐ¼Ñ 24 sendForm: function (form) { 25 26 _ = this; 27 28 29 console.log('sendForm 1'); 30 31 32 /* 33 // Ð¯Ð½Ð´ÐµÐºÑ captcha 34 // еÑли еÑÑÑ Ð½Ð° ÑÑÑаниÑе вÑзÑваем ÑÑаÑнÑй обÑабоÑÑик 35 // yacaptchainp=$('input[name="smart-token"]').length; 36 yacaptchainp = form.find('input[name="smart-token"]').length; 37 if(yacaptchainp==1) { 38 wfthis = form; 39 //console.log('ok' + yacaptcha); 40 console.log('yc' +form.find('input[name="smart-token"]').value); 41 42 yatoken=form.find('input[name="smart-token"]').attr("value"); 43 //yatoken=$('input[name="smart-token"]').value; 44 console.log('token ' + yatoken); 45 46 if ( typeof(yatoken) === "undefined" || yatoken === null ) { 47 // if (yacaptcha == 0) { 48 ncc=form.find('input[name="number-captcha-container"]').attr("value"); 49 console.log('ncc= ' + ncc); 50 51 52 handleSubmit(ncc); 53 // handleSubmit(_.yacwidgetId); 54 // handleSubmit(); 55 return false; 56 } 57 } 58 */ 59 60 61 62 63 64 65 var error = 0; 66 var email = form.find(_.email); 67 var date = form.find('.flatpickr-input'); 68 var name = form.find(_.name); 69 var phone = form.find(_.phone); 70 var message = form.find(_.message); 71 var required = form.find(_.required); 72 var captcha_word = form.find(_.captcha_word); 73 var captcha_sid = form.find(_.captcha_sid); 74 var file = form.find(_.file); 75 76// console.log('err0='+ error); 77 78 $.each(required, function () { 79 if (!_.requiredCheck($(this))) 80 error++; 81 }); 82 83 84 85 if (email.val()) { 86 if (!_.emailValidate(email)) 87 error++; 88 } 89 90 if (date.val()) { 91 if (!_.dateValidate(date)) 92 error++; 93 } 94 95 96// console.log('err1='+ error); 97 98 if (error != 0) { 99 _.setErrors(form); 100 return false; 101 } else { 102 103 104 // Ñели ÑндекÑа 105 106 107 if (typeof yaCounter66699 === 'undefined' || yaCounter66699 === null) 108 { } 109 else 110 { 111 if(form[0].name=='teacher_course') { yaCounter66699.reachGoal('zayavka_TT'); } 112 113 var turl = $(location).attr('href'); 114 if(form[0].name=='free_lesson_mini') 115 if(turl.indexOf("services/french/teenager")>-1) { yaCounter66699.reachGoal('Zayavka_s_tela_stranici'); } 116 117 if(form[0].name=='linkin_club') 118 if(turl.indexOf("services/linking-club")>-1) { yaCounter66699.reachGoal('linkin_club_body'); } 119 120 if(form[0].name=='free_lesson_full') 121 if(turl.indexOf("services/trial-lesson")>-1) { yaCounter66699.reachGoal('free_lesson_full'); } 122 123 if(form[0].name=='online_zayavka') 124 if(turl.indexOf("services/apply.php")>-1) { yaCounter66699.reachGoal('online_zayavka'); } 125 126 if(form[0].name=='SIMPLE_FORM_27') 127 if(turl.indexOf("services/corporate/apply_corporate.php")>-1) { yaCounter66699.reachGoal('corporate_training'); } 128 129 if(form[0].name=='SIMPLE_FORM_27_IND') 130 if(turl.indexOf("services/corporate/apply_corporate2.php")>-1) { yaCounter66699.reachGoal('departure'); } 131 132 133 if(form[0].name=='free_consult_abroad') 134 if(turl.indexOf("services/abroad/apply_abroad.php")>-1) { yaCounter66699.reachGoal('free_consult_abroad'); } 135 136 if(form[0].name=='teacher_course') 137 if(turl.indexOf("services/teacher/apply_tkt.php")>-1) { yaCounter66699.reachGoal('teacher_course'); } 138 139 if(form[0].name=='camp_order') 140 if(turl.indexOf("services/camps/apply_camp.php")>-1) { yaCounter66699.reachGoal('camp_order'); } 141 142 143// if(form[0].name=='free_lesson_full') { alert('1'); yaCounter66699.reachGoal('test_lesson'); ga('send', 'event', 'Forms', 'ClickMain'); alert('2'); } 144// if(form[0].name=='online_zayavka') { yaCounter66699.reachGoal('zapis_na_kursy'); } 145// if(form[0].name=='free_lesson_mini') { yaCounter66699.reachGoal('kursy_aacc'); } 146 147 } 148 149 150// alert(form[0].name); 151// alert(turl); 152 153 154 console.log('sendForm 2'); 155 156// console.log('err2='+ error); 157 158 var formData = new FormData(form[0]); 159 formData.append('web_form_submit', 'Y'); 160 formData.append('SITE_ID', SITE_ID); 161 if (email.val()) 162 formData.append('EMAIL', email.val()); 163 var inputSubmit = form.find('input[type="submit"]'); 164 inputSubmit.attr('disabled', 'disabled'); 165 166 $.ajax({ 167 url: _.url, 168 data: formData, 169 method: 'POST', 170 dataType: 'json', 171 cache: false, 172 processData: false, 173 contentType: false, 174 success: function (data) { 175 176 console.log('sendForm 3'); 177// console.log('err3='+ data.errors); 178 179 _.debugLog(data); 180 if (data.errors) { 181 182 183 if (form[0].name == 'ncanketa') 184 { 185 document.getElementById('error_msg').style.display = "block"; 186 $("#error_msg").html(data.errors_text); 187 $(document).scrollTop(0); 188 } 189 190 _.error = data.errors; 191 _.setErrorsFromAjax(form); 192 form.find('.js-error-form').removeClass('hide').html(data.errors_text); 193 _.captcha_reload(); 194 } else { 195 196 if (form[0].name == 'ncanketa') 197 { 198 $(_.formParent).html('<p id="form_mess" class="section__title">' + data.success + '</p>'); 199 document.getElementById('dv_btn_submit').style.display = "none"; 200 location.href = "/test/english/?source=anketa"; 201 } 202 else 203 $(_.formParent).html('<h2 id="form_mess" class="section__title">' + data.success + '<span id="form_ok_'+form[0].name+'"></span></h2>'); 204 205 if (form[0].name == 'free_lesson_full') evn(1); 206 if (form[0].name == 'online_zayavka') evn(2); 207 if (form[0].name == 'SIMPLE_FORM_27') evn(3); 208 if (form[0].name == 'SIMPLE_FORM_27_IND') evn(4); 209 if (form[0].name == 'free_consult_abroad') evn(5); 210 if (form[0].name == 'teacher_course') evn(6); 211 if (form[0].name == 'camp_order') evn(7); 212 if (form[0].name == 'camp_order_ozr') evn(7); 213 if (form[0].name == 'franchise') { evn(8); console.log('evn8'); } 214 if (form[0].name == 'free_lesson_mini') evn(9); 215 if (form[0].name == 'to_test_lesson_orenburg') window.location = "/centers
215/page/orenburg/apply.php?result=ok"; 216 217 if (form[0].name == 'online_zayavka_sch') evn(11); 218 219 220 if (form[0].name == 'to_test_lesson') evn(12); 221 if (form[0].name == 'linkin_club') evn(13); 222 if (form[0].name == 'callback_uc') evn(14); 223 if (form[0].name == 'online_grammar') evn(15); 224 if (form[0].name == 'online_zayavka_rus') evn(16); 225 if (form[0].name == 'online_zayavka_rus_exams') evn(17); 226 if (form[0].name == 'result_test_send') evn(19); 227 if (form[0].name == 'free_less_univer') evn(21); 228 229 // оÑпÑавлÑем в меÑÑÐ¸ÐºÑ ÑезÑлÑÑаÑÑ ÑоÑÐ¼Ñ ÑолÑко когда полÑзоваÑÐµÐ»Ñ Ð²ÑбÑал пÑÐ½ÐºÑ Ð¡Ð¾Ð±Ð¸ÑаÑÑÑ ÑÑиÑÑÑÑ 230 if (form[0].name == 'result_test_send') 231 { 232 var tvid = $('#form_dropdown_place').val(); 233 console.log('tvid='+tvid); 234 if(id==4836) evn(26); 235 } 236 237 if (form[0].name == 'dod') evn(27); 238 239 console.log('СобÑÑие SEND '); 240 241 if (form[0].name == 'free_lesson_mini') { 242 var turl = $(location).attr('href'); 243 console.log('СобÑÑие: 28_0: '+turl); 244 if(turl.indexOf("test/english-videotest")>-1) { console.log('СобÑÑие: 28_1'); 245 evn(28); console.log('СобÑÑие: 28_3'); } 246 } 247 248 249 250 251// console.log(form[0].name); 252 253 254///// evn(2) // global_js/ingevents.js 255///// ga('send', 'event', 'qforms', 'qsubmit'); alert('QA'); 256// gtag('config', 'UA-61575088-1', {'page_path': '/page_submit_rki'}); alert('PAGERKI'); 257// ga('send', 'event', 'forms', 'submit', 'free lesson', {hitCallback: ingEventsCallback('Google', '', false)}); 258 259 260// var fscrollTop = $('form_mess').offset().top; 261/////// $(document).scrollTop(0); 262 263 var scrollTop = $('#form_mess').offset().top-180; 264 console.log('fmscrl='+scrollTop); 265 $(document).scrollTop(scrollTop); 266 } 267 inputSubmit.removeAttr('disabled'); 268 }, 269 error: function (data) { 270 inputSubmit.removeAttr('disabled'); 271 if (data.responseText.length == 0) { 272 273 alert(JSON.stringify(data)); 274 // $(_.formParent).html('<h2 id="form_mess" class="section__title">СÐÐСÐÐÐ! ÐÐШРÐÐЯÐÐÐ ÐТÐÐ ÐÐÐÐÐÐ. СÐÐЦÐÐÐÐСТЫ ÐÐÐÐÐÐÐÐ ÐÐÐ ÐÐÐТÐЮТ ÐÐÐÐ ÐС РСÐЯÐУТСЯ С ÐÐÐÐ ÐÐЯ ÐÐÐÐ ÐÐÐÐÐ ÐÐÐСУÐЬТÐЦÐРРТÐЧÐÐÐÐ ÐÐÐÐÐÐ Ð ÐÐÐЧÐÐÐ ÐÐЯ.</h2>'); 275 } 276 _.debugLog(data); 277 }, 278 complete: function (data) { 279 inputSubmit.removeAttr('disabled'); 280 console.log('start logd'); 281 _.debugLog(data); 282 283 }, 284 always: function (data) { 285 _.debugLog(data); 286 } 287 }); 288 } 289 }, 290 debugLog: function (request) { 291 console.log('add logd'); 292 console.log(request); 293 var data = {request: request}; 294 295/* 296 $.ajax({ 297 url: '/local/tools/ajax/log_web_form.php', 298 data: data, 299 method: 'POST', 300 success: function () { 301 } 302 }); 303*/ 304 305 }, 306 //ÐÑовеÑка обÑзаÑелÑнÑÑ Ð¿Ð¾Ð»ÐµÐ¹ 307 requiredCheck: function (input) { 308 _ = this; 309 var type = input.attr('type'); 310 switch (type) { 311 case 'checkbox': 312 if (!input.prop('checked')) { 313 _.error[input.attr('name')] = 'Ðоле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ'; 314 return false;
315 } 316 break; 317 318 default: 319 if (input.val() == '') { 320 _.error[input.attr('name')] = 'Ðоле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ'; 321 return false; 322 } 323 break; 324 } 325 326 327 return true; 328 }, 329 330 //ÐÑовеÑка e-mail на валидноÑÑÑ 331 emailValidate: function (input) { 332 _ = this; 333 334 var regular = /^(([^<>()\[\]\\.,;:\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,}))$/; 335 if ( !regular.test(input.val().trim()) ) { 336 _.error[input.attr('name')] = 'ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ e-mail'; 337 return false; 338 } 339 return true; 340 }, 341 dateValidate: function (input) { 342 _ = this; 343 344 var regular = /^(((0[1-9]|[12]\d|3[01])\.(0[13578]|1[02])\.((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\.(0[13456789]|1[012])\.((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\.02\.((19|[2-9]\d)\d{2}))|(29\.02\.((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/; 345 if (!regular.test(input.val())) { 346 _.error[input.attr('name')] = 'ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ Ð´Ð°ÑÑ (веÑнÑй дд.мм.гггг)'; 347 return false; 348 } 349 return true; 350 }, 351 352 captcha_reload: function () { 353 $.getJSON('/local/tools/ajax/captcha_reload.php', function (data) { 354 $('.form-captcha img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + data); 355 $('input[name="captcha_sid"]').val(data); 356 $('input#captcha').val(''); 357 }); 358 return true; 359 }, 360 361 changeFile: function (input) { 362 _ = this; 363 $(_.fileName).attr('value', input[0].files[0].name); 364 $(_.fileRemove).removeClass('hide'); 365 }, 366 367 //ÐÑвод оÑибок в input 368 setErrors: function (form) { 369 _ = this; 370 var classError = 'has-error'; 371 $('.' + classError).removeClass(classError); 372 $('.text-error').remove(); 373 374 for (var p in _.error) { 375 // var input = form.find('.js-' + p); 376 377 var input = form.find('[name="' + p + '"]'); 378 if (form.hasClass('js-form-horizontal')) { 379 var formGroup = input.parent(); 380 } 381 else { 382 /*if (input.parents('.input-group').length > 0) { 383 var formGroup = input.parents('.input-group'); 384 } else { 385 var formGroup = input.parents('.form-group'); 386 }*/ 387 var formGroup = input.parents('.form-group'); 388 389 } 390 formGroup.addClass(classError); 391 formGroup.append('<span class="text-error">' + _.error[p] + '</span>'); 392 } 393 _.error = new Array(); 394 395 }, 396 397 setErrorsFromAjax: function (form) { 398 _ = this; 399 var classError = 'has-error'; 400 $('.' + classError).removeClass(classError); 401 $('.text-error').remove(); 402 403 for (var p in _.error) { 404 // var input = form.find('.js-' + p); 405 406 var input = form.find('[data-code="' + p + '"]'); 407 if (form.hasClass('js-form-horizontal')) { 408 var formGroup = input.parent(); 409 } 410 else { 411 /*if (input.parents('.input-group').length > 0) { 412 var formGroup = input.parents('.input-group'); 413 } else { 414 var formGroup = input.parents('.form-group'); 415 }*/ 416 var formGroup = input.parents('.form-group'); 417 418 } 419 formGroup.addClass(classError); 420 formGroup.append('<span class="text-error">' + _.error[p] + '</span>'); 421 } 422 _.error = new Array(); 423 424 }, 425 }; 426 427 $('body').on('submit', CForm.form, function (e) { 428 e.preventDefault; 429 CForm.sendForm($(this)); 430 return false;
431 }); 432 433 $(".js-captcha-reload").on('click', function (e) { 434 e.preventDefault(); 435 CForm.captcha_reload(); 436 }); 437 438 $(CForm.form).on('click', CForm.fileRemove, 439 function (e) { 440 e.preventDefault(); 441 $(CForm.fileName).attr('value', ''); 442 $(CForm.file).attr('value', '').val(''); 443 $(CForm.fileRemove).addClass('hide'); 444 } 445 ); 446 447 $(CForm.fileBtn).click(function (e) { 448 e.preventDefault(); 449 $(CForm.file).click(); 450 }); 451 452 $('body').on('click', '.form-control', function (e) { 453 var group = $(this).parents('.form-group'); 454 if (group.hasClass('has-error')) { 455 group.find('.text-error').remove(); 456 } 457 }); 458 459 $(CForm.file).change(function (e) { 460 e.preventDefault(); 461 CForm.changeFile($(this)); 462 }); 463 464 465 466 // console.log('err0000='); 467 468 469 470 471 fhandleSubmitWF=function handleSubmitWF() { 472 // CForm.sendForm(document.getElementById("wfyacapch")); 473 // CForm.sendForm($(this)); 474 CForm.sendForm(wfthis); 475 476 // console.log('---ok'); 477 } 478 479 480 481 482 }); 483 484}(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.