1$(document).ready(function () { 2 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ ÑÑÑановки и ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Cookie 3 function setCookieTd(name, value, days) { 4 let expires = ""; 5 if (days) { 6 let date = new Date(); 7 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 8 expires = "; expires=" + date.toUTCString(); 9 } 10 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 11 } 12 13 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð·Ð½Ð°ÑÐµÐ½Ð¸Ñ Cookie 14 function getCookieTd(name) { 15 const nameEQ = name + "="; 16 const ca = document.cookie.split(';'); 17 for (let i = 0; i < ca.length; i++) { 18 let c = ca[i]; 19 while (c.charAt(0) === ' ') c = c.substring(1, c.length); 20 if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); 21 } 22 return null; 23 } 24 25 function sendRtdGoalToApiOnSuccess(donation_sum) { 26 const partnerId = '1c383cd30b7c298ab50293adfecb7b18'; // ÑÑÐ¾Ñ Ð¿Ð°ÑамеÑÑ Ð¼Ñ Ð¿ÐµÑедадим позднее 27 const cookieRtdGoalID = 'rtd_goal_id'; 28 const cookieRtdCaseID = 'rtd_case_id'; 29 const savedRtdGoal = getCookieTd(cookieRtdGoalID); 30 const savedRtdCase = getCookieTd(cookieRtdCaseID); 31 const apiUrl = 'https://raztak.ru/api/webhooks/v1/funds/' + partnerId + '/' + savedRtdGoal; 32 33 if (savedRtdGoal && savedRtdCase) { 34 const donation_date = new Date(); 35 36 return fetch(apiUrl, { 37 method: 'POST', 38 headers: {'Content-Type': 'application/json'}, 39 body: JSON.stringify({ 40 donation_sum: donation_sum, 41 donation_case_id: savedRtdCase, 42 donation_time: Math.floor(donation_date.getTime() / 1000) 43 }) 44 }) 45 .then(response => { 46 if (!response.ok) { 47 return response.json().then(errorData => { 48 throw new Error(`HTTP error! Status: ${response.status}, Details: ${JSON.stringify(errorData)}`); 49 }); 50 } 51 return response.json(); 52 }) 53 .then(data => { 54 setCookieTd(cookieRtdGoalID, '', -1); 55 setCookieTd(cookieRtdCaseID, '', -1); 56 return {success: true, data: data}; 57 }) 58 .catch(error => { 59 console.error("API request failed:", error); 60 return {success: false, message: error.message || "Unknown error"}; 61 }); 62 } 63 } 64 65// ФÑнкÑÐ¸Ñ Ð¿ÐµÑеклÑÑÐµÐ½Ð¸Ñ Ð´Ð»Ñ ÐºÐ°ÑÑомного ÑелекÑа 66 const changeItemV2 = (item, name = '') => { 67 $(item).on('click', (e) => { 68 const $el = $(e.target); 69 if (!$el.hasClass('active') && $el.hasClass('dropdown-item')) { 70 const value = $el.attr('data-value') || null; 71 $(item).find('.dropdown-item').removeClass('active'); 72 $el.addClass('active'); 73 $(item).find('.dropdown-toggle').text($(item).find('.dropdown-item.active').text()); 74 $(item).find('[name='+name+']').val(value); 75 } 76 }); 77 } 78 79 // hash 80 if (window.location.hash) { 81 let $el_hash = $(window.location.hash); 82 $('html, body').animate({ 83 scrollTop: $el_hash.offset().top - (window.innerWidth >= 1350 ? 102 : 80) 84 }, 2000); 85 } 86 87 $(document).on('click', '.js-move-to', function() { 88 const to = $(this).attr('data-to'), 89 to_block = $('.js-move-to-' + to); 90 91 if (to_block.length) { 92 $('html, body').animate({ 93 scrollTop: to_block.offset().top - (window.innerWidth >= 1350 ? 102 : 80) 94 }, 2000); 95 } 96 }) 97 98 function openModalSubscribeSuccess() { 99 $('#subscribe-success-modal').modal('show'); 100 } 101 102 function openModalSubscribeFail(text = `<h3>У Ð½Ð°Ñ Ð½ÐµÐ±Ð¾Ð»ÑÑие пÑоблемÑ!</h3> 103 <p>ÐопÑобÑйÑе позже.</p>`) {
104 $('#subscribe-fail-modal').modal('show').find('.modal-body').html(text); 105 } 106 107 function openModalFeedbackSuccess() { 108 $('#feedback-success-modal').modal('show'); 109 } 110 111 function openModalFeedbackFail() { 112 $('#feedback-fail-modal').modal('show'); 113 } 114 115 function openModalVolunteersSuccess() { 116 $('#volunteers-success-modal').modal('show'); 117 } 118 119 function openModalVolunteersFail() { 120 $('#volunteers-fail-modal').modal('show'); 121 } 122 123 function openModalConsultationSuccess() { 124 $('#consultation-success-modal').modal('show'); 125 } 126 127 function openModalConsultationFail() { 128 $('#consultation-fail-modal').modal('show'); 129 } 130 131 function openModalSaveupsSuccess() { 132 $('#saveups-success-modal').modal('show'); 133 } 134 135 function openModalSaveupsFail() { 136 $('#saveups-fail-modal').modal('show'); 137 } 138 139 function openModalMksSuccess() { 140 $('#mks-success-modal').modal('show'); 141 } 142 143 function openModalMksFail() { 144 $('#mks-fail-modal').modal('show'); 145 } 146 147 function openModalSeminariSuccess() { 148 $('#seminari-success-modal').modal('show'); 149 } 150 151 function openModalSeminariFail() { 152 $('#seminari-fail-modal').modal('show'); 153 } 154 155 function openModalConfSuccess() { 156 $('#conf-success-modal').modal('show'); 157 } 158 159 function openModalConfFail() { 160 $('#conf-fail-modal').modal('show'); 161 } 162 163 function openModalStajirovkiSuccess() { 164 $('#stajirovki-success-modal').modal('show'); 165 } 166 167 function openModalStajirovkiFail() { 168 $('#stajirovki-fail-modal').modal('show'); 169 } 170 171 function customerSerialize($form) { 172 let detail = {}; 173 $.map($form.serializeArray(), function (n, i) { 174 if ($.trim(n['value']).length) { 175 detail[n['name']] = n['value']; 176 } 177 }); 178 return detail; 179 } 180 181 function customerSerializeV2($form) { 182 let detail = {}; 183 $.map($form.serializeArray(), function (n, i) { 184 if (-1 !== n['name'].indexOf('[]')) { 185 const name = n['name'].replace('[]', ''); 186 if (typeof detail[name] === "undefined") { 187 detail[name] = []; 188 } 189 detail[name].push(n['value']); 190 } else { 191 detail[n['name']] = n['value']; 192 } 193 }); 194 return detail; 195 } 196 197 (function ($f) { 198 if (!$f.length) return; 199 200 $(".help-ways__list .dropdown .dropdown-menu").on("click", (e) => { 201 e.stopPropagation(); 202 }) 203 204 $('.dropdown-toggle').click(function (e) { 205 e.preventDefault(); 206 e.stopPropagation(); 207 $('.dropdown-menu').not($(this).next('.dropdown-menu')).removeClass('show'); 208 $(this).next('.dropdown-menu').addClass('show'); 209 }); 210 211 $(document).click(function (e) { 212 if (!$(e.target).closest('.dropdown').length) { 213 $('.dropdown-menu').removeClass('show'); 214 e.stopPropagation(); 215 } 216 }); 217 })($('.help-ways')); 218 219 // Ð¡Ð»Ð°Ð¹Ð´ÐµÑ ÐºÐ½Ð¸Ð³ 220 (function ($page) { 221 let currentSlide = 0; 222 const totalSlides = $('.team-page__memes-and-facts__books-block .team-page__memes-and-facts__block__slide').length; 223 const leftBtn = $('.team-page__memes-and-facts__books-block .team-page__memes-and-facts__block__slide .btn.left'); 224 const rightBtn = $('.team-page__memes-and-facts__books-block .team-page__memes-and-facts__block__slide .btn.right'); 225 226 $('.team-page__memes-and-facts__books-block .team-page__memes-and-facts__block__slide .btn').click(function () { 227 // ÐпÑеделÑем напÑавление по ÑекÑÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¸ 228 const isLeft = $(this).hasClass('left'); 229 230 currentSlide += isLeft ? -1 : 1; 231 currentSlide = Math.max(0, Math.min(totalSlides - 1, currentSlide)); 232 233 if (currentSlide === 0) { 234 leftBtn.addClass('grayed'); 235 rightBtn.removeClass('grayed'); 236 } else if (currentSlide === totalSlides - 1) { 237 leftBtn.removeClass('grayed'); 238 rightBtn.addClass('grayed'); 239 } else { 240 leftBtn.removeClass('grayed'); 241 rightBtn.removeClass('grayed'); 242 } 243 244 $('.team-page__memes-and-facts__books-block .team-page__memes-and-facts__block__slider').css('transform', `translateX(-${currentSlide * 100}%)`); 245 }); 246 })($('.team-page')); 247 248 // Ð¡Ð»Ð°Ð¹Ð´ÐµÑ Ð¼ÐµÐ¼Ð¾Ð² 249 (function ($page) { 250 let currentSlide = 0; 251 const totalSlides = $('.team-page__memes-and-facts__memes-block .team-page__memes-and-facts__block__slide').length; 252 const leftBtn = $('.team-page__memes-and-facts__memes-block .team-page__memes-and-facts__block__slide .btn.left'); 253 const rightBtn = $('.team-page__memes-and-facts__memes-block .team-page__memes-and-facts__block__slide .btn.right'); 254 255 $('.team-page__memes-and-facts__memes-block .team-page__memes-and-facts__block__slide .btn').click(function () { 256 // ÐпÑеделÑем напÑавление по ÑекÑÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¸ 257 const isLeft = $(this).hasClass('left'); 258 259 currentSlide += isLeft ? -1 : 1; 260 currentSlide = Math.max(0, Math.min(totalSlides - 1, currentSlide)); 261 262 if (currentSlide === 0) { 263 leftBtn.addClass('grayed'); 264 rightBtn.removeClass('grayed'); 265 } else if (currentSlide === totalSlides - 1) { 266 leftBtn.removeClass('grayed'); 267 rightBtn.addClass('grayed'); 268 } else { 269 leftBtn.removeClass('grayed'); 270 rightBtn.removeClass('grayed'); 271 } 272 273 $('.team-page__memes-and-facts__memes-block .team-page__memes-and-facts__block__slider').css('transform', `translateX(-${currentSlide * 100}%)`); 274 }); 275 })($('.team-page')); 276 277 //маÑки 278 (function () { 279 280 $('.js-input-age').inputmask("integer", { 281 allowMinus: false, 282 allowPlus: false, 283 rightAlign: false, 284 min: 1, 285 max: 99, 286 }); 287 })(); 288 289 // ÑÐ°Ð±Ñ Ð¿Ð¾ гоÑÐ¾Ð´Ñ 290 (function () { 291 const tab = $('.tab-cities'); 292 const content = $('.tab-content'); 293 const maps = $('.js-city-map'); 294 const params = new URLSearchParams(document.location.search); 295 let _all = params.get("all"); 296 if (parseInt(_all || 0) === 1) { 297 298 } else if (typeof CITY_GENERAL_ID !== 'undefined') { 299 tab.find('.tab-item:not(.not-city-search-item)').removeClass('active').filter((v, i) => { 300 return $(i).attr('id') === CITY_GENERAL_ID+'-tab' 301 }).addClass('active'); 302 content.find('.tab-pane:not(.not-city-search-item)').removeClass('active').filter((v, i) => { 303 return $(i).attr('aria-labelledby') === CITY_GENERAL_ID+'-tab' 304 }).addClass('active'); 305 maps.addClass('d-none').filter((v, i) => { 306 return parseInt($(i).attr('data-city')) === CITY_GENERAL_ID 307 }).removeClass('d-none'); 308 } 309 310 tab.on('click', '.tab-item', function() { 311 const id = $(this).attr('id'); 312 313 const _replace = (city = null, all = false) => { 314 const url = new URL(window.location.href); 315 url.searchParams.set('city', city || 'spb'); 316 if (all) { 317 url.searchParams.set('all', 1); 318 } else { 319 url.searchParams.delete('all'); 320 } 321 window.history.pushState(null, '', url.toString()); 322 // window.history.replaceState(null, '', url.toString()); 323 } 324 325 const _map_show = (city_id) => { 326 maps.addClass('d-none').filter((v, i) => { 327 return parseInt($(i).attr('data-city')) === parseInt(city_id); 328 }).removeClass('d-none'); 329 } 330 331 if (id === CITY_GENERAL_MSK_ID+'-tab') { 332 _replace('msk'); 333 _map_show(CITY_GENERAL_MSK_ID); 334 } else if (id === CITY_GENERAL_SPB_ID+'-tab') { 335 _replace('spb'); 336 _map_show(CITY_GENERAL_SPB_ID); 337 } else { 338 _replace(null, true); 339 } 340 }); 341 342 const pane = $('.tab-pane'); 343 if (pane.length) { 344 $.each(pane, function(pi, pv) { 345 let city_id = parseInt($(pv).attr('id') || 0); 346 let city = city_id === CITY_GENERAL_SPB_ID ? 'sbp' : (city_id === CITY_GENERAL_MSK_ID ? 'msk' : ''); 347 const pagination = $(pv).find('.pagination'); 348 if (pagination.length && city) { 349 $.each(pagination.find('.pagination-item'), function (i,v) { 350 let href = $(v).attr('href'); 351 if (typeof href !== 'undefined') { 352 // let new_href = href; 353 // console.log({ 354 // href, city 355 // }) 356 if (href.includes('city=msk')) { 357 // console.log('city=msk') 358 href = href.replace('city=msk', 'city='+city); 359 } else if (href.includes('city=spb')) { 360 // console.log('city=spb') 361 href = href.replace('city=spb', 'city='+city); 362 } else { 363 href += '&city='+city; 364 } 365 // console.log({ 366 // _new: href 367 // }) 368 $(v).attr('href', href); 369 } 370 }); 371 } 372 }); 373 } 374 })(); 375 376 // гоÑод в пÑоекÑе 377 (function ($select) { 378 if (!$select.length) { 379 return false;
380 } 381 382 $select.on('change', function() { 383 const city_id = parseInt($(this).val()), 384 link = $(this).find('option[value='+city_id+']').attr('data-link'); 385 386 // console.log({ 387 // t: link + '?city=' + (city_id === CITY_GENERAL_MSK_ID ? 'msk' : 'spb'), 388 // city_id, CITY_GENERAL_MSK_ID 389 // }) 390 391 window.open(link + '?city=' + (city_id === CITY_GENERAL_MSK_ID ? 'msk' : 'spb'), '_self'); 392 }); 393 394 })($('.js-city-project')); 395 396 // обÑаÑÐ½Ð°Ñ ÑвÑÐ·Ñ 397 (function ($form) { 398 if (!$form.length) { 399 return false; 400 } 401 402 changeItemV2($form.find('#feedback-theme'), 'THEME') 403 404 $form.submit((e) => { 405 e.preventDefault(); 406 let detail = {}; 407 $.map($(e.target).serializeArray(), function (n, i) { 408 if ($.trim(n['value']).length) { 409 detail[n['name']] = n['value']; 410 } 411 let el = $form.find('[name=' + n['name'] + ']'); 412 $(el).removeClass('error').closest('.form-field').removeClass('danger-text'); 413 }); 414 let btnSubmit = $(e.target).find('button'); 415 416 const s = (data) => { 417 if ( 418 $(e.target)[0].reportValidity() 419 ) { 420 $.ajax({ 421 url: "/ajax/main2025/feedback.php", 422 method: "POST", 423 data: data, 424 dataType: "json", 425 beforeSend: function () { 426 $(btnSubmit).prop("disabled", true); 427 }, 428 success: function (data) { 429 $(btnSubmit).prop("disabled", false); 430 if (data["success"] === true) { 431 $form.get(0).reset(); 432 openModalFeedbackSuccess(); 433 } else { 434 if (Object.keys(data.message || {}).length) { 435 $.map(data.message, function (v, i) { 436 if (i === 'g-recaptcha-response') { 437 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 438 } else { 439 let el = $form.find('[name=' + i + ']'); 440 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 441 } 442 }); 443 } else { 444 openModalFeedbackFail(); 445 } 446 } 447 }, 448 }); 449 } else { 450 openModalFeedbackFail(); 451 } 452 } 453 454 if (typeof grecaptcha !== 'undefined') { 455 grecaptcha.ready(function () { 456 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 457 detail['g-recaptcha-response'] = token; 458 s(detail); 459 }); 460 }); 461 } else { 462 s(detail); 463 } 464 }); 465 466 467 })($('#feedback_form')); 468 469 // ÑоÑма копилки 470 (function ($form) { 471 if (!$form.length) { 472 return false; 473 } 474 475 $form.submit((e) => { 476 e.preventDefault(); 477 let EMAIL = $(e.target).find('[name=EMAIL]').val(); 478 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 479 offer_accept = offer_accept_block.is(':checked'); 480 481 if (offer_accept_block.length) { 482 offer_accept_block.parent().removeClass('shake-horizontal') 483 if (!offer_accept) { 484 setTimeout(() => { 485 offer_accept_block.parent().addClass('shake-horizontal'); 486 }, 0); 487 return; 488 } 489 } 490 let btnSubmit = $(e.target).find('button'); 491 492 const s = () => { 493 if ( 494 $(e.target)[0].reportValidity() 495 ) { 496 $.ajax({ 497 url: "/ajax/saveups_forn.php", 498 method: "POST", 499 data: {EMAIL}, 500 dataType: "json", 501 beforeSend: function () { 502 $(btnSubmit).prop("disabled", true); 503 }, 504 success: function (data) { 505 console.log({data}) 506 $(btnSubmit).prop("disabled", false); 507 if (data == true) { 508 $form.get(0).reset(); 509 openModalSaveupsSuccess(); 510 } else { 511 openModalSaveupsFail(); 512 } 513 }, 514 }); 515 } else { 516 openModalSaveupsFail(); 517 } 518 } 519 520 s(); 521 }); 522 523 524 })($('#saveups_form')); 525 526 // ÑоÑма подпиÑки 527 (function () { 528 const $formSubscribe = $('[name=subscribe-form]'); 529 530 if ($formSubscribe) { 531 var isValidEmailAddress = function (emailAddress) { 532 var pattern = new RegExp( 533 /^[0-9a-z-_+\.]+\@[0-9a-z-_]{1,}\.[a-z]{2,}$/i 534 ); 535 return pattern.test(emailAddress); 536 }; 537 538 $formSubscribe.on("submit", function (e) { 539 e.preventDefault(); 540 let email = $(e.target).find('[name=email]').val(); 541 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 542 offer_accept = offer_accept_block.is(':checked'); 543 let btnSubmit = $(e.target).find('button'); 544 545 if (offer_accept_block.length) { 546 offer_accept_block.parent().removeClass('shake-horizontal') 547 if (!offer_accept) { 548 setTimeout(() => { 549 offer_accept_block.parent().addClass('shake-horizontal'); 550 }, 0); 551 return; 552 } 553 } 554 555 if (!isValidEmailAddress(email)) { 556 openModalSubscribeFail(`<h3>ÐÑибка</h3><p>ÐведиÑе коÑÑекÑнÑй адÑÐµÑ ÑлекÑÑонной поÑÑÑ</p>`); 557 return; 558 } 559 560 if ( 561 $(e.target)[0].reportValidity() 562 ) { 563 $.ajax({ 564 url: "/ajax/subscribe.php", 565 method: "POST", 566 data: { 567 email: email, 568 offer_accept: offer_accept ? "on" : "off", 569 site_id: "ru", 570 }, 571 dataType: "json", 572 beforeSend: function () { 573 $(btnSubmit).prop("disabled", true); 574 }, 575 success: function (data) { 576 if (data["error"].length == 0) { 577 openModalSubscribeSuccess(); 578 $(btnSubmit).prop("disabled", false); 579 } else { 580 openModalSubscribeFail(); 581 } 582 }, 583 }); 584 } else { 585 openModalSubscribeFail(); 586 } 587 }) 588 } 589 })(); 590 591 // ÑоÑма волонÑеÑа 592 (function ($form) { 593 if (!$form.length) { 594 return false;
595 } 596 597 const vCity = document.querySelector(".js-volunteer-city"); 598 const vSex = document.querySelector(".js-volunteer-sex"); 599 600 changeItemV2(vCity, 'CITY') 601 changeItemV2(vSex, 'SEX') 602 603 const steps1 = $form.find('.form-step'); 604 605 steps1.on('click', '.btn-subscribe', (e) => { 606 e.preventDefault(); 607 const i = parseInt($(e.target).closest('.form-step').attr('data-step')) - 1; 608 609 if (steps1[i].dataset.step === "1") { 610 const req = steps1[i].querySelectorAll("input[required]"); 611 for (const r of req) { 612 if (r.value === "" || r.value === "0" || !r.checkValidity()) { 613 r.reportValidity(); 614 return; 615 } 616 } 617 } else if (steps1[i].dataset.step === "3" || steps1[i].dataset.step === "4") { 618 const req = steps1[i].querySelectorAll("textarea[required]"); 619 for (const r of req) { 620 if (r.value === "" || r.value === "0" || !r.checkValidity()) { 621 r.reportValidity(); 622 return; 623 } 624 } 625 } 626 627 steps1[i].style.display = "none"; 628 steps1[i + 1].style.display = "flex"; 629 }); 630 631 steps1.on('click', '.btn-simple:not(:disabled)', (e) => { 632 e.preventDefault(); 633 const i = parseInt($(e.target).closest('.form-step').attr('data-step')) - 1; 634 steps1[i].style.display = "none"; 635 steps1[i - 1].style.display = "flex"; 636 }); 637 638 $form.on('click', '[name="HOW_YOU_HELP[]"]', function () { 639 let $el = $(this), value = $el.val(), checked = $el.is(':checked'); 640 641 if (value === 'ÐÑÑгое') { 642 let other = $form.find('[name=HOW_YOU_HELP_OTHER]'); 643 if (checked) { 644 other.attr('required', true); 645 other.closest('.form-field').removeClass('d-none'); 646 } else { 647 other.attr('required', false); 648 other.closest('.form-field').addClass('d-none'); 649 } 650 } 651 }); 652 653 $form.on('click', '[name="HOW_FIND_ABOUT[]"]', function () { 654 let $el = $(this), value = $el.val(), checked = $el.is(':checked'); 655 656 if (value === 'ÐÑÑгое') { 657 let other = $form.find('[name=HOW_FIND_ABOUT_OTHER]'); 658 if (checked) { 659 other.attr('required', true); 660 other.closest('.form-field').removeClass('d-none'); 661 } else { 662 other.attr('required', false); 663 other.closest('.form-field').addClass('d-none'); 664 } 665 } 666 }); 667 668 $form.submit((e) => { 669 e.preventDefault(); 670 let detail = customerSerializeV2($(e.target)); 671 let btnSubmit = $(e.target).find('button[type=submit]'); 672 673 const s = (data) => { 674 if ( 675 $(e.target)[0].reportValidity() 676 ) { 677 $.ajax({ 678 url: "/ajax/main2025/volunteers.php", 679 method: "POST", 680 data: data, 681 dataType: "json", 682 beforeSend: function () { 683 $(btnSubmit).prop("disabled", true); 684 }, 685 success: function (data) { 686 $(btnSubmit).prop("disabled", false); 687 if (data["success"] === true) { 688 $form.get(0).reset(); 689 openModalVolunteersSuccess(); 690 } else { 691 if (Object.keys(data.message || {}).length) { 692 let steps = []; 693 $.map(data.message, function (v, i) { 694 if (i === 'g-recaptcha-response') { 695 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 696 } else { 697 let el = $form.find('[name=' + i + ']'); 698 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 699 steps.push(parseInt($(el).closest('.form-step').attr('data-step')) || 1); 700 } 701 }); 702 let min_steps = Math.min(...steps) || 1; 703 $form.find('.form-step').hide(); 704 $form.find('.form-step-'+min_steps).show(); 705 706 } else { 707 openModalVolunteersFail(); 708 } 709 } 710 }, 711 }); 712 } else { 713 openModalVolunteersFail(); 714 } 715 } 716 717 if (typeof grecaptcha !== 'undefined') { 718 grecaptcha.ready(function () { 719 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 720 detail['g-recaptcha-response'] = token; 721 s(detail); 722 }); 723 }); 724 } else { 725 s(detail); 726 } 727 }); 728 729 })($('[name=volunteers-form]')); 730 731 //ÑоÑма заÑвки на конÑÑлÑÑаÑÐ¸Ñ 732 (function ($form) { 733 if (!$form.length) { 734 return false;
735 } 736 737 $form.submit((e) => { 738 e.preventDefault(); 739 let detail = customerSerialize($(e.target)); 740 let btnSubmit = $(e.target).find('button[type=submit]'); 741 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 742 offer_accept = offer_accept_block.is(':checked'); 743 744 if (offer_accept_block.length) { 745 offer_accept_block.parent().removeClass('shake-horizontal') 746 if (!offer_accept) { 747 setTimeout(() => { 748 offer_accept_block.parent().addClass('shake-horizontal'); 749 }, 0); 750 return; 751 } 752 } 753 754 const s = (data) => { 755 if ( 756 $(e.target)[0].reportValidity() 757 ) { 758 $.ajax({ 759 url: "/ajax/main2025/jobconsultation.php", 760 method: "POST", 761 data: data, 762 dataType: "json", 763 beforeSend: function () { 764 $(btnSubmit).prop("disabled", true); 765 }, 766 success: function (data) { 767 $(btnSubmit).prop("disabled", false); 768 if (data["success"] === true) { 769 $form.get(0).reset(); 770 openModalConsultationSuccess(); 771 } else { 772 if (Object.keys(data.message || {}).length) { 773 $.map(data.message, function (v, i) { 774 if (i === 'g-recaptcha-response') { 775 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 776 } else { 777 let el = $form.find('[name=' + i + ']'); 778 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 779 } 780 }); 781 } else { 782 openModalConsultationFail(); 783 } 784 } 785 }, 786 }); 787 } else { 788 openModalConsultationFail(); 789 } 790 } 791 792 if (typeof grecaptcha !== 'undefined') { 793 grecaptcha.ready(function () { 794 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 795 detail['g-recaptcha-response'] = token; 796 s(detail); 797 }); 798 }); 799 } else { 800 s(detail); 801 } 802 }); 803 804 })($('[name=jobconsultation-form]')); 805 806 // ÑоÑма конÑÑлÑÑаÑии ÐÐС 807 (function ($form) { 808 if (!$form.length) { 809 return false; 810 } 811 812 $form.find('[name=ORG_REGISTER]').on("click", function(){ 813 if(($(this).attr('id') == "mks-org-official-yes") && ($(this).is(':checked'))){ 814 $('#mks-form-official-year').show(); 815 }else{ 816 $('#mks-form-official-year').hide(); 817 } 818 }); 819 820 $form.find('[name=org-mks-categories-who]').on("click", function(){ 821 if(($(this).attr('id') == 'mks-wh-10') && ($(this).is(':checked'))){ 822 $('#mks-another-wh').show(); 823 }else{ 824 $('#mks-another-wh').hide(); 825 } 826 }); 827 828 $form.find('[name=org-mks-categories-what]').on("click", function(){ 829 if(($(this).attr('id') == 'mks-category-what-11') && ($(this).is(':checked'))){ 830 $('#mks-another-what').show(); 831 }else{ 832 $('#mks-another-what').hide(); 833 } 834 }); 835 836 $form.find('[name=org-mks-categories-fin]').on("click", function(){ 837 if(($(this).attr('id') == 'mks-categories-fin-6') && ($(this).is(':checked'))){ 838 $('#mks-another-fin').show(); 839 }else{ 840 $('#mks-another-fin').hide(); 841 } 842 }); 843 844 let orgMksCatWho = [], 845 orgMksCatWhat = [], 846 orgMksCatFin = []; 847 848 $form.find('[name=org-mks-categories-who]').on("click", function(){ 849 orgMksCatWho = []; 850 $.each($form.find('[name=org-mks-categories-who]'), function(id, value){ 851 const $el = $(value);
852 if ($el.is(':checked')) { 853 orgMksCatWho.push($el.val()); 854 } 855 }) 856 }); 857 858 $form.find('[name=org-mks-categories-what]').on("click", function(){ 859 orgMksCatWhat = []; 860 $.each($form.find('[name=org-mks-categories-what]'), function(id, value){ 861 const $el = $(value); 862 if ($el.is(':checked')) { 863 orgMksCatWhat.push($el.val()); 864 } 865 }) 866 }); 867 868 $form.find('[name=org-mks-categories-fin]').on("click", function(){ 869 orgMksCatFin = []; 870 $.each($form.find('[name=org-mks-categories-fin]'), function(id, value){ 871 const $el = $(value); 872 if ($el.is(':checked')) { 873 orgMksCatFin.push($el.val()); 874 } 875 }) 876 }); 877 878 $form.submit((e) => { 879 e.preventDefault(); 880 881 let detail = customerSerialize($(e.target)); 882 let btnSubmit = $(e.target).find('button[type=submit]'); 883 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 884 offer_accept = offer_accept_block.is(':checked'); 885 886 if (offer_accept_block.length) { 887 offer_accept_block.parent().removeClass('shake-horizontal') 888 if (!offer_accept) { 889 setTimeout(() => { 890 offer_accept_block.parent().addClass('shake-horizontal'); 891 }, 0); 892 return; 893 } 894 } 895 896 detail.orgMksCatWho = orgMksCatWho; 897 detail.orgMksCatWhat = orgMksCatWhat; 898 detail.orgMksCatFin = orgMksCatFin; 899 900 const s = (data) => { 901 if ( 902 $(e.target)[0].reportValidity() 903 ) { 904 $.ajax({ 905 url: "/ajax/main2025/mks.php", 906 method: "POST", 907 data: data, 908 dataType: "json", 909 beforeSend: function () { 910 $(btnSubmit).prop("disabled", true); 911 }, 912 success: function (data) { 913 $(btnSubmit).prop("disabled", false); 914 if (data["success"] === true) { 915 $form.get(0).reset(); 916 openModalMksSuccess(); 917 } else { 918 if (Object.keys(data.message || {}).length) { 919 $.map(data.message, function (v, i) { 920 if (i === 'g-recaptcha-response') { 921 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 922 } else { 923 let el = $form.find('[name=' + i + ']'); 924 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 925 } 926 }); 927 } else { 928 openModalMksFail(); 929 } 930 } 931 }, 932 }); 933 } else { 934 openModalMksFail(); 935 } 936 } 937 938 if (typeof grecaptcha !== 'undefined') { 939 grecaptcha.ready(function () { 940 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 941 detail['g-recaptcha-response'] = token; 942 s(detail); 943 }); 944 }); 945 } else { 946 s(detail); 947 } 948 }); 949 950 })($('[name=mks-form]')); 951 952 // ÑоÑма заÑвление на лекÑÐ¸Ñ 953 (function ($form) { 954 if (!$form.length) { 955 return false;
956 } 957 958 $('#org-register-year').addClass('d-none'); 959 $('#part-homeles-list').addClass('d-none'); 960 $('#seminar-another-who').addClass('d-none'); 961 $('#seminar-another-what').addClass('d-none'); 962 $('#seminar-another-finance').addClass('d-none'); 963 964 $form.find('[name=ORG_REGISTER]').on("click", function(){ 965 if(($(this).val() == "1") && ($(this).is(':checked'))){ 966 $('#org-register-year').removeClass('d-none'); 967 }else{ 968 $('#org-register-year').addClass('d-none'); 969 } 970 }); 971 972 973 $form.find('[name=PART_HOMELESS]').on("click", function(){ 974 if(($(this).val() == "1") && ($(this).is(':checked'))){ 975 $('#part-homeles-list').removeClass('d-none'); 976 }else{ 977 $('#part-homeles-list').addClass('d-none'); 978 } 979 }); 980 981 $form.find('[name=seminar-who-help-categories]').on("click", function(){ 982 if(($(this).attr('id') == 'seminar-who-help-10') && ($(this).is(':checked'))){ 983 $('#seminar-another-who').removeClass('d-none'); 984 }else{ 985 $('#seminar-another-who').addClass('d-none'); 986 } 987 }); 988 989 $form.find('[name=seminar-what-help-categories]').on("click", function(){ 990 if(($(this).attr('id') == 'seminar-what-help-11') && ($(this).is(':checked'))){ 991 $('#seminar-another-what').removeClass('d-none'); 992 }else{ 993 $('#seminar-another-what').addClass('d-none'); 994 } 995 }); 996 997 $form.find('[name=seminar-finance-categories]').on("click", function(){ 998 if(($(this).attr('id') == 'seminar-finance-6') && ($(this).is(':checked'))){ 999 $('#seminar-another-finance').removeClass('d-none'); 1000 }else{ 1001 $('#seminar-another-finance').addClass('d-none'); 1002 } 1003 }); 1004 1005 let SemWho = [], 1006 SemWhat = [], 1007 SemFin = []; 1008 1009 $form.find('[name=seminar-who-help-categories]').on("click", function(){ 1010 SemWho = []; 1011 $.each($form.find('[name=seminar-who-help-categories]'), function(id, value){ 1012 const $el = $(value); 1013 if ($el.is(':checked')) { 1014 SemWho.push($el.val()); 1015 } 1016 }) 1017 }); 1018 1019 $form.find('[name=seminar-what-help-categories]').on("click", function(){ 1020 SemWhat = []; 1021 $.each($form.find('[name=seminar-what-help-categories]'), function(id, value){ 1022 const $el = $(value); 1023 if ($el.is(':checked')) { 1024 SemWhat.push($el.val()); 1025 } 1026 }) 1027 }); 1028 1029 $form.find('[name=seminar-finance-categories]').on("click", function(){ 1030 SemFin = []; 1031 $.each($form.find('[name=seminar-finance-categories]'), function(id, value){ 1032 const $el = $(value); 1033 if ($el.is(':checked')) { 1034 SemFin.push($el.val()); 1035 } 1036 }) 1037 }); 1038 1039 $form.submit((e) => { 1040 e.preventDefault(); 1041 1042 let detail = customerSerialize($(e.target)); 1043 let btnSubmit = $(e.target).find('button[type=submit]'); 1044 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 1045 offer_accept = offer_accept_block.is(':checked'); 1046 1047 if (offer_accept_block.length) { 1048 offer_accept_block.parent().removeClass('shake-horizontal') 1049 if (!offer_accept) { 1050 setTimeout(() => { 1051 offer_accept_block.parent().addClass('shake-horizontal'); 1052 }, 0); 1053 return; 1054 } 1055 } 1056 1057 if (!SemFin.length) { 1058 $('html, body').animate({ 1059 scrollTop: $form.find('[name=seminar-finance-categories]').first().offset().top - 150 1060 }, 300); 1061 $form.find('[name=seminar-finance-categories]').first().closest('.form-field').addClass('danger-text'); 1062 } else { 1063 $form.find('[name=seminar-finance-categories]').first().closest('.form-field').removeClass('danger-text'); 1064 } 1065 1066 if (!SemWhat.length) { 1067 $('html, body').animate({ 1068 scrollTop: $form.find('[name=seminar-what-help-categories]').first().offset().top - 150 1069 }, 300); 1070 $form.find('[name=seminar-what-help-categories]').first().closest('.form-field').addClass('danger-text'); 1071 } else { 1072 $form.find('[name=seminar-what-help-categories]').first().closest('.form-field').removeClass('danger-text'); 1073 } 1074 1075 if (!SemWho.length) { 1076 $('html, body').animate({
1077 scrollTop: $form.find('[name=seminar-who-help-categories]').first().offset().top - 150 1078 }, 300); 1079 $form.find('[name=seminar-who-help-categories]').first().closest('.form-field').addClass('danger-text'); 1080 } else { 1081 $form.find('[name=seminar-who-help-categories]').first().closest('.form-field').removeClass('danger-text'); 1082 } 1083 1084 detail.SemWho = SemWho; 1085 detail.SemWhat = SemWhat; 1086 detail.SemFin = SemFin; 1087 1088 const s = (data) => { 1089 if ( 1090 $(e.target)[0].reportValidity() 1091 ) { 1092 $.ajax({ 1093 url: "/ajax/main2025/jobseminari.php", 1094 method: "POST", 1095 data: data, 1096 dataType: "json", 1097 beforeSend: function () { 1098 $(btnSubmit).prop("disabled", true); 1099 }, 1100 success: function (data) { 1101 $(btnSubmit).prop("disabled", false); 1102 if (data["success"] === true) { 1103 $form.get(0).reset(); 1104 openModalSeminariSuccess(); 1105 } else { 1106 if (Object.keys(data.message || {}).length) { 1107 $.map(data.message, function (v, i) { 1108 if (i === 'g-recaptcha-response') { 1109 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 1110 } else { 1111 let el = $form.find('[name=' + i + ']'); 1112 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 1113 $('html, body').animate({ 1114 scrollTop: $(el).addClass('error').closest('.form-field').offset().top - 150 1115 }, 300); 1116 } 1117 }); 1118 } else { 1119 openModalSeminariFail(); 1120 } 1121 } 1122 }, 1123 }); 1124 } else { 1125 openModalSeminariFail(); 1126 } 1127 } 1128 1129 if (typeof grecaptcha !== 'undefined') { 1130 grecaptcha.ready(function () { 1131 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 1132 detail['g-recaptcha-response'] = token; 1133 s(detail); 1134 }); 1135 }); 1136 } else { 1137 s(detail); 1138 } 1139 }); 1140 1141 })($('[name=jobseminari-form]')); 1142 1143 // ÑоÑма заÑвки на ÑÑаÑÑие в конÑеÑенÑии 1144 (function ($form) { 1145 if (!$form.length) { 1146 return false; 1147 } 1148 1149 $form.find('[name=PART_HOMELESS]').on("click", function(){ 1150 if(($(this).val() == "1") && ($(this).is(':checked'))){ 1151 $('#PART_HOMELESS_LIST').show(); 1152 }else{ 1153 $('#PART_HOMELESS_LIST').hide(); 1154 } 1155 }); 1156 1157 $form.find('[name=WHAT_ROLE_DO_YOU_SEE_YOURSELF_IN_THE_CONF]').on("click", function(){ 1158 if((($(this).val() == '1') || ($(this).val() == '3')) && ($(this).is(':checked'))){ 1159 if (($(this).val() == '3')) { 1160 $('#WHAT_ROLE_DO_YOU_SEE_YOURSELF_IN_THE_CONF_TEXT label').text('Ркакой Ñоли Ð²Ñ Ð²Ð¸Ð´Ð¸Ñе Ñвое ÑÑаÑÑие в конÑеÑенÑии?'); 1161 } else { 1162 $('#WHAT_ROLE_DO_YOU_SEE_YOURSELF_IN_THE_CONF_TEXT label').text('Ð Ñем Ð²Ñ Ð±Ñ Ñ Ð¾Ñели ÑаÑÑказаÑÑ Ð½Ð° конÑеÑенÑии?'); 1163 } 1164 $('#WHAT_ROLE_DO_YOU_SEE_YOURSELF_IN_THE_CONF_TEXT').show(); 1165 }else{ 1166 $('#WHAT_ROLE_DO_YOU_SEE_YOURSELF_IN_THE_CONF_TEXT').hide(); 1167 } 1168 }); 1169
1170 $form.submit((e) => { 1171 e.preventDefault(); 1172 1173 let detail = customerSerialize($(e.target)); 1174 let btnSubmit = $(e.target).find('button[type=submit]'); 1175 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 1176 offer_accept = offer_accept_block.is(':checked'); 1177 1178 if (offer_accept_block.length) { 1179 offer_accept_block.parent().removeClass('shake-horizontal') 1180 if (!offer_accept) { 1181 setTimeout(() => { 1182 offer_accept_block.parent().addClass('shake-horizontal'); 1183 }, 0); 1184 return; 1185 } 1186 } 1187 1188 const s = (data) => { 1189 if ( 1190 $(e.target)[0].reportValidity() 1191 ) { 1192 $.ajax({ 1193 url: "/ajax/main2025/jobconf.php", 1194 method: "POST", 1195 data: data, 1196 dataType: "json", 1197 beforeSend: function () { 1198 $(btnSubmit).prop("disabled", true); 1199 }, 1200 success: function (data) { 1201 $(btnSubmit).prop("disabled", false); 1202 if (data["success"] === true) { 1203 $form.get(0).reset(); 1204 openModalConfSuccess(); 1205 } else { 1206 if (Object.keys(data.message || {}).length) { 1207 $.map(data.message, function (v, i) { 1208 if (i === 'g-recaptcha-response') { 1209 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 1210 } else { 1211 let el = $form.find('[name=' + i + ']'); 1212 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 1213 } 1214 }); 1215 } else { 1216 openModalConfFail(); 1217 } 1218 } 1219 }, 1220 }); 1221 } else { 1222 openModalConfFail(); 1223 } 1224 } 1225 1226 if (typeof grecaptcha !== 'undefined') { 1227 grecaptcha.ready(function () { 1228 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 1229 detail['g-recaptcha-response'] = token; 1230 s(detail); 1231 }); 1232 }); 1233 } else { 1234 s(detail); 1235 } 1236 }); 1237 1238 })($('[name=jobconf-form]')); 1239 1240 // ÑоÑма заÑвки на ÑÑажиÑÐ¾Ð²ÐºÑ 1241 (function ($form) { 1242 if (!$form.length) { 1243 return false; 1244 } 1245 $('#org-register-year').addClass('d-none'); 1246 $('#stajirovki-another-who').addClass('d-none'); 1247 $('#stajirovki-another-what').addClass('d-none'); 1248 $('#stajirovki-another-finance').addClass('d-none'); 1249 $('#part-homeles-list').addClass('d-none'); 1250 1251 $form.find('[name=ORG_REGISTER]').on("click", function(){ 1252 if(($(this).val() == "1") && ($(this).is(':checked'))){ 1253 $('#org-register-year').removeClass('d-none'); 1254 }else{ 1255 $('#org-register-year').addClass('d-none'); 1256 } 1257 }); 1258 1259 $form.find('[name=stajirovki-who-help-categories]').on("click", function(){ 1260 if(($(this).attr('id') == 'stajirovki-who-help-10') && ($(this).is(':checked'))){ 1261 $('#stajirovki-another-who').removeClass('d-none'); 1262 }else{ 1263 $('#stajirovki-another-who').addClass('d-none'); 1264 } 1265 }); 1266 1267 $form.find('[name=stajirovki-what-help-categories]').on("click", function(){ 1268 if(($(this).attr('id') == 'stajirovki-what-help-11') && ($(this).is(':checked'))){ 1269 $('#stajirovki-another-what').removeClass('d-none'); 1270 }else{ 1271 $('#stajirovki-another-what').addClass('d-none'); 1272 } 1273 }); 1274 1275 $form.find('[name=stajirovki-finance-categories]').on("click", function(){ 1276 if(($(this).attr('id') == 'stajirovki-finance-6') && ($(this).is(':checked'))){ 1277 $('#stajirovki-another-finance').removeClass('d-none'); 1278 }else{ 1279 $('#stajirovki-another-finance').addClass('d-none'); 1280 } 1281 }); 1282 1283 $form.find('[name=COLLEAGUE]').on("click", function(){ 1284 if(($(this).val() == "1") && ($(this).is(':checked'))){ 1285 $('#stajirovki-colleague-name').addClass('d-none'); 1286 }else{ 1287 $('#stajirovki-colleague-name').removeClass('d-none'); 1288 } 1289 }); 1290 1291 $form.find('[name=PART_HOMELESS]').on("click", function(){ 1292 if(($(this).val() == "1") && ($(this).is(':checked'))){ 1293 $('#part-homeles-list').removeClass('d-none'); 1294 }else{ 1295 $('#part-homeles-list').addClass('d-none'); 1296 } 1297 }); 1298 1299 let StajWho = [], 1300 StajWhat = [], 1301 StajFin = []; 1302 1303 $form.find('[name=stajirovki-who-help-categories]').on("click", function(){ 1304 StajWho = []; 1305 $.each($form.find('[name=stajirovki-who-help-categories]'), function(id, value){ 1306 const $el = $(value);
1307 if ($el.is(':checked')) { 1308 StajWho.push($el.val()); 1309 } 1310 }) 1311 }); 1312 1313 $form.find('[name=stajirovki-what-help-categories]').on("click", function(){ 1314 StajWhat = []; 1315 $.each($form.find('[name=stajirovki-what-help-categories]'), function(id, value){ 1316 const $el = $(value); 1317 if ($el.is(':checked')) { 1318 StajWhat.push($el.val()); 1319 } 1320 }) 1321 }); 1322 1323 $form.find('[name=stajirovki-finance-categories]').on("click", function(){ 1324 StajFin = []; 1325 $.each($form.find('[name=stajirovki-finance-categories]'), function(id, value){ 1326 const $el = $(value); 1327 if ($el.is(':checked')) { 1328 StajFin.push($el.val()); 1329 } 1330 }) 1331 }); 1332 1333 $form.submit((e) => { 1334 e.preventDefault(); 1335 1336 let detail = customerSerialize($(e.target)); 1337 let btnSubmit = $(e.target).find('button[type=submit]'); 1338 let offer_accept_block = $(e.target).find('[name=offer_accept]'), 1339 offer_accept = offer_accept_block.is(':checked'); 1340 1341 if (offer_accept_block.length) { 1342 offer_accept_block.parent().removeClass('shake-horizontal') 1343 if (!offer_accept) { 1344 setTimeout(() => { 1345 offer_accept_block.parent().addClass('shake-horizontal'); 1346 }, 0); 1347 return; 1348 } 1349 } 1350 1351 detail.StajWho = StajWho; 1352 detail.StajWhat = StajWhat; 1353 detail.StajFin = StajFin; 1354 1355 const s = (data) => { 1356 if ( 1357 $(e.target)[0].reportValidity() 1358 ) { 1359 $.ajax({ 1360 url: "/ajax/main2025/jobstajirovki.php", 1361 method: "POST", 1362 data: data, 1363 dataType: "json", 1364 beforeSend: function () { 1365 $(btnSubmit).prop("disabled", true); 1366 }, 1367 success: function (data) { 1368 $(btnSubmit).prop("disabled", false); 1369 if (data["success"] === true) { 1370 $form.get(0).reset(); 1371 openModalStajirovkiSuccess(); 1372 } else { 1373 if (Object.keys(data.message || {}).length) { 1374 $.map(data.message, function (v, i) { 1375 if (i === 'g-recaptcha-response') { 1376 $('.g-recaptcha-response').addClass('error').text(data.message[i]); 1377 } else { 1378 let el = $form.find('[name=' + i + ']'); 1379 $(el).addClass('error').closest('.form-field').addClass('danger-text'); 1380 } 1381 }); 1382 } else { 1383 openModalStajirovkiFail(); 1384 } 1385 } 1386 }, 1387 }); 1388 } else { 1389 openModalStajirovkiFail(); 1390 } 1391 } 1392 1393 if (typeof grecaptcha !== 'undefined') { 1394 grecaptcha.ready(function () { 1395 grecaptcha.execute('6LeqXfspAAAAAEDJnRdX1wrIF7YTMmQP_RcKIi0J', {action: 'submit'}).then(function (token) { 1396 detail['g-recaptcha-response'] = token; 1397 s(detail); 1398 }); 1399 }); 1400 } else { 1401 s(detail); 1402 } 1403 }); 1404 1405 })($('[name=jobstajirovki-form]')); 1406 1407 // ÑоÑма донаÑа 1408 (function ($form) { 1409 if (!$form.length) { 1410 return false;
1411 } 1412 1413 var ACTIVE = "is-active"; 1414 var ERROR = "is-error"; 1415 var VALID = "is-valid"; 1416 var $chooseSumBtn = $form.find(".js-choose-sum"); 1417 1418 var $formPeriod = $(".js-form-period"); 1419 var $sumInput = $form.find(".js-custom-sum"); 1420 var $sumRadio = $form.find(".js-your-sum"); 1421 var $paymentTypes = $(".c-radio"); 1422 var $paymentCard = $(".js-payment-card"); 1423 var $paymentQiwi = $(".js-payment-qiwi"); 1424 var $paymentPS = $(".js-payment-ps"); 1425 var $paymentYandex = $(".js-payment-yandex_money"); 1426 var $anonymField = $(".js-anon"); 1427 var $nameField = $('input[name="help-transfer-name"]'); 1428 var $phoneField = $('input[name="help-transfer-phone"]'); 1429 var $ddEmailValidator = $('input[name="dd-check-email"]'); 1430 var $public_id = $('input[name="public_id"]'); 1431 1432 const clearFormErrors = function () { 1433 let notValid = $form.find("label." + ERROR); 1434 $.each(notValid, function (k, v) { 1435 let parent = $(v).parent(); 1436 parent.removeClass(ERROR); 1437 parent.find("label." + ERROR).remove(); 1438 parent.find("input").removeClass("error"); 1439 }); 1440 }; 1441 1442 $formPeriod.on("click", function () { 1443 clearFormErrors(); 1444 $formPeriod.removeClass("active"); 1445 $(this).addClass("active"); 1446 // $fieldSum.val($(this).attr("data-period")); 1447 if (parseInt($(this).attr("data-period-num")) == 0) { 1448 $paymentYandex.attr("style", "display: none !important"); 1449 $paymentQiwi.attr("style", "display: none !important"); 1450 $paymentPS.attr("style", "display: none !important"); 1451 } else { 1452 $paymentYandex.attr("style", ""); 1453 $paymentQiwi.attr("style", ""); 1454 $paymentPS.attr("style", ""); 1455 } 1456 1457 // ÐÑи вÑбоÑе ежемеÑÑÑного или Ñазового плаÑежа 1458 var period = $(this).attr("data-period"); 1459 localStorage.setItem("_form_period", period); 1460 var activeCheckbox = $sumRadio.filter(":checked"); 1461 1462 $(".form-btn-desc").removeClass("active"); 1463 $('.form-btn-desc[data-desc="' + period + '"]').addClass( 1464 "active" 1465 ); 1466 1467 if (!activeCheckbox.length && !$sumInput.val().length) { 1468 $sumRadio.addClass(ERROR); 1469 $sumInput.addClass(ERROR); 1470 1471 setTimeout(function () { 1472 $sumRadio.removeClass(ERROR); 1473 $sumInput.removeClass(ERROR); 1474 }, 2000); 1475 } else { 1476 // ÐÑбиÑаем оплаÑÑ ÐºÐ°ÑÑоÑкой (по ÑмолÑаниÑ) 1477 $paymentCard.click(); 1478 } 1479 }); 1480 1481 // подÑÑгиваем поÑледний вÑÐ±Ð¾Ñ Ñипа пожеÑÑÐ²Ð¾Ð²Ð°Ð½Ð¸Ñ 1482 let local_form_period = localStorage.getItem("_form_period"); 1483 if (local_form_period !== null) { 1484 $formPeriod.filter(function (i, v) { 1485 return $(v).attr('data-period') === local_form_period; 1486 }).click(); 1487 } 1488 1489 // $sumInput.on("change paste input focus", function () { 1490 // var $this = $(this); 1491 // if ($this.val().length > 0) { 1492 // // $sumRadio.prop("checked", false); 1493 // $this.addClass(ACTIVE); 1494 // } else { 1495 // $this.removeClass(ACTIVE); 1496 // } 1497 // }); 1498 // 1499 // $sumInput.on("change paste input focus", function () { 1500 // var $this = $(this); 1501 // var lbl = $this.parent().find(".lb-placeholder"); 1502 // if ($this.is(":focus")) { 1503 // lbl.hide(); 1504 // } 1505 // if ($this.val().length > 0) { 1506 // lbl.hide(); 1507 // } 1508 // }); 1509 // 1510 // $sumInput.on("blur focusout focus", function (e) { 1511 // if (e.type != "focus") { 1512 // var $this = $(this); 1513 // var lbl = $this.parent().find(".lb-placeholder"); 1514 // if ($this.val().length > 0) { 1515 // lbl.hide(); 1516 // } else { 1517 // lbl.show(); 1518 // } 1519 // } 1520 // 1521 // $(".form-sum-desc").removeClass("active"); 1522 // $('.form-sum-desc[data-desc="0"]').addClass("active"); 1523 // }); 1524 1525 const _f_desc = (_value) => { 1526 $(".form-sum-desc").removeClass("active"); 1527 $('.form-sum-desc[data-desc="' + _value + '"]').addClass("active"); 1528 } 1529 1530 const customSumLabel = $form.find(".m-help-form__sum--custom label"); 1531 const formDonateAnother = $form.find(".form-donate-another"); 1532 // 1533 // customSumLabel?.addEventListener("click", () => { 1534 // customSumLabel.style.display = "none"; 1535 // formDonateAnother.style.display = "block"; 1536 // formDonateAnother.value = ""; 1537 // formDonateAnother.disabled = false;
1538 // for (const i of document.querySelectorAll("input[type='radio'].form-donate-sum-input")) { 1539 // i.checked = false; 1540 // } 1541 // }); 1542 // 1543 // formDonateAnother?.addEventListener("click", () => { 1544 // for (const i of document.querySelectorAll("input[type='radio'].form-donate-sum-input")) { 1545 // i.checked = false; 1546 // } 1547 // }) 1548 // 1549 // formDonateAnother?.addEventListener("blur", () => { 1550 // if (formDonateAnother.value === "" || formDonateAnother.value === "0") { 1551 // customSumLabel.style.display = "block"; 1552 // formDonateAnother.style.display = "none"; 1553 // formDonateAnother.disabled = true; 1554 // } 1555 // }) 1556 1557 $sumRadio.on("click", function () { 1558 $sumInput.hide(); 1559 customSumLabel.show(); 1560 1561 $sumRadio.prop("checked", false); 1562 $sumInput 1563 .attr('disabled', true) 1564 // .prop("required", false) 1565 // .attr("aria-required", false); 1566 1567 $(this).prop("checked", true); 1568 1569 $sumInput.val($sumInput.val() || '').trigger("focusout"); 1570 _f_desc(this.value); 1571 }); 1572 1573 customSumLabel.on('click', function () { 1574 $sumInput.attr('disabled', false); 1575 }) 1576 1577 $sumInput.on("click", function () { 1578 $sumInput.show(); 1579 customSumLabel.hide(); 1580 1581 $sumRadio.prop("checked", false); 1582 // $sumInput 1583 // .prop("required", true) 1584 // .attr("aria-required", true); 1585 1586 $(this).prop("checked", true); 1587 1588 $sumInput.val($sumInput.val() || '').trigger("focusout"); 1589 _f_desc(0); 1590 }); 1591 1592 const min_sum_input = 50; 1593 1594 $sumInput.val(min_sum_input); 1595 1596 $sumInput.inputmask("integer", { 1597 allowMinus: false, 1598 allowPlus: false, 1599 rightAlign: false, 1600 // min: min_sum_input, 1601 autoGroup: true, 1602 groupSeparator: " ", 1603 groupSize: 3, 1604 }); 1605 1606 // ÐеÑеопÑеделение меÑода валидаÑии поÑÑÑ 1607 // if (typeof $.validator !== 'undefined') { 1608 $.validator.methods.email = function (value, elem) { 1609 let re = 1610 /^(([^<>()[\]\\.,;:\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,}))$/; 1611 1612 if ( 1613 ($ddEmailValidator.val() != undefined || 1614 $ddEmailValidator.val() != null) && 1615 $ddEmailValidator.val() == "Y" 1616 ) { 1617 let formUrl = new URL(window.location.href), 1618 pathNameArr = [], 1619 ddPartner = ""; 1620 if (formUrl.pathname != "/") { 1621 pathNameArr = formUrl.pathname.split("/"); 1622 if (pathNameArr[1] == "dd") { 1623 ddPartner = pathNameArr[2]; 1624 1625 return ( 1626 this.optional(elem) || 1627 (re.test(value) && value.indexOf(ddPartner) !== -1) 1628 ); 1629 } 1630 } 1631 } 1632 1633 return this.optional(elem) || re.test(value); 1634 }; 1635 1636 // СообÑение на ÑазнÑе ÑлÑÑаи валидаÑии 1637 $.extend($.validator.messages, { 1638 required: "ÐаполниÑе, пожалÑйÑÑа", 1639 remote: "ÐожалÑйÑÑа, введиÑе пÑавилÑное знаÑение", 1640 email: "СкоÑÑекÑиÑÑйÑе, пожалÑйÑÑа", 1641 url: "ÐожалÑйÑÑа, введиÑе коÑÑекÑнÑй URL", 1642 minlengthphone: "ÐожалÑйÑÑа, введиÑе Ð½Ð¾Ð¼ÐµÑ Ð¿Ð¾Ð»Ð½Ð¾ÑÑÑÑ", 1643 }); 1644 1645 if ( 1646 ($ddEmailValidator.val() != undefined || 1647 $ddEmailValidator.val() != null) && 1648 $ddEmailValidator.val() == "Y" 1649 ) { 1650 let formUrl = new URL(window.location.href); 1651 if (formUrl.pathname != "/" && formUrl.pathname.split("/")[1] == "dd") { 1652 $.extend($.validator.messages, { 1653 email: "ÐÑполÑзÑйÑе коÑпоÑаÑивнÑÑ Ð¿Ð¾ÑÑÑ", 1654 }); 1655 } 1656 } 1657 // } 1658 1659 1660 //обÑзаÑелÑноÑÑÑ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ ÑелеÑона пÑи ÑпоÑобе оплаÑÑ QIWI 1661 $paymentTypes.click(function (e) { 1662 var payCurrent = $(this); 1663 var payMethod = payCurrent.find(".c-radio__native").val(); 1664 clearFormErrors(); 1665 let lbl; 1666 switch (payMethod) { 1667 case "qiwi": 1668 $phoneField.prop("required", true); 1669 lbl = $phoneField.parent().find(".lb-placeholder"); 1670 if (lbl.find("span").length <= 0) { 1671 lbl.html(lbl.html() + "<span>*</span>"); 1672 } 1673 if ($anonymField.prop("checked")) { 1674 $phoneField.parent().css("display", "block"); 1675 } 1676 break; 1677 default: 1678 $phoneField.prop("required", false); 1679 lbl = $phoneField.parent().find(".lb-placeholder span"); 1680 lbl.remove(); 1681 if ($anonymField.prop("checked")) { 1682 $phoneField.parent().css("display", "none"); 1683 $nameField.parent().css("display", "none"); 1684 } else { 1685 $phoneField.parent().css("display", "block"); 1686 $nameField.parent().css("display", "block"); 1687 } 1688 } 1689 }); 1690 1691 $anonymField.on("change input", function () { 1692 if ($(this).prop("checked")) { 1693 if ($paymentTypes.find(".c-radio__native:checked").val() == "qiwi") { 1694 $nameField.parent().css("display", "none"); 1695 } else { 1696 $nameField.parent().css("display", "none"); 1697 $phoneField.parent().css("display", "none"); 1698 } 1699 } else { 1700 $nameField.parent().css("display", "block"); 1701 $phoneField.parent().css("display", "block"); 1702 } 1703 }); 1704 1705 $chooseSumBtn.on("click", function () { 1706 // ÐалидаÑиÑ? 1707 var activeCheckbox = $sumRadio.filter(":checked"); 1708 1709 if (!activeCheckbox.length && !$sumInput.val().length) { 1710 $sumRadio.addClass(ERROR); 1711 $sumInput.addClass(ERROR); 1712 1713 setTimeout(function () { 1714 $sumRadio.removeClass(ERROR); 1715 $sumInput.removeClass(ERROR); 1716 }, 2000); 1717 } 1718 }); 1719 1720 $paymentCard.click(); 1721 1722 $form.validate({ 1723 errorClass: ERROR, 1724 validClass: VALID, 1725 errorElement: "span", 1726 highlight: function (element, errorClass, validClass) { 1727 $(element).parent().removeClass(validClass).addClass(errorClass); 1728 }, 1729 unhighlight: function (element, errorClass, validClass) { 1730 var $curWrap = $(element).parent(); 1731 $curWrap.removeClass(errorClass); 1732 if ($.trim($(element).val()) !== "") { 1733 $curWrap.addClass(validClass); 1734 } 1735 }, 1736 submitHandler: function () { 1737 var activeCheckbox = $sumRadio.filter(":checked"); 1738 1739 if ( 1740 !activeCheckbox.length && 1741 (!$sumInput.val().length || +$sumInput.val() < min_sum_input) 1742 ) { 1743 if (!$sumInput.val().length) { 1744 $sumRadio.addClass(ERROR); 1745 } 1746 1747 $sumInput.parent().removeClass(VALID); 1748 $sumInput.removeClass(VALID); 1749 $sumInput.parent().addClass(ERROR); 1750 $sumInput.addClass(ERROR); 1751 1752 setTimeout(function () { 1753 $sumRadio.removeClass(ERROR); 1754 // $sumInput.parent().removeClass(ERROR); 1755 }, 5000); 1756 return; 1757 } else { 1758 $sumInput.parent().removeClass(ERROR); 1759 $sumInput.parent().addClass(VALID); 1760 } 1761 1762 $.ajax({ 1763 type: "POST", 1764 url: "/bitrix/templates/main2016/help-form_new.php", 1765 dataType: "json", 1766 data: $form.serialize(), 1767 success: function (data) { 1768 var error = false;
1769 1770 $.each(data, function (key, val) { 1771 error = val == "error" ? true : error; 1772 $('[name="' + key + '"]').toggleClass("error", val == "error"); 1773 }); 1774 if (!error) { 1775 console.log('new_donate_attempt'); 1776 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_donate_attempt'); 1777 $.ajax({ 1778 type: "POST", 1779 url: "/bitrix/templates/main2016/save-help.php", 1780 data: $form.serialize(), 1781 success: function (data) {}, 1782 }); 1783 1784 $(document).trigger("helpFormSuccess"); 1785 1786 let url = new URL(window.location.href), 1787 hostArray = url.host.split("."), 1788 helpPage = $("#payment-way-1").data("page"), 1789 pageIdentifier = "main"; 1790 let _sp_id_integration = (getCookieTd('_sp_id.3279') || '').split('.')[0] || null; 1791 1792 if (helpPage == "pomogi_sosedyam") { 1793 pageIdentifier = "pomogi_sosedyam_spb"; 1794 1795 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1796 pageIdentifier = "pomogi_sosedyam_msk"; 1797 } 1798 } else if (helpPage == "bg_page") { 1799 pageIdentifier = "bg_page_spb"; 1800 1801 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1802 pageIdentifier = "bg_page_msk"; 1803 } 1804 } else if (helpPage == "strelka") { 1805 pageIdentifier = "strelka_spb"; 1806 1807 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1808 pageIdentifier = "strelka_msk"; 1809 } 1810 } else if (helpPage == "cafe") { 1811 pageIdentifier = "cafe_spb"; 1812 1813 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1814 pageIdentifier = "cafe_msk"; 1815 } 1816 } else if (helpPage == "doubledonation_page") { 1817 pageIdentifier = "doubledonation_spb"; 1818 1819 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1820 pageIdentifier = "doubledonation_msk"; 1821 } 1822 } else if (helpPage == "shelter") { 1823 pageIdentifier = "shelter_spb"; 1824 1825 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1826 pageIdentifier = "shelter_msk"; 1827 } 1828 } else { 1829 if (url.host !== undefined && url.host !== null) { 1830 switch (url.pathname) { 1831 case "/": 1832 pageIdentifier = "main"; 1833 break; 1834 case "/projects/1453/": 1835 pageIdentifier = "delimsya_opytom"; 1836 break; 1837 case "/how_to_help/": 1838 pageIdentifier = "how_to_help"; 1839 break; 1840 case "/projects/478/": 1841 pageIdentifier = "nochnoi_avtobus"; 1842 break; 1843 case "/projects/200381/": 1844 pageIdentifier = "nochnoi_avtobus"; 1845 break; 1846 case "/projects/697/": 1847 pageIdentifier = "rehab_priyut"; 1848 break; 1849 case "/projects/699/": 1850 pageIdentifier = "punkty_obogreva"; 1851 break; 1852 case "/projects/357408/": 1853 pageIdentifier = "punkty_obogreva"; 1854 break; 1855 case "/projects/732/": 1856 pageIdentifier = "konsultacionnaya_sluzhba"; 1857 break; 1858 case "/projects/174397/": 1859 pageIdentifier = "konsultacionnaya_sluzhba"; 1860 break; 1861 case "/projects/246481/": 1862 pageIdentifier = "neravnodush"; 1863 break; 1864 case "/projects/390526/": 1865 pageIdentifier = "neravnodush"; 1866 break; 1867 case "/projects/698/": 1868 pageIdentifier = "dom_na_poldorogi"; 1869 break; 1870 case "/projects/7984/": 1871 pageIdentifier = "kulturnaya_prachechnaya"; 1872 break; 1873 case "/projects/57060/": 1874 pageIdentifier = "punkt_vydachi"; 1875 break; 1876 case "/projects/733/": 1877 pageIdentifier = "rasskazyvaem_o_probleme"; 1878 break; 1879 case "/projects/74844/": 1880 pageIdentifier = "rasskazyvaem_o_probleme"; 1881 break; 1882 case "/projects/7790/": 1883 pageIdentifier = "project_volonteram"; 1884 break; 1885 case "/projects/225180/": 1886 pageIdentifier = "vzaimodeistvie_s_gosudarstvom"; 1887 break; 1888 case "/banyaneravnodush/": 1889 pageIdentifier = "banyaneravnodush"; 1890 helpPage = 'banyaneravnodush'; 1891 break; 1892 case "/dnpd/": 1893 pageIdentifier = "dnpd"; 1894 helpPage = 'dnpd'; 1895 break; 1896 case "/lapochka/": 1897 pageIdentifier = "lapochka"; 1898 helpPage = 'lapochka'; 1899 break; 1900 default: 1901 let pathNameArr = url.pathname.split("/"); 1902 1903 pageIdentifier = "main"; 1904 1905 if ( 1906 typeof pathNameArr[1] == "string" && 1907 pathNameArr[1] == "dd" 1908 ) { 1909 pageIdentifier = "doubledonation"; 1910 } else if (typeof $public_id.val() === "string" && $public_id.val()) { 1911 pageIdentifier = "donateiframe" 1912 helpPage = "donateiframe" 1913 } 1914 1915 break; 1916 } 1917 1918 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 1919 pageIdentifier += "_msk"; 1920 } else { 1921 pageIdentifier += "_spb"; 1922 } 1923 } 1924 } 1925 1926 // ÐбÑÐµÐºÑ Ð¿Ð¾Ð¶ÐµÑÑÐ²Ð¾Ð²Ð°Ð½Ð¸Ñ 1927 let product = { 1928 "name": (data["help-transfer-frequency"] !== "ежемеÑÑÑно") ? "Разовое пожеÑÑвование" : "РегÑлÑÑное пожеÑÑвование", 1929 "price": +data["help-transfer-sum"], 1930 "category": "cloudpayments", 1931 "quantity": 1, 1932 }; 1933 1934 window.dataLayer.push({ 1935 "ecommerce": { 1936 "currencyCode": "RUB", 1937 "add": { 1938 "products": [product] 1939 } 1940 } 1941 }) 1942 1943 1944 switch (data["help-transfer-payment"]) { 1945 case "payselection": 1946 $.ajax({ 1947 type: "POST", 1948 url: "/bitrix/templates/main2016/subscribeBeforePayment.php", 1949 dataType: "json", 1950 data: {email: data["help-transfer-email"]}, 1951 }); 1952 let widget_ps = new pw.PayWidget(); 1953 widget_ps.pay( 1954 { 1955 // serviceId - ÐденÑиÑикаÑÐ¾Ñ Ð¢Ð¡Ð 1956 serviceId: "20020", 1957 key: "04b633e9103bf41e4fcfafcdffb14678d25de5c817d4f628526780076602e998d9b88353af5ea8a78d90866c02eeb0a5d087a000675054230e4a0935b7fcfe278a" 1958 }, 1959 // ÐапÑÐ¾Ñ Ñ Ð¼Ð¸Ð½Ð¸Ð¼Ð°Ð»ÑнÑм колиÑеÑÑвом паÑамеÑÑов 1960 { 1961 MetaData: { 1962 PaymentType: "Pay", 1963 }, 1964 PaymentRequest: { 1965 OrderId: (new Date().getTime()) + '_' + pageIdentifier,
1966 Amount: data["help-transfer-sum"], 1967 Currency: "RUB", 1968 Description: "ÐоÑлежка", 1969 RebillFlag: data["help-transfer-frequency"] === "ежемеÑÑÑно", 1970 1971 }, 1972 CustomerInfo: { 1973 Email: data["help-transfer-email"].toLowerCase(), 1974 } 1975 }, 1976 // ÐапÑÐ¾Ñ Ñ Ð¼Ð°ÐºÑималÑнÑм колиÑеÑÑвом паÑамеÑÑов 1977 // См. запÑÐ¾Ñ Create 1978 { 1979 // ÐаÑианÑÑ ÐºÐ»ÑÑей коÑоÑÑе могÑÑ Ð¿ÑÐ¸Ñ Ð¾Ð´Ð¸ÑÑ Ð¿Ð¾ колбекам: 1980 // Ð´Ð»Ñ onSuccess -> PAY_WIDGET:TRANSACTION_SUCCESS 1981 // Ð´Ð»Ñ onError -> PAY_WIDGET:TRANSACTION_FAIL, PAY_WIDGET:CREATE_NETWORK_ERROR, PAY_WIDG:CREATE_BAD_REQUEST_ERROR 1982 onSuccess: function (res) { 1983 console.log("onSuccess from shop", res); 1984 1985 switch (helpPage || '') { 1986 case 'pomogi_sosedyam': 1987 var id = $("#collected").attr("data-id"); 1988 var old_summ = $("#collected").attr("data-summ"); 1989 var msg = ""; 1990 $.ajax({ 1991 type: "POST", 1992 url: 1993 "/ajax/donate.php?" + 1994 "summ=" + 1995 summ + 1996 "&id=" + 1997 id + 1998 "&old_summ=" + 1999 old_summ + 2000 "&email=" + 2001 data["help-transfer-email"], 2002 data: msg, 2003 }).always(function () { 2004 window.location.href = 2005 "/pomogi_sosedyam/thank_you.php"; 2006 }); 2007 break; 2008 2009 case 'bg_page': 2010 var id = $("#collected").attr("data-id"); 2011 var old_summ = $("#collected").attr("data-summ"); 2012 var msg = ""; 2013 $.ajax({ 2014 type: "POST", 2015 url: 2016 "/ajax/donate.php?" + 2017 "summ=" + 2018 summ + 2019 "&id=" + 2020 id + 2021 "&old_summ=" + 2022 old_summ + 2023 "&email=" + 2024 data["help-transfer-email"], 2025 data: msg, 2026 }).always(function () { 2027 let link = document.createElement("a"); 2028 // If you don't know the name or want to use 2029 // the webserver default set name = '' 2030 link.setAttribute("download", "УÑлÑÑÑ Ð¼ÐµÐ½Ñ Ñ Ð¾ÑоÑаÑ"); 2031 link.href = 2032 "/local/templates/main/download_bg/uslysh_menya_horoshaya.zip"; 2033 document.body.appendChild(link); 2034 link.click(); 2035 link.remove(); 2036 setTimeout(() => { 2037 window.location.href = "/bg/thank_you.php"; 2038 }, 300); 2039 }); 2040 break; 2041 2042 case 'strelka': 2043 var id = $("#collected").attr("data-id"); 2044 var old_summ = $("#collected").attr("data-summ"); 2045 var msg = ""; 2046 var dataUser = { 2047 page: "strelka_page", 2048 email: data["help-transfer-email"].toLowerCase(), 2049 }; 2050 $.ajax({ 2051 type: "POST", 2052 url: 2053 "/ajax/donate.php?" + 2054 "summ=" + 2055 summ + 2056 "&id=" + 2057 id + 2058 "&old_summ=" + 2059 old_summ + 2060 "&email=" + 2061 data["help-transfer-email"], 2062 data: msg, 2063 }); 2064 2065 $.ajax({ 2066 type: "POST", 2067 url: "/ajax/strelka_unisender_list.php", 2068 dataType: "json", 2069 data: dataUser, 2070 }).always(function () { 2071 window.location.href = "/how_to_help/thank_you.php"; 2072 }); 2073 break; 2074 2075 case 'cafe': 2076 var id = $("#collected").attr("data-id"); 2077 var old_summ = $("#collected").attr("data-summ"); 2078 var msg = ""; 2079 var dataUser = { 2080 page: "cafe_page", 2081 email: data["help-transfer-email"].toLowerCase(), 2082 }; 2083 $.ajax({ 2084 type: "POST", 2085 url: 2086 "/ajax/donate.php?" + 2087 "summ=" + 2088 summ + 2089 "&id=" + 2090 id + 2091 "&old_summ=" + 2092 old_summ + 2093 "&email=" + 2094 data["help-transfer-email"], 2095 data: msg, 2096 }); 2097 2098 $.ajax({ 2099 type: "POST", 2100 url: "/ajax/cafe_unisender_list.php", 2101 dataType: "json", 2102 data: dataUser, 2103 }).always(function () { 2104 window.location.href = "/how_to_help/thank_you.php"; 2105 }); 2106 break; 2107 2108 case 'shelter': 2109 var id = $("#collected").attr("data-id"); 2110 var old_summ = $("#collected").attr("data-summ"); 2111 var msg = ""; 2112 var dataUser = { 2113 page: "shelter_page", 2114 email: data["help-transfer-email"].toLowerCase(), 2115 }; 2116 $.ajax({ 2117 type: "POST", 2118 url: 2119 "/ajax/donate.php?" + 2120 "summ=" + 2121 summ + 2122 "&id=" + 2123 id + 2124 "&old_summ=" + 2125 old_summ + 2126 "&email=" + 2127 data["help-transfer-email"], 2128 data: msg, 2129 }); 2130 2131 $.ajax({ 2132 type: "POST", 2133 url: "/ajax/cafe_unisender_list.php", 2134 dataType: "json", 2135 data: dataUser, 2136 }).always(function () { 2137 window.location.href = "/how_to_help/thank_you.php"; 2138 }); 2139 break; 2140 2141 default: 2142 var id = $("#collected").attr("data-id"); 2143 var old_summ = $("#collected").attr("data-summ"); 2144 var msg = ""; 2145 $.ajax({ 2146 type: "POST", 2147 url: 2148 "/ajax/donate.php?" + 2149 "summ=" + 2150 summ + 2151 "&id=" + 2152 id + 2153 "&old_summ=" + 2154 old_summ + 2155 "&email=" + 2156 data["help-transfer-email"], 2157 data: msg, 2158 }).always(function () { 2159 window.location.href = "/how_to_help/thank_you.php"; 2160 }); 2161 2162 2163 } 2164 2165 }, 2166 onError: function (res) { 2167 console.log("onFail from shop", res); 2168 }, 2169 onClose: function (res) { 2170 console.log("onClose from shop", res); 2171 }, 2172 }, 2173 ); 2174 2175 break; 2176 case "qiwi": 2177 //$('#qiwi_pay_link').attr('href', 'https://qiwi.com/payment/form.action?provider=26084&amountInteger='+ data["help-transfer-sum"] + '&ccy=RUB&successUrl=/how_to_help/thank_you/?sum='+ data["help-transfer-sum"] + '&qiwi=y&email='+ data["help-transfer-email"] ); 2178 //$('#qiwi_pay_link')[0].click(); 2179 var phoneValue = $("input[name=help-transfer-phone]").val(); 2180 $.ajax({ 2181 type: "POST", 2182 url: "/ajax/qiwi_link.php", 2183 data: { 2184 sum: data["help-transfer-sum"], 2185 phone: phoneValue, 2186 email: data["help-transfer-email"], 2187 page: pageIdentifier, 2188 }, 2189 succe
2189ss: function (resp) { 2190 console.log(resp) 2191 var link = resp; 2192 window.location = link; 2193 }, 2194 }); 2195 break; 2196 case "yandex_money": 2197 $("#yaSum").val(data["help-transfer-sum"]); 2198 $("[name=ya_email]").val(data["help-transfer-email"]); 2199 2200 $("#yaPage").val(pageIdentifier); 2201 2202 $("#yaSend").closest("form").trigger("submit"); 2203 break; 2204 case "paypal": 2205 if ( 2206 $('input[name="help-transfer-frequency"]').val() !== 2207 "Ñазово" || 2208 $('input[name="help-transfer-frequency"]').val() === 2209 "ежемеÑÑÑно" 2210 ) { 2211 $("#paypalSumRegular").val(data["help-transfer-sum"]); 2212 $("#paypalSendRegular").closest("form").trigger("submit"); 2213 break; 2214 } 2215 2216 // Ðобавим знаÑение иденÑиÑикаÑоÑа ÑÑÑаниÑÑ Ð² ÑоÑÐ¼Ñ 2217 $("#payPalPage").val(pageIdentifier); 2218 2219 $("#paypalSum").val(data["help-transfer-sum"]); 2220 $("#paypalSend").closest("form").trigger("submit"); 2221 2222 break; 2223 case "cloudpayments": 2224 $.ajax({ 2225 type: "POST", 2226 url: "/bitrix/templates/main2016/subscribeBeforePayment.php", 2227 dataType: "json", 2228 data: {email: data["help-transfer-email"]}, 2229 }); 2230 2231 $(".preloader-s1").addClass("active"); 2232 setTimeout(function () { 2233 $(".preloader-s1").removeClass("active"); 2234 }, 5000); 2235 2236 var lang = $("html").attr("lang"); 2237 2238 var widget, namePay; 2239 if (lang == "ru") { 2240 widget = new cp.CloudPayments(); 2241 namePay = "ÐоÑлежка"; 2242 } else { 2243 widget = new cp.CloudPayments({language: "en-US"}); 2244 namePay = "Nochlezhka"; 2245 } 2246 var summ = +data["help-transfer-sum"]; 2247 2248 let transferData = { 2249 domain_userid: _sp_id_integration 2250 }; 2251 2252 if (data["help-transfer-frequency"] == "ежемеÑÑÑно") { 2253 transferData.cloudPayments = { 2254 recurrent: { 2255 interval: "Month", 2256 period: 1, 2257 amount: data["help-transfer-sum"], 2258 }, 2259 }; 2260 } 2261 2262 if (helpPage == "pomogi_sosedyam") { 2263 transferData.page = pageIdentifier; 2264 2265 2266 widget.pay('charge', 2267 { 2268 // options 2269 publicId: "pk_2b938ccb7f7222a2b95dd223f73db", 2270 description: namePay, 2271 amount: summ, 2272 currency: "RUB", 2273 ///invoiceId: '1234567', 2274 accountId: data["help-transfer-email"].toLowerCase(), 2275 email: data["help-transfer-email"], 2276 data: transferData, 2277 }, 2278 { 2279 onSuccess: function (options) { // success 2280 var id = $("#collected").attr("data-id"); 2281 var old_summ = $("#collected").attr("data-summ"); 2282 var msg = ""; 2283 $.ajax({ 2284 type: "POST", 2285 url: 2286 "/ajax/donate.php?" + 2287 "summ=" + 2288 summ + 2289 "&id=" + 2290 id + 2291 "&old_summ=" + 2292 old_summ + 2293 "&email=" + 2294 data["help-transfer-email"], 2295 data: msg, 2296 }).always(function () { 2297 window.location.href = 2298 "/pomogi_sosedyam/thank_you.php"; 2299 }); 2300 }, 2301 onFail: function (reason, options) { 2302 console.log('fail'); 2303 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2304 window.dataLayer.push({ 2305 "ecommerce": { 2306 "currencyCode": "RUB", 2307 "remove": { 2308 "products": [product] 2309 } 2310 } 2311 }) 2312 }, 2313 onComplete: function (paymentResult, options) { 2314 if (paymentResult.success) { 2315 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2316 window.dataLayer.push({ 2317 "ecommerce": { 2318 "currencyCode": "RUB", 2319 "purchase": { 2320 "actionField": { 2321 "id": data["help-transfer-email"], 2322 }, 2323 "products": [product] 2324 } 2325 } 2326 }) 2327 } else { 2328 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2329 window.dataLayer.push({ 2330 "ecommerce": { 2331 "currencyCode": "RUB", 2332 "remove": { 2333 "products": [product] 2334 } 2335 } 2336 }) 2337 } 2338 } 2339 } 2340 ); 2341 } else if (helpPage == "bg_page") { 2342 transferData.page = pageIdentifier; 2343 2344 widget.pay('charge', 2345 { 2346 // options 2347 publicId: "pk_354c0a7fd5bead5b27b96a022c902", 2348 description: namePay, 2349 amount: summ, 2350 currency: "RUB", 2351 ///invoiceId: '1234567', 2352 accountId: data["help-transfer-email"].toLowerCase(), 2353 email: data["help-transfer-email"], 2354 data: transferData, 2355 }, 2356 { 2357 onSuccess: function (options) { // success 2358 var id = $("#collected").attr("data-id"); 2359 var old_summ = $("#collected").attr("data-summ"); 2360 var msg = ""; 2361 $.ajax({ 2362 type: "POST", 2363 url: 2364 "/ajax/donate.php?" + 2365 "summ=" + 2366 summ + 2367 "&id=" + 2368 id + 2369 "&old_summ=" + 2370 old_summ + 2371 "&email=" + 2372 data["help-transfer-email"], 2373 data: msg, 2374 }).always(function () { 2375 let link = document.createElement("a"); 2376 // If you don't know the name or want to use 2377 // the webserver default set name = '' 2378 link.setAttribute("download", "УÑлÑÑÑ Ð¼ÐµÐ½Ñ Ñ Ð¾ÑоÑаÑ"); 2379 link.href = 2380 "/local/templates/main/download_bg/uslysh_menya_horoshaya.zip"; 2381 document.body.appendChild(link); 2382 link.click(); 2383 link.remove(); 2384 setTimeout(() => { 2385 window.location.href = "/bg/thank_you.php"; 2386 }, 300); 2387 }); 2388 }, 2389 onFail: function (reason, options) { 2390 console.log('fail'); 2391 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2392 window.dataLayer.push({ 2393 "ecommerce": { 2394 "currencyCode": "RUB", 2395 "remove": { 2396 "products": [product] 2397 } 2398 } 2399 }) 2400 }, 2401 onComplete: function (paymentResult, options) { 2402 if (paymentResult.success) { 2403 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2404 window.dataLayer.push({ 2405 "ecommerce": { 2406 "currencyCode": "RUB", 2407 "purchase": { 2408 "actionField": { 2409 "id": data["help-transfer-email"], 2410 }, 2411 "products": [product] 2412 } 2413 } 2414 }) 2415 } else { 2416 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2417 window.dataLayer.push({ 2418 "ecommerce": { 2419 "currencyCode": "RUB", 2420 "remove": { 2421 "products": [product] 2422 } 2423 } 2424 }) 2425 } 2426 } 2427 } 2428 ); 2429 } else if (helpPage == "strelka") { 2430
2430 let publicId = "pk_368f3a8fa3f957d85bf9cd5a49b95"; 2431 2432 if (url.host !== undefined && url.host !== null) { 2433 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 2434 // иÑполÑзÑем дÑÑгой клаÑд id 2435 publicId = "pk_f0447f52c802f6369b718a51e0279"; 2436 } 2437 } 2438 2439 transferData.page = pageIdentifier; 2440 2441 widget.pay('charge', 2442 { 2443 // options 2444 publicId: publicId, 2445 description: namePay, 2446 amount: summ, 2447 currency: "RUB", 2448 accountId: data["help-transfer-email"].toLowerCase(), 2449 email: data["help-transfer-email"].toLowerCase(), 2450 data: transferData, 2451 }, 2452 { 2453 onSuccess: function (options) { // success 2454 var id = $("#collected").attr("data-id"); 2455 var old_summ = $("#collected").attr("data-summ"); 2456 var msg = ""; 2457 let dataUser = { 2458 page: "strelka_page", 2459 email: data["help-transfer-email"].toLowerCase(), 2460 }; 2461 $.ajax({ 2462 type: "POST", 2463 url: 2464 "/ajax/donate.php?" + 2465 "summ=" + 2466 summ + 2467 "&id=" + 2468 id + 2469 "&old_summ=" + 2470 old_summ + 2471 "&email=" + 2472 data["help-transfer-email"], 2473 data: msg, 2474 }); 2475 2476 $.ajax({ 2477 type: "POST", 2478 url: "/ajax/strelka_unisender_list.php", 2479 dataType: "json", 2480 data: dataUser, 2481 }).always(function () { 2482 window.location.href = "/how_to_help/thank_you.php"; 2483 }); 2484 }, 2485 onFail: function (reason, options) { 2486 console.log('fail'); 2487 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2488 window.dataLayer.push({ 2489 "ecommerce": { 2490 "currencyCode": "RUB", 2491 "remove": { 2492 "products": [product] 2493 } 2494 } 2495 }) 2496 }, 2497 onComplete: function (paymentResult, options) { 2498 if (paymentResult.success) { 2499 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2500 window.dataLayer.push({ 2501 "ecommerce": { 2502 "currencyCode": "RUB", 2503 "purchase": { 2504 "actionField": { 2505 "id": data["help-transfer-email"], 2506 }, 2507 "products": [product] 2508 } 2509 } 2510 }) 2511 } else { 2512 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2513 window.dataLayer.push({ 2514 "ecommerce": { 2515 "currencyCode": "RUB", 2516 "remove": { 2517 "products": [product] 2518 } 2519 } 2520 }) 2521 } 2522 } 2523 } 2524 ); 2525 } else if (helpPage == "cafe") { 2526 let publicId = "pk_c86f466e0ceedabb36dc5334a3d65"; 2527 2528 if (url.host !== undefined && url.host !== null) { 2529 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 2530 // иÑполÑзÑем дÑÑгой клаÑд id 2531 publicId = "pk_481ab9586c3c98789ee669d23a6d5"; 2532 } 2533 } 2534 2535 transferData.page = pageIdentifier; 2536 2537 widget.pay('charge', 2538 { 2539 // options 2540 publicId: publicId, 2541 description: namePay, 2542 amount: summ, 2543 currency: "RUB", 2544 accountId: data["help-transfer-email"].toLowerCase(), 2545 email: data["help-transfer-email"].toLowerCase(), 2546 data: transferData, 2547 }, 2548 { 2549 onSuccess: function (options) { // success 2550 var id = $("#collected").attr("data-id"); 2551 var old_summ = $("#collected").attr("data-summ"); 2552 var msg = ""; 2553 let dataUser = { 2554 page: "cafe_page", 2555 email: data["help-transfer-email"].toLowerCase(), 2556 }; 2557 $.ajax({ 2558 type: "POST", 2559 url: 2560 "/ajax/donate.php?" + 2561 "summ=" + 2562 summ + 2563 "&id=" + 2564 id + 2565 "&old_summ=" + 2566 old_summ + 2567 "&email=" + 2568 data["help-transfer-email"], 2569 data: msg, 2570 }); 2571 2572 $.ajax({ 2573 type: "POST", 2574 url: "/ajax/cafe_unisender_list.php", 2575 dataType: "json", 2576 data: dataUser, 2577 }).always(function () { 2578 window.location.href = "/how_to_help/thank_you.php"; 2579 }); 2580 }, 2581 onFail: function (reason, options) { 2582 console.log('fail'); 2583 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2584 window.dataLayer.push({ 2585 "ecommerce": { 2586 "currencyCode": "RUB", 2587 "remove": { 2588 "products": [product] 2589 } 2590 } 2591 }) 2592 }, 2593 onComplete: function (paymentResult, options) { 2594 if (paymentResult.success) { 2595 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2596 window.dataLayer.push({ 2597 "ecommerce": { 2598 "currencyCode": "RUB", 2599 "purchase": { 2600 "actionField": { 2601 "id": data["help-transfer-email"], 2602 }, 2603 "products": [product] 2604 } 2605 } 2606 }) 2607 } else { 2608 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2609 window.dataLayer.push({ 2610 "ecommerce": { 2611 "currencyCode": "RUB", 2612 "remove": { 2613 "products": [product] 2614 } 2615 } 2616 }) 2617 } 2618 } 2619 } 2620 ); 2621 } else if (helpPage == "shelter") { 2622 let publicId = "pk_668a0dce010c7f3153501f3197c60"; 2623 2624 transferData.page = pageIdentifier; 2625 2626 widget.pay('charge', 2627 { 2628 // options 2629 publicId: publicId, 2630 description: namePay, 2631 amount: summ, 2632 currency: "RUB", 2633 accountId: data["help-transfer-email"].toLowerCase(), 2634 email: data["help-transfer-email"].toLowerCase(), 2635 data: transferData, 2636 }, 2637 { 2638 onSuccess: function (options) { // success 2639 var id = $("#collected").attr("data-id"); 2640 var old_summ = $("#collected").attr("data-summ"); 2641 var msg = ""; 2642 let dataUser = { 2643 page: "shelter_page", 2644 email: data["help-transfer-email"].toLowerCase(), 2645 }; 2646 $.ajax({ 2647 type: "POST", 2648 url: 2649 "/ajax/donate.php?" + 2650 "summ=" + 2651 summ + 2652 "&id=" + 2653 id + 2654 "&old_summ=" + 2655 old_summ + 2656 "&email=" + 2657 data["help-transfer-email"], 2658 data: msg, 2659 }); 2660 2661 $.ajax({ 2662
2662 type: "POST", 2663 url: "/ajax/cafe_unisender_list.php", 2664 dataType: "json", 2665 data: dataUser, 2666 }).always(function () { 2667 window.location.href = "/how_to_help/thank_you.php"; 2668 }); 2669 }, 2670 onFail: function (reason, options) { 2671 console.log('fail'); 2672 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2673 window.dataLayer.push({ 2674 "ecommerce": { 2675 "currencyCode": "RUB", 2676 "remove": { 2677 "products": [product] 2678 } 2679 } 2680 }) 2681 }, 2682 onComplete: function (paymentResult, options) { 2683 if (paymentResult.success) { 2684 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2685 window.dataLayer.push({ 2686 "ecommerce": { 2687 "currencyCode": "RUB", 2688 "purchase": { 2689 "actionField": { 2690 "id": data["help-transfer-email"], 2691 }, 2692 "products": [product] 2693 } 2694 } 2695 }) 2696 } else { 2697 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2698 window.dataLayer.push({ 2699 "ecommerce": { 2700 "currencyCode": "RUB", 2701 "remove": { 2702 "products": [product] 2703 } 2704 } 2705 }) 2706 } 2707 } 2708 } 2709 ); 2710 } else if (helpPage == "doubledonation_page") { 2711 let publicId = "pk_37aef01538440c887a9c82c74c2d5"; 2712 2713 if (url.host !== undefined && url.host !== null) { 2714 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 2715 // иÑполÑзÑем дÑÑгой клаÑд id 2716 publicId = "pk_a28827ae70fb633629689c349036c"; 2717 } 2718 } 2719 2720 let callback = null, getCookieRtdGoal = null, getCookieRtdCase = null; 2721 2722 if (url.pathname === '/dd/rtd/') { 2723 getCookieRtdGoal = getCookieTd('rtd_goal_id'); 2724 getCookieRtdCase = getCookieTd('rtd_case_id'); 2725 callback = (donation_sum) => { 2726 sendRtdGoalToApiOnSuccess(donation_sum).then(apiResult => { 2727 if (apiResult.success) { 2728 // ÐÑполнÑем ÑедиÑÐµÐºÑ ÑолÑко поÑле ÑÑпеÑного вÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ API-запÑоÑа 2729 window.location.href = 'https://raztak.ru/status/donations/?donation_id=' + getCookieRtdGoal + '&case_id=' + getCookieRtdCase; 2730 } else { 2731 console.error("API-запÑÐ¾Ñ Ð·Ð°Ð²ÐµÑÑилÑÑ Ñ Ð¾Ñибкой:", apiResult.message); 2732 alert("ÐÑибка подÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ ÐºÐ¾Ð½Ð²ÐµÑÑии: ${apiResult.message}"); 2733 } 2734 }).catch(error => { 2735 console.error("ÐÑоизоÑла оÑибка пÑи подÑвеÑждении плаÑежа на ÑÐ±Ð¾Ñ Ñ Ð¿Ð»Ð°ÑÑоÑÐ¼Ñ Ð ÐРТÐÐÐÐ ÐÐÐÐ:", error); 2736 alert("ÐÑибка пÑи подÑвеÑждении плаÑежа на ÑÐ±Ð¾Ñ Ñ Ð¿Ð»Ð°ÑÑоÑÐ¼Ñ Ð ÐРТÐÐÐÐ ÐÐÐÐ"); 2737 }); 2738 } 2739 } 2740 2741 $.ajax({ 2742 type: "POST", 2743 url: "/ajax/double-donation/form_handler.php", 2744 dataType: "json", 2745 data: {email: data["help-transfer-email"]}, 2746 beforeSend: function () { 2747 $form 2748 .find("button[type=submit]") 2749 .prop("disabled", true); 2750 }, 2751 success: function (response) { 2752 if (!response.success) { 2753 $.each(response.message, function (key, val) { 2754 $('input[name="' + key + '"]') 2755 .parents() 2756 .addClass("is-error"); 2757 $('input[name="' + key + '"]').after( 2758 '<label id="' + 2759 key +
2760 '-error" class="is-error" for="' + 2761 key + 2762 '">' + 2763 val + 2764 "</label>" 2765 ); 2766 }); 2767 } else { 2768 transferData.page = pageIdentifier; 2769 // ÐÑÑаÑим паÑÑнеÑÑкий домен и пеÑедадим в transferData 2770 let urlArr = url.pathname.split("/"), 2771 partnerDomain = 2772 typeof urlArr[urlArr.length - 1] == "string" && urlArr[urlArr.length - 1] != '' 2773 ? urlArr[urlArr.length - 1] 2774 : (urlArr.length - 2 >= 0 && typeof urlArr[urlArr.length - 2] == "string" 2775 ? urlArr[urlArr.length - 2] 2776 : "н/д"); 2777 2778 transferData.doubleDonation = partnerDomain; 2779 2780 if (getCookieRtdGoal && getCookieRtdCase) { 2781 transferData.td_case_id = getCookieRtdCase; 2782 transferData.td_goal_id = getCookieRtdGoal; 2783 } 2784 2785 widget.pay('charge', 2786 { 2787 // options 2788 publicId: publicId, 2789 description: namePay, 2790 amount: summ, 2791 currency: "RUB", 2792 accountId: 2793 data["help-transfer-email"].toLowerCase(), 2794 email: data["help-transfer-email"], 2795 data: transferData, 2796 }, 2797 { 2798 onSuccess: function (options) { // success 2799 var id = $("#collected").attr("data-id"); 2800 var old_summ = $("#collected").attr("data-summ"); 2801 var msg = ""; 2802 $.ajax({ 2803 type: "POST", 2804 url: 2805 "/ajax/donate.php?" + 2806 "summ=" + 2807 summ + 2808 "&id=" + 2809 id + 2810 "&old_summ=" + 2811 old_summ + 2812 "&email=" + 2813 data["help-transfer-email"], 2814 data: msg, 2815 }).always(function () { 2816 if (typeof callback === "function") { 2817 callback(summ); 2818 } else { 2819 window.location.href = 2820 "/how_to_help/thank_you.php"; 2821 } 2822 }); 2823 }, 2824 onFail: function (reason, options) { 2825 console.log('fail'); 2826 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2827 window.dataLayer.push({ 2828 "ecommerce": { 2829 "currencyCode": "RUB", 2830 "remove": { 2831 "products": [product] 2832 } 2833 } 2834 }) 2835 }, 2836 onComplete: function (paymentResult, options) { 2837 if (paymentResult.success) { 2838 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2839 window.dataLayer.push({ 2840 "ecommerce": { 2841 "currencyCode": "RUB", 2842 "purchase": { 2843 "actionField": { 2844 "id": data["help-transfer-email"], 2845 }, 2846 "products": [product] 2847 } 2848 } 2849 }) 2850 } else { 2851 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2852 window.dataLayer.push({ 2853 "ecommerce": { 2854 "currencyCode": "RUB", 2855 "remove": { 2856 "products": [product] 2857 } 2858 } 2859 }) 2860 } 2861 } 2862 } 2863 ); 2864 } 2865 }, 2866 complete: function () { 2867 $form 2868 .find("button[type=submit]") 2869 .prop("disabled", false); 2870 }, 2871 }); 2872 } else { 2873 // вÑÑÑним Ñ ÐºÐ°ÐºÐ¾Ð³Ð¾ Ñ Ð¾ÑÑа бÑдем поÑÑлаÑÑ Ð·Ð°Ð¿ÑÐ¾Ñ Ð¸ вÑбеÑем Ð¿Ð¾Ð´Ñ Ð¾Ð´ÑÑий клаÑд id 2874 let publicId = "pk_37aef01538440c887a9c82c74c2d5"; 2875 2876 if (url.host !== undefined && url.host !== null) { 2877 if (typeof CITY_URL !== 'undefined' && CITY_URL !== 'spb') { 2878 // иÑполÑзÑем дÑÑгой клаÑд id 2879 publicId = "pk_a28827ae70fb633629689c349036c"; 2880 } 2881 } 2882 if (helpPage === "donateiframe") { 2883 publicId = $public_id.val(); 2884 } 2885 2886 transferData.page = pageIdentifier; 2887 2888 widget.pay('charge', 2889 { 2890 // options 2891 publicId: publicId, 2892 description: namePay, 2893 amount: summ, 2894 currency: "RUB", 2895 accountId: data["help-transfer-email"].toLowerCase(), 2896 email: data["help-transfer-email"], 2897 data: transferData, 2898 }, 2899 { 2900 onSuccess: function (options) { // success 2901 var id = $("#collected").attr("data-id"); 2902 var old_summ = $("#collected").attr("data-summ"); 2903 var msg = ""; 2904 $.ajax({ 2905 type: "POST", 2906 url: 2907 "/ajax/donate.php?" + 2908 "summ=" + 2909 summ + 2910 "&id=" + 2911 id + 2912 "&old_summ=" + 2913 old_summ + 2914 "&email=" + 2915 data["help-transfer-email"], 2916 data: msg, 2917 }).always(function () { 2918 window.location.href = "/how_to_help/thank_you.php"; 2919 }); 2920 }, 2921 onFail: function (reason, options) { 2922 console.log('fail'); 2923 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 2924 window.dataLayer.push({ 2925 "ecommerce": { 2926 "currencyCode": "RUB", 2927 "remove": { 2928 "products": [product] 2929 } 2930 } 2931 }) 2932 }, 2933 onComplete: function (paymentResult, options) { 2934 if (paymentResult.success) { 2935 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2936 window.dataLayer.push({ 2937 "ecommerce": { 2938 "currencyCode": "RUB", 2939 "purchase": { 2940 "actionField": { 2941 "id": data["help-transfer-email"], 2942 }, 2943 "products": [product] 2944 } 2945 } 2946 }) 2947 } else { 2948 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 2949 window.dataLayer.push({ 2950 "ecommerce": { 2951 "currencyCode": "RUB", 2952 "remove": { 2953 "products": [product] 2954 } 2955 } 2956 }) 2957 } 2958 } 2959 } 2960 ); 2961 } 2962 break; 2963 case "mixplat": 2964 2965 let options = { 2966 widget_key: 'f9ef88e5-0f35-4037-855c-2a4f48317ddb', 2967 amount: +data["help-transfer-sum"] * 100, // 10 ÑÑб. 00 коп. 2968 description: 'ÐлагоÑвоÑиÑелÑное пожеÑÑвование', 2969 user_email: data["help-transfer-email"], 2970 user_name: data["help-transfer-name"], 2971 test: 0, 2972 payment_form_id: 64875, 2973
2973 merchant_fields: {page: pageIdentifier, domain_userid: _sp_id_integration}, 2974 recurrent_payment: (data["help-transfer-frequency"] !== "ежемеÑÑÑно") ? 0 : 1, 2975 } 2976 let M = new Mixplat(options); 2977 M.build(); 2978 M.setSuccessCallback(function (o, i) { 2979 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_success_donate'); 2980 window.dataLayer.push({ 2981 "ecommerce": { 2982 "currencyCode": "RUB", 2983 "purchase": { 2984 "actionField": { 2985 "id": data["help-transfer-email"], 2986 }, 2987 "products": [product] 2988 } 2989 } 2990 }) 2991 var id = $("#collected").attr("data-id"); 2992 var old_summ = $("#collected").attr("data-summ"); 2993 var msg = ""; 2994 $.ajax({ 2995 type: "POST", 2996 url: 2997 "/ajax/donate.php?" + 2998 "summ=" + 2999 summ + 3000 "&id=" + 3001 id + 3002 "&old_summ=" + 3003 old_summ + 3004 "&email=" + 3005 data["help-transfer-email"], 3006 data: msg, 3007 }).always(function () { 3008 window.location.href = 3009 "/how_to_help/thank_you.php"; 3010 }); 3011 }); 3012 M.setFailCallback(function (o, i) { 3013 console.log('fail'); 3014 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_fail_donate'); 3015 window.dataLayer.push({ 3016 "ecommerce": { 3017 "currencyCode": "RUB", 3018 "remove": { 3019 "products": [product] 3020 } 3021 } 3022 }) 3023 }); 3024 M.setCloseCallback(function (o, i) { 3025 console.log('close'); 3026 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'new_cancel_donate'); 3027 window.dataLayer.push({ 3028 "ecommerce": { 3029 "currencyCode": "RUB", 3030 "remove": { 3031 "products": [product] 3032 } 3033 } 3034 }) 3035 }); 3036 break; 3037 } 3038 } 3039 }, 3040 }); 3041 3042 return false;
3043 }, 3044 }); 3045 })($(".js-help-form")); 3046 3047 $(document).on('click', '.password-visible-false, .password-visible-true', function () { 3048 const type = $(this).hasClass('password-visible-false') ? 'text' : 'password', 3049 class_name = $(this).hasClass('password-visible-false') ? 'password-visible-true' : 'password-visible-false', 3050 input = $(this).closest('.input-password').find('#profile-password'), 3051 parent = $(this).closest('.password-visible'); 3052 3053 input.attr('type', type); 3054 parent.find('.password-visible-false, .password-visible-true').css('display', 'none'); 3055 parent.find('.'+class_name).css('display', 'block'); 3056 }); 3057 3058 3059 function startVisibleObserver(el, f) 3060 { 3061 new IntersectionObserver(function(entries, observer) { 3062 if(entries[0]['isIntersecting'] === true) { 3063 if(entries[0]['intersectionRatio'] > 0.9) { 3064 observer.disconnect(); 3065 f(); 3066 } 3067 } 3068 else { 3069 // console.log( 'Target is not visible in screen'); 3070 } 3071 }, { threshold: [0.9, 1] }).observe(el); 3072 } 3073 3074 let visible_already_sent = false; 3075 3076 $('#help-form p.form-donate-offer').each(function(){ 3077 startVisibleObserver(this, function(){ 3078 console.log('donate_form_is_visible') 3079 if (!visible_already_sent){ 3080 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'donate_form_is_visible') 3081 } 3082 }); 3083 }); 3084 3085 function onceChangeForm() { 3086 console.log('donate_form_is_change') 3087 $('form#help-form').unbind('change', onceChangeForm); 3088 typeof ym !== "undefined" && ym(38726740, 'reachGoal', 'donate_form_is_change') 3089 } 3090 3091 $('form#help-form').change(onceChangeForm); 3092 3093 // ÐÑогÑеÑÑ Ð±Ð°Ñ Ð´Ð»Ñ ÑÑÑаниÑÑ ÐанÑÐеÑавнодÑÑ 3094 (() => { 3095 function ProgressBar() { 3096 this.wrapper = $('.js-collect-page-progress .progress-wrapper'); 3097 this.sum = $('.js-collect-page-progress .collected-sum'); 3098 3099 const _proto = ProgressBar.prototype; 3100 3101 _proto.init = function() { 3102 const _this = this; 3103 3104 if (_this.wrapper.length > 0) { 3105 _this.renderBar(); 3106 } 3107 } 3108 3109 _proto.renderBar = function() { 3110 const _this = this; 3111 3112 let current_path = window.location.pathname; 3113 let paths = ['/banyaneravnodush/', '/dnpd/', '/lapochka/']; 3114 let goal_sums = [400000, 1500000, 0]; 3115 let current_path_index = paths.indexOf(current_path); 3116 3117 if (current_path_index === -1) { 3118 return; 3119 } 3120 3121 let page = current_path.replaceAll('/',''); 3122 let goal_sum = goal_sums[current_path_index]; 3123 3124 $.ajax({ 3125 type: 'POST', 3126 url: '/ajax/get_progress_by_page.php?page='+page, 3127 dataType: 'json', 3128 success: function(data) { 3129 if (data.success) { 3130 let collected_sum = parseInt(data.sum) || 0; 3131 _this.sum.text(collected_sum.toLocaleString('ru-RU')); 3132 3133 let width = 0; 3134 3135 3136 if (goal_sum === 0) { 3137 return; 3138 } 3139 3140 if (collected_sum >= goal_sum) { 3141 width = 100; 3142 } else { 3143 width = (collected_sum / goal_sum * 100); 3144 } 3145 3146 _this.wrapper.find('.progress-bar').css({ 3147 'width': width + '%' 3148 }); 3149 } 3150 }, 3151 }); 3152 } 3153 } 3154 return new ProgressBar; 3155 })().init(); 3156 3157}); 3158(function () { 3159 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ ÑÑÑановки и ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Cookie 3160 function setCookieTd(name, value, days) { 3161 let expires = ""; 3162 if (days) { 3163 let date = new Date(); 3164 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 3165 expires = "; expires=" + date.toUTCString(); 3166 } 3167 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 3168 } 3169 3170 // ÐолÑÑаем ÑекÑÑие паÑамеÑÑÑ URL
3171 const urlParams = new URLSearchParams(window.location.search); 3172 // ÐÑем паÑамеÑÑ 'rtd_goal_id ' 3173 const rtdGoalValue = urlParams.get('rtd_goal_id'); 3174 const rtdCaseValue = urlParams.get('rtd_case_id'); 3175 3176 // ÐÑли паÑамеÑÑ rtd_goal_id найден в URL, ÑÐ¾Ñ ÑанÑем его в Cookie 3177 if (rtdGoalValue && rtdCaseValue) { 3178 // Ðазвание Cookie, коÑоÑое бÑÐ´ÐµÑ ÑÐ¾Ñ Ñанено 3179 const cookieRtdGoalID = 'rtd_goal_id'; 3180 const cookieRtdCaseID = 'rtd_case_id'; 3181 // ÐолиÑеÑÑво дней, на коÑоÑое ÑÐ¾Ñ ÑанÑем Cookie 3182 const expiryDays = 3; 3183 3184 // ÐÑзов ÑÑнкÑии Ð´Ð»Ñ ÑÐ¾Ñ ÑÐ°Ð½ÐµÐ½Ð¸Ñ cookie 3185 setCookieTd(cookieRtdGoalID, rtdGoalValue, expiryDays); 3186 setCookieTd(cookieRtdCaseID, rtdCaseValue, expiryDays); 3187 // ÐÑвеÑÑи знаÑÐµÐ½Ð¸Ñ Ð² конÑÐ¾Ð»Ñ Ð±ÑаÑзеÑа 3188 console.log(`rtd_goal_id "${rtdGoalValue}" и rtd_case_id "${rtdCaseValue}" ÑÐ¾Ñ ÑÐ°Ð½ÐµÐ½Ñ Ð² cookie "${cookieRtdGoalID}" и "${cookieRtdCaseID}" на ${expiryDays} дней.`); 3189 } 3190})(); 3191 3192function acceptedCheck(el){ 3193 let offer_accept_block = el, 3194 offer_accept = offer_accept_block.is(':checked'); 3195 3196 if (offer_accept_block.length) { 3197 offer_accept_block.parent().removeClass('shake-horizontal') 3198 if (!offer_accept) { 3199 setTimeout(() => { 3200 offer_accept_block.parent().addClass('shake-horizontal'); 3201 }, 0); 3202 return false; 3203 } 3204 } 3205 return true; 3206}
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.