1"use strict"; 2 3var RSIDE = { 4 block: $('.js-rside'), 5 menu: $('.js-rside-menu'), 6 sqrt: $('.js-rside-sqrt'), 7 li: $('.js-rside-li'), 8 link: $('.js-rside-link'), 9 clicker: $('.js-rside-clicker'), 10 pageMenu: $('.js-menu'), 11 closeBtn: $('.js-close-menu'), 12 content: $('.js-content-page'), 13 body: $('body'), 14 main: $('main'), 15 flag: true, 16 tmpScroll: 0, 17 scrlTop: 0, 18 hash: '', 19 init: function () { 20 RSIDE.actionsOnScroll(); 21 if (RSIDE.menu.length !== 0) { 22 RSIDE.clicker.on('click', function () { 23 if (RSIDE.block.hasClass('isRaised')) { 24 RSIDE.turn(); 25 } else { 26 RSIDE.raise(); 27 } 28 }); 29 RSIDE.sqrt.on('click', function (e) { 30 // if (checkAdaptive()) { 31 // e.preventDefault(); 32 // RSIDE.scrollingTo($(this)); 33 34 RSIDE.setSqurt($(this).data('href').replace('#', '')); 35 RSIDE.setLi($(this).parent().parent().data('section')) 36 37 // } 38 }); 39 40 RSIDE.link.on('click', function (e) { 41 if (checkAdaptive()) { 42 e.preventDefault(); 43 RSIDE.scrollingTo($(this)); 44 console.log(this) 45 console.log("this") 46 RSIDE.setLi($(this).data('href').replace('#', '')) 47 console.log($(this).data('href').replace('#', '')) 48 } 49 RSIDE.setLi($(this).parent().data('section')) 50 RSIDE.setSqurt($(this).parent().find('.r-side__underline .js-rside-sqrt:first-child').data('href').replace('#', '')); 51 console.log($(this).parent().find('.r-side__underline .js-rside-sqrt:first-child').data('href').replace('#', '')); 52 53 54 }); 55 56 // RSIDE.li.on('click', function (e) { 57 // // if (checkAdaptive()) { 58 // e.preventDefault(); 59 // RSIDE.setLi($(this).data('section')) 60 // console.log($(this).data('section')) 61 62 // // } 63 // }); 64 65 RSIDE.closeBtn.on('click', function (e) { 66 e.preventDefault(); 67 RSIDE.turn(); 68 }); 69 if (checkAdaptive()) { 70 $(document).on('scroll', function () { 71 RSIDE.scrlTop = $(document).scrollTop(); 72 RSIDE.hash = window.location.hash; 73 }); 74 } 75 } 76 }, 77 // возвÑаÑаем true, еÑли Ð½Ð°Ñ Ð¾Ð´Ð¸Ð¼ÑÑ Ð²Ð½Ð¸Ð·Ñ ÑÑÑаниÑÑ 78 checkBottom: function () { 79 if ((window.innerHeight + Math.ceil(window.pageYOffset)) >= document.body.offsetHeight) { 80 return true 81 } else { 82 return false 83 } 84 }, 85 scrollingTo: function (clickedBtn) { 86 // if (checkAdaptive()) { 87 RSIDE.flag = false; 88 setTimeout(function () { 89 RSIDE.flag = true; 90 }, 700); 91 RSIDE.showMain(); 92 93 94 RSIDE.hide(); 95 var $this = clickedBtn, 96 anchor = $this.attr('href').split('#').pop(), 97 anchorSection = $('[data-anchor="' + anchor + '"]'); 98 console.log(anchorSection); 99 RSIDE.tmpScroll = anchorSection.offset().top; 100 $('html, body').animate({scrollTop: RSIDE.tmpScroll}, 'slow'); 101 RSIDE.content.removeClass('blur'); 102 RSIDE.pageMenu.removeClass('blur'); 103 // } 104 }, 105 setSqurt: function (info) { 106 if (RSIDE.menu.length > 0) { 107 $('.js-rside-sqrt').removeClass('filled'); 108 $('.js-rside-sqrt[href="#' + info + '"]').addClass('filled'); 109 } 110 }, 111 setLi: function (sect) { 112 if (RSIDE.menu.length > 0) { 113 $('.js-rside-li').removeClass('isActive'); 114 $($('.js-rside-li[data-section="' + sect + '"]')).addClass('isActive'); 115 } 116 }, 117 show: function () { 118 if (RSIDE.block.hasClass('isActive') && RSIDE.pageMenu.hasClass('isRaised')) { 119 } else { 120 // RSIDE.pageMenu.addClass('isRaised'); 121 RSIDE.block.addClass('isActive'); 122 } 123 124 }, 125 hide: function () { 126 if (!RSIDE.block.hasClass('isActive') && !RSIDE.pageMenu.hasClass('isRaised')) { 127 } else { 128 // RSIDE.pageMenu.removeClass('isRaised'); 129 if (!RSIDE.checkBottom()) { 130 if (RSIDE.flag && RSIDE.main.is(':visible')) { 131 RSIDE.block.removeClass('isActive isRaised'); 132 } else if (!RSIDE.main.is(':hidden')) { 133 RSIDE.block.removeClass('isRaised'); 134 } 135 136 RSIDE.content.removeClass('blur'); 137 RSIDE.pageMenu.removeClass('blur'); 138 RSIDE.body.css('overflow-y', 'auto'); 139 if (!checkAdaptive()) { 140 setTimeout(function () { 141 RSIDE.pageMenu.addClass('isClose'); 142 }, 300); 143 } else { 144 RSIDE.pageMenu.addClass('isClose'); 145 } 146 } 147 } 148 }, 149 raise: function () { 150 RSIDE.block.addClass('isRaised'); 151 RSIDE.content.addClass('blur'); 152 RSIDE.pageMenu.addClass('blur'); 153 RSIDE.body.css('overflow-y', 'hidden'); 154 RSIDE.hideMain(); 155 }, 156 turn: function () { 157 RSIDE.showMain(); 158 RSIDE.block.removeClass('isRaised'); 159 RSIDE.content.removeClass('blur'); 160 RSIDE.pageMenu.removeClass('blur'); 161 RSIDE.body.css('overflow-y', 'auto'); 162 //RSIDE.menu.css('overflow-y', ''); 163 }, 164 hideMain: function () { 165 RSIDE.tmpScroll = RSIDE.scrlTop; 166 setTimeout(function () { 167 RSIDE.main.fadeOut(); 168 }, 500); 169 }, 170 showMain: function () { 171 RSIDE.main.fadeIn(); 172 setTimeout(function () { 173 $('html, body').animate({ 174 scrollTop: RSIDE.tmpScroll 175 }, 100); 176 }, 100); 177 }, 178 actionsOnScroll: function () { 179 var tempScrollTop, 180 currentScrollTop = 0; 181 $(document).scroll(function () { 182 if (RSIDE.block.length !== 0) { 183 currentScrollTop = $(window).scrollTop(); 184 if (tempScrollTop < currentScrollTop && currentScrollTop >= $(window).height()) { 185 RSIDE.show(); 186 } else if (tempScrollTop > currentScrollTop) { 187 if (RSIDE.flag) { 188 RSIDE.hide(); 189 } 190 } 191 if (currentScrollTop === 0) { 192 RSIDE.flag = true; 193 RSIDE.hide(); 194 } 195 tempScrollTop = currentScrollTop; 196 } 197 }); 198 }, 199} 200/* TODO: ÑазобÑаÑÑ PAGE */ 201var PAGE = { 202 init: function () { 203 svg4everybody(); 204 anchorsInMain.init(); 205 // this.onePageScroll(); 206 this.fp(); 207 PAGE.introScroller.on('click', function (e) { 208 e.preventDefault(); 209 var div = $(this).attr('href'); 210 PAGE.scrl(div); 211 rMenu.turn(); 212 }); 213 }, 214 body: $('body'), 215 introScroller: $('.js-intro-scroller'), 216 socials: $('#socials-share'), 217 menu: $('.js-menu'), // ÑолÑко Ð´Ð»Ñ Ð³Ð»Ð°Ð²Ð½Ð¾Ð¹ 218 fp: function () { 219 if ($('.js-page-fp').length > 0) { 220 221 // кнопка, коÑоÑÐ°Ñ Ð¼ÐµÐ½ÑÐµÑ ÑÑили на заблокиÑованном конÑенÑе 222 var leftSideBtn = $('.js-block-content-btn'); 223 224 let fp1 = $('.js-page-fp').fullpage({ 225 // animateAnchor: true, 226 // lockAnchors: false, 227 responsiveWidth: 1280, 228 responsiveHeight: 650, 229 css3: true, 230 scrollingSpeed: 1000, 231 easingcss3: 'ease-in-out', 232 // fixedElements: '#socials-share', 233 fixedElements: '.fixed-buttons-wrapper', 234 recordHistory: false, 235 // scrollOverflow 236 // navigation: true, 237 // slidesNavigation: true, 238 // dragAndMove: true, 239 // dragAndMoveKey: 'YWx2YXJvdHJpZ28uY29tX0EyMlpISmhaMEZ1WkUxdmRtVT0wWUc=',
240 // normalScrollElements: '.search, .js-custom-scroll-fp, .r-side, .indust__inner, .indust__item', 241 onLeave: function (index, nextIndex, direction) { 242 mySwipersUpdate(); 243 // $.fn.fullpage.setAllowScrolling(false); 244 245 }, 246 beforeLeave: function (origin, destination, direction, trigger) { 247 // $.fn.fullpage.setAllowScrolling(true); 248 }, 249 afterLoad: function (anchorLink, index) { 250 // поÑле ÑÐ¼ÐµÐ½Ñ Ñлайда 251 var sect = $('.section.active').data('section'), 252 $this = $(this); 253 254 setTimeout(function () { 255 checkSpace(); 256 }, 100); 257 258 function changeColorLinkInHeader(sectionID, colorDefault, colorNew) { 259 const section = document.getElementById(sectionID); 260 if (section !== null) { 261 262 if (section.classList.contains('active')) { 263 document.querySelectorAll('.header__link').forEach(link => { 264 link.style.color = colorNew; 265 }); 266 document.querySelectorAll('.menu__nav .icon').forEach(icon => { 267 icon.style.fill = colorNew; 268 }); 269 } else { 270 document.querySelectorAll('.header__link').forEach(link => { 271 link.style.color = colorDefault; 272 }); 273 document.querySelectorAll('.menu__nav .icon').forEach(icon => { 274 icon.style.fill = colorDefault; 275 }); 276 } 277 } 278 279 } 280 281 changeColorLinkInHeader('industries', '#D2D2D2', '#989898'); 282 283 284 // клаÑÑ "js-block-content" добавлÑеÑÑÑ Ðº заблокиÑованнÑм ÑекÑиÑм Ñ ÐºÐ¾Ð½ÑенÑом 285 if ($this.hasClass('js-block-content')) { 286 leftSideBtn.addClass('blocked'); 287 PAGE.socials.addClass('hide'); 288 } else { 289 leftSideBtn.removeClass('blocked'); 290 PAGE.socials.removeClass('hide'); 291 } 292 293 if ($this.hasClass('js-rating-section')) { 294 tooltip.init(); 295 } 296 297 PAGE.hideShowSocials($this, 'hero'); 298 299 MENU.setColor(); 300 RSIDE.setLi(sect); 301 302 RSIDE.setSqurt(anchorLink); 303 if (anchorsInMain.checkMainPage() && !checkAdaptive() && $(window).innerHeight() > 650) { 304 if (typeof $(this).attr('id') !== 'undefined') { 305 window.location.hash = '#' + $(this).attr('id'); 306 } else { 307 history.pushState("", document.title, window.location.pathname + window.location.search); 308 309 } 310 } 311 312 scrollToLockSection.init(window.location.hash, 'afterLoad'); 313 }, 314 afterRender: function () { 315 var anchor = window.location.hash; 316 $.fn.fullpage.setRecordHistory(false); 317 // загÑÑзка плагина 318 PAGE.hideShowSocials($('section.active'), 'hero'); 319 320 if (anchorsInMain.checkMainPage()) { 321 if (anchor === '#undefined') { 322 $.fn.fullpage.silentMoveTo(1); 323 } else { 324 $.fn.fullpage.silentMoveTo(anchorsInMain.scrollToHash()); 325 //PAGE.menu.addClass($(anchor).data('header')); 326 327 } 328 } 329 scrollToLockSection.init(anchor); 330 tooltip.showTooltip(); 331 332 if (mobileFlag.is(':visible')) { 333 $(window).on('load', function () { 334 setTimeout(function () { 335 var offset = $(anchor).offset().top - ($('.menu.js-menu').innerHeight() - 15); 336 $('body, html').animate({ 337 scrollTop: offset 338 }); 339 }); 340 }); 341 } 342 }, 343 afterResize: function () { 344 mySwipersUpdate(); 345 346 setTimeout(function () { 347 $.throttle(400, true, function () { 348 tooltip.offsetTooltips() 349 })(); 350 }, 250) 351 }, 352 353 afterResponsive: function () { 354 setTimeout(function () { 355 $.throttle(400, true, function () { 356 tooltip.offsetTooltips() 357 })(); 358 }, 250) 359 360 } 361 }); 362 // fp1.fullpage('setAllowScrolling', false, 'all'); 363 // $.fn.fullpage.setAllowScrolling(false, 'all'); 364 } 365 366 }, 367 hideShowSocials: function (activeSection, checkedClass) { 368 if (activeSection.hasClass(checkedClass)) { 369 PAGE.socials.hide(); 370 } else { 371 PAGE.socials.show(); 372 } 373 }, 374 scrl: function (div) { 375 if ($(div).length != 0) { 376 var z = $(div).offset().top; 377 } else { 378 var z = $(window).height(); 379 } 380 rMenu.flag = false;
381 382 if ($('.page').hasClass('js-page-fp')) { 383 $.fn.fullpage.moveTo(2); 384 } else { 385 $('html, body').stop(0, 0).animate({ 386 scrollTop: z - 50 387 }, 1000); 388 } 389 390 setTimeout(function () { 391 rMenu.flag = true; 392 }, 300) 393 } 394 395} 396 397var scrollToLockSection = { 398 init: function (currentAnchor) { 399 if ($('.js-block-content-menu-item').length === 0) 400 return false; 401 var anchor = currentAnchor.split('#').filter(function (item) { 402 return item; 403 })[0]; 404 405 var elemAnchors = $('[data-all-anchor]'); 406 var anchros = elemAnchors.data('all-anchor').trim().split(' '); 407 var scrollToEl = elemAnchors.data('anchor'); 408 var form = elemAnchors.find('form'); 409 var currentAction = form.attr('action').split('#'); 410 411 if (anchros.includes(anchor)) { 412 var newActionForm = currentAction.slice(0, 1); 413 newActionForm.push('#' + anchor); 414 form.attr('action', newActionForm.join('')); 415 416 $.fn.fullpage.moveTo(currentAction); //anchor); //currentAction scrollToEl 417 } 418 }, 419} 420 421var tabletFlag = $('.flag-less-1280'), 422 mobileFlag = $('.mobile-flag'); 423 424// true - Ð´Ð»Ñ Ð¿Ð»Ð°Ð½ÑеÑа и ÑелеÑона 425// false - Ð´Ð»Ñ Ð´ÐµÑкÑопа 426function checkAdaptive() { 427 if (mobileFlag.is(':visible') || tabletFlag.is(':visible')) { 428 return true; 429 } 430 if (!mobileFlag.is(':visible') || !tabletFlag.is(':visible')) { 431 return false; 432 } 433} 434 435function checkGadget() { 436 return navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) 437} 438 439function isWindows() { 440 return navigator.platform.indexOf('Win') > -1 441} 442 443var MENU = { 444 scrlTop: 0, 445 tmpScroll: 0, 446 mainSection: $('main'), 447 isInitializing: true, 448 init: function () { 449 var $btn = MENU.burger, 450 $btnClose = this.btnClose, 451 $body = $('body'), 452 $menu = MENU.menu, 453 $authBtn = this.authBtn, 454 $menuAuth = this.menuAuth, 455 $leftContent = this.leftContent, 456 $menuCol = this.menuCol; 457 $btn.on('click', function (e) { 458 if ($(this).hasClass('isActive')) { 459 MENU.close(); 460 RSIDE.content.removeClass('blur'); 461 $authBtn.removeClass('active'); 462 $menuAuth.removeClass('active').fadeOut(100); 463 $leftContent.fadeIn(400); 464 SEARCH.colSearch.fadeIn(100); 465 } else { 466 MENU.open(); 467 RSIDE.content.addClass('blur'); 468 } 469 return false; 470 }); 471 $body.find($btnClose).on('click', function (e) { 472 MENU.close(); 473 return false; 474 }); 475 $menu.on('mousewheel', function () { 476 if (!$('.flag-less-1280').is(':visible')) { 477 return false; 478 } 479 }); 480 $authBtn.on('click', function () { 481 if (MENU.isInitializing) return false; 482 $authBtn.toggleClass('active'); 483 if ($menuAuth.hasClass('active')) { 484 setTimeout(function () { 485 $menuCol.removeClass('active'); 486 $leftContent.fadeIn(400); 487 }, 100); 488 $menuAuth.fadeOut(100).removeClass('active'); 489 $menuCol.removeClass('active'); 490 if (checkAdaptive()) { 491 setTimeout(function () { 492 SEARCH.colSearch.fadeIn(100); 493 }, 100); 494 } 495 } else { 496 $leftContent.fadeOut(100); 497 $menuCol.addClass('active'); 498 $menuAuth.fadeIn(400).addClass('active'); 499 if (checkAdaptive()) { 500 SEARCH.colSearch.fadeOut(100); 501 } 502 } 503 }); 504 505 if (checkAdaptive()) { 506 $(document).on('scroll', function () { 507 MENU.scrlTop = $(document).scrollTop(); 508 }); 509 } 510 }, 511 open: function () { 512 var _this = this; 513 PAGE.body.addClass('popuped'); 514 setTimeout(function () { 515 _this.burger.addClass('isActive'); 516 }, 100); 517 _this.menu.addClass('isOpen').removeClass('isClose'); 518 _this.blured.addClass('blur'); 519 520 if (checkAdaptive()) { 521 // _this.scrollInit(); 522 _this.scrollDestroy(); 523 MENU.introLink.removeClass('isActive'); 524 MENU.tmp = MENU.scrlTop; 525 MENU.mainSection.fadeOut(); 526 } else { 527 MENU.scrollDestroy(); 528 } 529 $(window).resize(function () { 530 if (checkAdaptive()) { 531 // MENU.scrollInit(); 532 MENU.scrollDestroy(); 533 } else { 534 MENU.scrollDestroy(); 535 } 536 }); 537 }, 538 close: function () { 539 MENU.mainSection.fadeIn(100); 540 $('html, body').animate({ 541 scrollTop: MENU.tmp 542 }, 100); 543 PAGE.body.removeClass('popuped'); 544 this.blured.removeClass('blur'); 545 MENU.burger.removeClass('isActive'); 546 MENU.menu.removeClass('isOpen'); 547 SEARCH.close(); 548 if (!checkAdaptive()) { 549 setTimeout(function () { 550 MENU.menu.addClass('isClose'); 551 }, 300); 552 } else { 553 MENU.menu.addClass('isClose'); 554 } 555 }, 556 setStartColor: function () { 557 setTimeout(function () { 558 // MENU.menu.removeClass('black white mono').addClass($($('section')[0]).data('header')); 559 $(window).trigger('resize').trigger('scroll'); 560 }); 561 }, 562 setColor: function () { 563 var activeSection = $('section.active'); 564 setTimeout(function () { 565 MENU.menu.removeClass('black mobile-color white').addClass(activeSection.attr('data-header')); 566 }, 300); 567 }, 568 scrollInit: function () { 569 $('.menu__inner').mCustomScrollbar({ 570 axis: 'y', 571 theme: 'light' 572 }); 573 }, 574 scrollDestroy: function () { 575 $('.menu__inner').mCustomScrollbar('destroy'); 576 }, 577 burger: $('.js-menu-burger'), 578 menu: $('.js-menu'), 579 btnClose: $('.js-menu-close'), 580 blured: $('.js-rside'), 581 authBtn: $('.js-menu-auth-btn'), 582 menuAuth: $('.js-menu-auth'), 583 leftContent: $('.js-menu-content-left'), 584 menuCol: $('.js-menu-col'), 585 introLink: $('.js-intro-link'), 586 reset: function () { 587 // $('.js-menu-content-left').show(); 588 // setTimeout(() => { 589 // $('.js-menu-content-left').show(); 590 // }, 500) 591 } 592} 593 594var SUBMENU = { 595 btn: $('.js-submenu'), 596 submenu: $('.js-submenu-submenu'), 597 submenuList: $('.js-submenu-list'), 598 simpleLinks: $('.js-submenu-list > .menu__col-li > .menu__col-link:not(.js-submenu)'), 599 rightCol: $('.js-submenu-list').siblings('.js-submenu-right'), 600 601 open: function (div) { 602 if (div.hasClass('isShow')) { 603 SUBMENU.submenu.removeClass('isShow'); 604 } else { 605 SUBMENU.submenu.removeClass('isShow'); 606 div.addClass('isShow'); 607 } 608 }, 609 close: function () { 610 SUBMENU.submenu.removeClass('isShow'); 611 }, 612 init: function () { 613 614 var showSub = false;
615 var windowWidth = window.innerWidth; 616 617 var showSubmenu = function (el) { 618 el.css({ 619 'opacity': 1, 620 'z-index': 10 621 }); 622 }; 623 var hideSubmenu = function (el) { 624 el.css({ 625 'opacity': 0, 626 'z-index': -1 627 }); 628 }; 629 630 var allSubmenus = SUBMENU.btn.siblings('.js-submenu-submenu'); 631 hideSubmenu(allSubmenus); 632 633 // поведение ÑолÑко Ð´Ð»Ñ Ð´ÐµÑкÑопа 634 if (!checkGadget() && windowWidth > 680) { 635 SUBMENU.btn.on('mouseenter', function () { 636 var div = $(this).siblings('.js-submenu-submenu'), 637 $this = $(this); 638 639 SUBMENU.btn.removeClass('active'); 640 $this.addClass('active'); 641 642 // SUBMENU.rightCol.fadeOut(150); 643 SUBMENU.rightCol.addClass('isHide'); 644 645 hideSubmenu(SUBMENU.submenu); 646 showSub = true; 647 648 if (showSub) { 649 showSubmenu(div); 650 } else { 651 hideSubmenu(div); 652 // SUBMENU.rightCol.fadeIn(150); 653 SUBMENU.rightCol.removeClass('isHide'); 654 $this.removeClass('active'); 655 } 656 657 div.on('mouseenter', function () { 658 if (!showSub) { 659 showSubmenu($(this)); 660 } 661 }); 662 663 div.on('mouseleave', function () { 664 if (!showSub) { 665 hideSubmenu($(this)); 666 // SUBMENU.rightCol.fadeIn(150); 667 SUBMENU.rightCol.removeClass('isHide'); 668 $this.removeClass('active'); 669 } 670 }); 671 672 SUBMENU.submenuList.on('mouseleave', function () { 673 hideSubmenu(div); 674 $this.removeClass('active'); 675 // SUBMENU.rightCol.fadeIn(150); 676 SUBMENU.rightCol.removeClass('isHide'); 677 }); 678 679 680 SUBMENU.simpleLinks.on('mouseenter', function () { 681 hideSubmenu(div); 682 $this.removeClass('active'); 683 SUBMENU.rightCol.removeClass('isHide'); 684 }); 685 686 }); 687 } 688 } 689}; 690 691var SEARCH = { 692 btnOpen: $('.js-menu-search-button'), 693 btnClose: $('.js-menu-search-close'), 694 btnClear: $('.js-menu-search-clear'), 695 colSearch: $('.js-menu-search-col'), 696 searchDiv: $('.js-search'), 697 input: $('.js-search-input'), 698 inputWrap: $('.js-search-input-wrap'), 699 open: function () { 700 SEARCH.searchDiv.addClass('isSearchOpen'); 701 SEARCH.colSearch.addClass('isSearchOpen'); 702 SEARCH.input.focus(); 703 }, 704 close: function () { 705 SEARCH.searchDiv.removeClass('isSearchOpen'); 706 SEARCH.colSearch.removeClass('isSearchOpen'); 707 }, 708 init: function () { 709 SEARCH.btnOpen.on('click', function () { 710 SEARCH.open(); 711 return false; 712 }); 713 SEARCH.btnClose.on('click', function () { 714 SEARCH.close(); 715 return false; 716 }); 717 SEARCH.btnClear.on('click', function () { 718 SEARCH.clear(); 719 SEARCH.input.focus().trigger('keyup'); 720 721 return false; 722 }); 723 SEARCH.styledInput(); 724 SEARCH.inputExitByEsc(); 725 }, 726 checkEscPress: function (e) { 727 if (e.keyCode === 27) { 728 SEARCH.close(); 729 } 730 }, 731 inputExitByEsc: function () { 732 SEARCH.input.on('keyup', function (e) { 733 SEARCH.checkEscPress(e); 734 }); 735 }, 736 737 /* TODO: Ð¼Ð¾Ð¶ÐµÑ ÑÑÐ°Ð·Ñ ÑÑилизоваÑÑ ÐºÐ°Ðº акÑивнÑй ? */ 738 styledInput: function () { 739 SEARCH.input.on('focus', function () { 740 // SEARCH.inputWrap.addClass('notEmpty'); 741 }).on('blur', function () { 742 if (SEARCH.input.val() != '') { 743 SEARCH.inputWrap.addClass('notEmpty'); 744 } else { 745 SEARCH.inputWrap.removeClass('notEmpty'); 746 } 747 }).on('keyup', function () { 748 if (SEARCH.input.val() != '') { 749 SEARCH.inputWrap.addClass('notEmpty'); 750 } else { 751 SEARCH.inputWrap.removeClass('notEmpty'); 752 } 753 }); 754 }, 755 clear: function () { 756 SEARCH.input.val(''); 757 SEARCH.input.focus(); 758 } 759} 760 761var ARCH = { 762 init: function () { 763 ARCH.btn.on('click', function () { 764 if (ARCH.state) { 765 ARCH.close(); 766 } else { 767 ARCH.open(); 768 } 769 }); 770 }, 771 state: false, 772 container: $('.js-arch'), 773 btn: $('.js-arch-btn'), 774 box: $('.js-arch-box'), 775 open: function () { 776 ARCH.box.slideDown(); 777 ARCH.state = true; 778 ARCH.container.addClass('isOpen'); 779 }, 780 close: function () { 781 ARCH.box.slideUp(); 782 ARCH.state = false;
783 ARCH.container.removeClass('isOpen'); 784 } 785} 786 787var rMenu = { 788 init: function () { 789 this.offsetsMenuAdding(); 790 rMenu.actionsOnScroll(); 791 // rMenu.flagSwitcher(); 792 793 rMenu.menu.on('touchmove', function () { 794 return false; 795 }); 796 797 rMenu.clicker.on('click', function () { 798 if (rMenu.menu.hasClass('isRaised')) { 799 rMenu.turn(); 800 } else { 801 rMenu.raise(); 802 } 803 }); 804 805 rMenu.fog.on('touchstart', function () { 806 rMenu.turn(); 807 return false; 808 }).on('touchmove', function () { 809 return false; 810 }).on('click', function () { 811 rMenu.turn(); 812 return false; 813 }); 814 815 }, 816 flag: true, 817 pageMenu: $('.js-menu'), 818 menu: $('.js-raise'), 819 clicker: $('.js-raise-clicker'), 820 fog: $('.js-raise-fog'), 821 show: function () { 822 if (rMenu.menu.hasClass('isActive') && rMenu.pageMenu.hasClass('isRaised')) { 823 } else { 824 rMenu.pageMenu.addClass('isRaised'); 825 rMenu.menu.addClass('isActive no-shadow'); 826 } 827 828 }, 829 hide: function () { 830 if (!rMenu.menu.hasClass('isActive') && !rMenu.pageMenu.hasClass('isRaised')) { 831 } else { 832 rMenu.pageMenu.removeClass('isRaised'); 833 rMenu.menu.removeClass('isActive isRaised no-shadow'); 834 } 835 }, 836 raise: function () { 837 rMenu.menu.addClass('isRaised'); 838 // PAGE.body.addClass('popuped'); 839 }, 840 turn: function () { 841 rMenu.menu.removeClass('isRaised no-shadow'); 842 // PAGE.body.removeClass('popuped'); 843 }, 844 actionsOnScroll: function () { 845 var tempScrollTop, currentScrollTop = 0; 846 $(window).scroll(function () { 847 if (rMenu.menu.length != 0) { 848 currentScrollTop = $(window).scrollTop(); 849 850 851 if (tempScrollTop < currentScrollTop && currentScrollTop >= $(window).height()) { 852 rMenu.show(); 853 } else if (tempScrollTop > currentScrollTop) { 854 if (rMenu.flag == true) { 855 rMenu.hide(); 856 } 857 } 858 859 860 for (var i = 0; i <= rMenu.offsetsMenu.length; i++) { 861 if (currentScrollTop + 100 >= rMenu.offsetsMenu[i]) { 862 $('.js-raise-li').removeClass('isActive'); 863 $('.js-raise-li').eq(i).addClass('isActive'); 864 } 865 } 866 tempScrollTop = currentScrollTop; 867 } 868 }).trigger('scroll'); 869 }, 870 offsetsMenu: [], 871 offsetsMenuAdding: function () { 872 $('.js-raise-link').each(function (i) { 873 if ($($(this).attr('href')).length != 0) { 874 var $block = $($(this).attr('href')), 875 offsetTop = $block.offset().top; 876 rMenu.offsetsMenu[i] = offsetTop; 877 } 878 }) 879 }, 880 flagSwitcher: function () { 881 $('.js-raise').on('mouseenter', function () { 882 rMenu.flag = false; 883 }).on('mouseleave', function () { 884 rMenu.flag = true; 885 }); 886 } 887} 888 889var HEADER = { 890 headerColorAtScroll: [], 891 $header: $('.js-menu'), 892 //headerType: 'black', 893 headerType: '', // ÑÑÑанавливаем ÑÐ²ÐµÑ Ð¸Ð· пеÑвой ÑекÑии пÑи иниÑиализаÑии 894 $body: $(document), 895 $blocks: $('.js-menu-color'), 896 $blocksMobile: $('.js-menu-color'), 897 setHeaderType: function (scrollTop) { 898 scrollTop += 64; // 64 - оÑÑÑÑп Ð¾Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ бÑÑгеÑа до низа Ñ ÐµÐ´ÐµÑа 899 900 for (var k in HEADER.headerColorAtScroll) { 901 if (scrollTop <= HEADER.headerColorAtScroll[k].top) { 902 break; 903 } else { 904 HEADER.headerType = HEADER.headerColorAtScroll[k].color; 905 } 906 } 907 908 if (checkAdaptive() || $('body').hasClass('second-page')) { 909 if (scrollTop <= HEADER.checkScrollTop()) { 910 HEADER.headerColorAtScroll[0].top = HEADER.$blocks.eq(0).offset().top; 911 HEADER.headerColorAtScroll[0].color = HEADER.$blocks.eq(0).data('header'); 912 } else { 913 setTimeout(function () { 914 var color = HEADER.$blocks.eq(0).data('header'); 915 HEADER.headerColorAtScroll[0].top = HEADER.checkScrollTop(); 916 HEADER.headerColorAtScroll[0].color = color + ' bgWhite'; 917 }, 100); 918 } 919 } 920 HEADER.$header.removeClass('white black grey mono mobile-color bgWhite'); 921 HEADER.$header.addClass(HEADER.headerType); 922 }, 923 setHeaderTypeArr: function () { 924 for (var i = 0; i < $('.js-menu-color').length; i++) { 925 // // var $block = HEADER.$blocks.eq(i); 926 var $block = $('.js-menu-color').eq(i); 927 928 if (checkAdaptive() && i !== 0) { 929 HEADER.headerColorAtScroll[i] = { 930 top: $block.offset().top, 931 color: ($block.data('header')) ? $block.data('header') + ' bgWhite' : 'black bgWhite' 932 }; 933 } else if (checkAdaptive() && i === 0) { 934 HEADER.headerColorAtScroll[0] = { 935 top: $block.offset().top, 936 color: ($block.data('header')) ? $block.data('header') : 'black bgWhite' 937 }; 938 } else if (!checkAdaptive() && i !== 0) { 939 HEADER.headerColorAtScroll[i] = { 940 top: $block.offset().top, 941 color: ($block.data('header')) ? $block.data('header') + ' bgWhite' : 'black bgWhite' 942 }; 943 } else if (!checkAdaptive() && i === 0) { 944 HEADER.headerColorAtScroll[i] = { 945 top: $block.offset().top, 946 color: ($block.data('header')) ? $block.data('header') : 'black ' 947 }; 948 } 949 if (checkAdaptive() && i === 0) { 950 HEADER.headerColorAtScroll[0] = { 951 top: $block.offset().top, 952 color: ($block.data('header')) ? $block.data('header') : 'black bgWhite' 953 }; 954 } else if (!checkAdaptive() && i === 0) { 955 HEADER.headerColorAtScroll[i] = { 956 top: $block.offset().top, 957 color: ($block.data('header')) ? $block.data('header') : 'black ' 958 }; 959 } 960 } 961 }, 962 checkScrollTop: function () { 963 var startOffsetTop = 0; 964 var firstTextElement = function (el) { 965 if ($(el).find('.fp-tableCell').length > 0) { 966 return $(el).children().children().contents(':not(:empty)').first(); 967 } else { 968 // ÑÐ¸ÐºÑ Ð´Ð»Ñ Ð±Ð»Ð¾Ð³Ð° 969 if ($(el).parent().hasClass('js-blog')) { 970 return $(el).parent().find('.js-blog-inner').find('section').first() 971 } else { 972 return $(el).contents(':not(:empty)').first() 973 } 974 } 975 }; 976 if (HEADER && HEADER.$blocks && HEADER.$blocks[0] && firstTextElement(HEADER.$blocks[0]).offset() && firstTextElement(HEADER.$blocks[0]).offset().top) { 977 startOffsetTop = firstTextElement(HEADER.$blocks[0]).offset().top; // оÑÑÑÑп Ñ Ð¿ÐµÑвого ÑекÑÑового Ñл-Ñа на ÑÑÑаниÑе 978 } else { 979 return 980 } 981 return startOffsetTop; 982 }, 983 init: function () { 984 HEADER.headerType = $(HEADER.$blocks[0]).data('header'); 985 HEADER.setHeaderType(); 986 HEADER.setHeaderTypeArr(); 987 988 if (checkAdaptive()) { 989 HEADER.checkScrollTop(); 990 } 991 HEADER.$body.on('scroll', function () { 992 var scrollTop = $(this).scrollTop(); 993 HEADER.setHeaderType(scrollTop); 994 }); 995 }, 996} 997 998/* TODO: Ð½ÐµÑ Ð³Ð¸Ñа - ÑÑÑм ÑÑда! */ 999 1000function hideLoader() { 1001 $('#loader').fadeOut(300); 1002} 1003 1004 1005/* TODO: в PAGE или в бÐлÑÑÑÑ ÑÑнкÑиÑ? */ 1006 1007/* ___________________ SIDE ___________________ */ 1008function showSide() { 1009 var $link = $('.js-intro-link'), 1010 $side = $('.js-intro-side'), 1011 $content = $('.js-intro-content'), 1012 $menu = $('.js-menu'), 1013 $block = $('.js-intro'); 1014 1015 $content.on('mouseenter', function () { 1016 if (!tabletFlag.is(':visible')) { 1017 $block.addClass('isActive'); 1018 $menu.addClass('white'); 1019 } 1020 }) 1021 .on('mouseleave', function () { 1022 if (!tabletFlag.is(':visible')) { 1023 $block.removeClass('isActive'); 1024 $menu.removeClass('white'); 1025 } 1026 }); 1027 1028 $link.on('mouseenter ', function () { 1029 if (!tabletFlag.is(':visible')) { 1030 $side.find('.toShow').removeClass('isActive'); 1031 $(this).addClass('isActive'); 1032 $($(this).data('link')).addClass('isActive'); 1033 } 1034 1035 }) 1036 .on('mouseleave', function () { 1037 if (!tabletFlag.is(':visible')) { 1038 $(this).removeClass('isActive'); 1039 $side.find('.toShow').removeClass('isActive'); 1040 // $block.removeClass('isActive'); 1041 // $menu.removeClass('white'); 1042 } 1043 }) 1044 .on('click', function (e) { 1045 if (tabletFlag.is(':visible')) { 1046 if (!mobileFlag.is(':visible')) { 1047 e.preventDefault(); 1048 $link.removeClass('isActive'); 1049 isThis(); 1050 $side.find('.toShow').removeClass('isActive'); 1051 $(this).addClass('isActive'); 1052 $($(this).data('link')).addClass('isActive'); 1053 $block.addClass('isActive'); 1054 $menu.addClass('white').removeClass('black'); 1055 } 1056 } 1057 }); 1058} 1059 1060function isThis() { 1061 $(document).off().on('click', function (e) { // ÑобÑÑие клика по веб-докÑменÑÑ 1062 var $link = $(".js-intro-link"),
1063 $side = $('.js-intro-side'), 1064 $toShow = $('.toShow'), 1065 $menu = $('.js-menu'), 1066 $block = $('.js-intro'); 1067 if (!$link.is(e.target) && !$side.is(e.target) && !$toShow.is(e.target)) { 1068 $side.find('.toShow').removeClass('isActive'); 1069 $block.removeClass('isActive'); 1070 $menu.removeClass('white').addClass($('section.active').attr('data-header')); 1071 $link.removeClass('isActive'); 1072 } 1073 }); 1074} 1075 1076var customScroll = (function () { 1077 var settings = { 1078 axis: 'y', 1079 theme: 'light', 1080 mouseWheel: { 1081 preventDefault: false, 1082 scrollAmount: 1000, 1083 }, 1084 // documentTouchScroll: true, 1085 contentTouchScroll: true, 1086 scrollInertia: 700, 1087 alwaysShowScrollbar: 2, 1088 callbacks: { 1089 onInit: function () { 1090 1091 }, 1092 onScroll: function () { 1093 animationBlocks(); 1094 }, 1095 onTotalScroll: function () { 1096 1097 } 1098 }, 1099 1100 }; 1101 1102 // ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ Ñаймлайна на главной 1103 var setTimeSettings = function (selector) { 1104 settings['scrollInertia'] = 0; 1105 settings['mouseWheel']['scrollAmount'] = 1000; 1106 selector.mCustomScrollbar(settings); 1107 1108 if (checkAdaptive()) { 1109 selector.mCustomScrollbar('destroy'); 1110 } 1111 }; 1112 1113 return { 1114 init: function () { 1115 1116 var mainTime = $('.js-main-time'); 1117 1118 $('.js-custom-scroll').mCustomScrollbar(settings); 1119 $('.js-custom-scroll-fp').mCustomScrollbar(settings); 1120 1121 if (mainTime.length > 0) { 1122 setTimeSettings(mainTime); 1123 } 1124 }, 1125 ajaxInit: function () { 1126 $('.js-custom-scroll-ajax').mCustomScrollbar('destroy').mCustomScrollbar(settings); 1127 }, 1128 update: function () { 1129 $('.js-custom-scroll-ajax').mCustomScrollbar('update'); 1130 } 1131 } 1132}()); 1133 1134 1135/* SWIPERS */ 1136/* TODO: обÑедениÑÑ Ð² единÑй Ð¼ÐµÑ Ð°Ð½Ð¸Ð·Ð¼ , неболÑÑие ÑазлиÑÐ¸Ð½Ñ Ð² ÑелекÑоÑÐ°Ñ Ð¸ опÑиÑÑ */ 1137 1138var mySwiperExamples = null; 1139 1140function swiperExamples() { 1141 if ($('.js-swiper-example').length != 0) { 1142 mySwiperExamples = new Swiper('.js-swiper-example', { 1143 speed: 400, 1144 loop: true, 1145 pagination: '.js-swiper-examples-pagination', 1146 paginationType: 'fraction', 1147 paginationClickable: true, 1148 // preventClicks: false, 1149 // preventClicksPropagation: false, 1150 // touchMoveStopPropagation: false, 1151 // resistance: false, 1152 nextButton: $('.js-swiper-example').find('.swiper-button-next'), 1153 prevButton: $('.js-swiper-example').find('.swiper-button-prev'), 1154 autoHeight: true, 1155 breakpoints: { 1156 768: { 1157 spaceBetween: 30 1158 } 1159 } 1160 }); 1161 } 1162 1163} 1164 1165var mySwiperQuote = null; 1166 1167function swiperQuote() { 1168 if ($('.js-swiper-quote').length != 0) { 1169 mySwiperQuote = new Swiper('.js-swiper-quote', { 1170 speed: 400, 1171 loop: true, 1172 pagination: '.js-swiper-quote-pagination', 1173 paginationType: 'fraction', 1174 paginationClickable: true, 1175 nextButton: $('.js-swiper-quote').find('.swiper-button-next'), 1176 prevButton: $('.js-swiper-quote').find('.swiper-button-prev'), 1177 breakpoints: { 1178 1279: { 1179 spaceBetween: 50 1180 } 1181 } 1182 }); 1183 } 1184 1185} 1186 1187/* TODO: обÑедениÑÑ Ð² единÑй Ð¼ÐµÑ Ð°Ð½Ð¸Ð·Ð¼ , неболÑÑие ÑазлиÑÐ¸Ð½Ñ Ð² ÑелекÑоÑÐ°Ñ Ð¸ опÑиÑÑ */ 1188var mySwiperRelease = null; 1189 1190function swiperRelease() { 1191 if ($('.js-swiper-release').length != 0) { 1192 mySwiperRelease = new Swiper('.js-swiper-release', { 1193 speed: 400, 1194 loop: true, 1195 pagination: '.js-swiper-release-pagination', 1196 paginationType: 'fraction', 1197 paginationClickable: true, 1198 autoHeight: true, 1199 nextButton: $('.js-swiper-release').siblings('.swiper-button-next'), 1200 prevButton: $('.js-swiper-release').siblings('.swiper-button-prev'), 1201 spaceBetween: 30, 1202 }); 1203 } 1204 1205} 1206 1207 1208var mySwiperMedia = null; 1209 1210function swiperMedia() { 1211 if ($('.js-swiper-media').length != 0) { 1212 mySwiperMedia = new Swiper('.js-swiper-media', { 1213 speed: 400, 1214 loop: true, 1215 pagination: '.js-swiper-media-pagination', 1216 paginationType: 'fraction', 1217 paginationClickable: true, 1218 nextButton: $('.js-swiper-media-next'), 1219 prevButton: $('.js-swiper-media-prev'), 1220 slidesPerView: "1", 1221 breakpoints: { 1222 1279: { 1223 spaceBetween: 50 1224 } 1225 } 1226 }); 1227 } 1228} 1229 1230/* Ð°Ð¿Ð´ÐµÐ¹Ñ Ð²ÑÐµÑ ÑвайпеÑов */ 1231function mySwipersUpdate() { 1232 // if(mySwiperIndust){mySwiperIndust.onResize();} 1233 if (myIndust) { 1234 myIndust.onResize(); 1235 } 1236 if (mySwiperQuote) { 1237 mySwiperQuote.onResize(); 1238 } 1239 if (mySwiperMedia) { 1240 mySwiperMedia.onResize(); 1241 }
1242 // mySwiperTime.onResize(); 1243 // if(myTime) {myTime.onResize();} 1244 1245} 1246 1247/* TODO: гниÑÑие поÑÑоÑка пеÑеделаннÑÑ ÑлайдеÑов */ 1248// var mySwiperTime = null; 1249// function swiperTime() { 1250// mySwiperTime = new Swiper('.js-swiper-time', { 1251// speed: 150, 1252// loop: false, 1253// slidesPerView: '2', 1254// direction: 'vertical', 1255// autoHeight: true, 1256// mousewheelControl: true, 1257// mousewheelReleaseOnEdges: true 1258// }); 1259// } 1260var mySwiperIndust = null; 1261 1262function swiperIndust() { 1263 mySwiperIndust = new Swiper('.js-swiper-indust', { 1264 centeredSlides: true, 1265 speed: 50, 1266 loop: false, 1267 slidesPerView: 'auto', 1268 direction: 'vertical', 1269 autoHeight: true, 1270 mousewheelControl: true, 1271 mousewheelReleaseOnEdges: true, 1272 }); 1273} 1274 1275function swiperRecent() { 1276 var myRecent = new Swiper('.js-swiper-recent', { 1277 speed: 400, 1278 loop: false, 1279 pagination: '.js-swiper-recent-pagination', 1280 paginationType: 'fraction', 1281 paginationClickable: true, 1282 nextButton: $('.js-swiper-recent-next'), 1283 prevButton: $('.js-swiper-recent-prev'), 1284 slidesPerView: '2' 1285 }); 1286} 1287 1288/* ------------------- â â â -------------------- */ 1289 1290 1291/* TODO: извÑаÑÐµÐ½Ð¸Ñ Ñо ÑвайпеÑом ÑеÑиÑÑ Ð·Ð°Ð´Ð°ÑÑ Ð¾Ð´Ð½Ð¸Ð¼Ð¸ бÑейкпоинÑами не ÑдаÑÑÑÑ */ 1292/* RECENT SWIPER */ 1293var myRecent = null, 1294 myRecentFlag = true, 1295 myRecentOptions = { 1296 direction: 'horizontal', 1297 speed: 400, 1298 loop: false, 1299 pagination: '.js-swiper-recent-pagination', 1300 paginationType: 'fraction', 1301 paginationClickable: true, 1302 nextButton: $('.js-swiper-recent-next'), 1303 prevButton: $('.js-swiper-recent-prev'), 1304 slidesPerView: '2', 1305 autoHeight: false, 1306 observer: true, 1307 onSlideChangeEnd: function () { 1308 // if($('.active .js-swiper-recent').find('.swiper-slide-active').data('header') == 'mono'){ 1309 // $('.js-menu').removeClass('black white').addClass('mono'); 1310 // } else { 1311 // $('.js-menu').removeClass('mono').addClass($('.js-swiper-recent').closest($('section').data('header'))); 1312 // HEADER.setHeaderTypeArr(); 1313 // } 1314 1315 } 1316 }, 1317 myRecentOptionsMobile = { 1318 direction: 'vertical', 1319 slidesPerView: $('.js-swiper-recent').find('.swiper-slide').length, 1320 speed: 400, 1321 loop: false, 1322 pagination: '.js-swiper-recent-pagination', 1323 paginationType: 'fraction', 1324 paginationClickable: true, 1325 nextButton: $('.js-swiper-recent-next'), 1326 prevButton: $('.js-swiper-recent-prev'), 1327 } 1328; 1329 1330function myRecentInitDesktop() { 1331 myRecentDestroy(); 1332 $('.js-swiper-recent').removeClass('swiper-container-vertical swiper-container-horizontal'); 1333 if ($('.js-swiper-recent').is('.loop')) { 1334 myRecentOptions.loop = true; 1335 } 1336 myRecent = new Swiper('.js-swiper-recent', myRecentOptions); 1337 myRecent.enableTouchControl(); 1338} 1339 1340function myRecentInitMobile() { 1341 myRecentDestroy(); 1342 $('.js-swiper-recent').addClass('swiper-container-vertical'); 1343 if ($('.js-swiper-recent').is('.loop')) { 1344 myRecentOptions.loop = true; 1345 } 1346 myRecent = new Swiper('.js-swiper-recent', myRecentOptionsMobile); 1347 myRecent.disableTouchControl(); 1348} 1349 1350function myRecentDestroy() { 1351 if (myRecent) { 1352 myRecent.setWrapperTranslate('0'); 1353 myRecent.destroy(); 1354 } 1355 $('.js-swiper-recent').removeClass('swiper-container-vertical swiper-container-horizontal'); 1356} 1357 1358function myRecentResizeHandler() { 1359 if ($('.js-swiper-recent').length != 0) { 1360 if (!tabletFlag.is(':visible')) { 1361 if (myRecentFlag) { 1362 myRecentInitDesktop(); 1363 myRecentFlag = false; 1364 } 1365 } else if (tabletFlag.is(':visible')) { 1366 $('.js-swiper-recent').removeClass('swiper-container-vertical swiper-container-horizontal').addClass('swiper-container-vertical'); 1367 if (!myRecent) { 1368 myRecentInitMobile(); 1369 } 1370 if (!myRecentFlag) { 1371 myRecentInitMobile(); 1372 myRecentFlag = true; 1373 HEADER.setHeaderTypeArr(); 1374 } 1375 } 1376 } 1377 1378} 1379 1380/* END of RECENT SWIPER */ 1381 1382 1383/* TODO: извÑаÑÐµÐ½Ð¸Ñ Ñо ÑвайпеÑом ÑеÑиÑÑ Ð·Ð°Ð´Ð°ÑÑ Ð¾Ð´Ð½Ð¸Ð¼Ð¸ бÑейкпоинÑами Ð
1383½Ðµ ÑдаÑÑÑÑ */ 1384/* TIME SWIPER * 1385var myTime = null, 1386 myTimeFlag = true, 1387 myTimeOptions = { 1388 speed: 150, 1389 loop: false, 1390 slidesPerView: 2, 1391 direction: 'vertical', 1392 autoHeight: true, 1393 mousewheelControl: true, 1394 mousewheelReleaseOnEdges: true 1395 }, 1396 myTimeOptionsMobile = { 1397 speed: 150, 1398 loop: false, 1399 slidesPerView: 2, 1400 direction: 'vertical', 1401 autoHeight: true, 1402 mousewheelControl: false, 1403 mousewheelReleaseOnEdges: true 1404 } 1405; 1406 1407function myTimeInitDesktop () { 1408 myTimeDestroy(); 1409 myTime = new Swiper('.js-swiper-time', myTimeOptions); 1410 myTime.enableTouchControl(); 1411} 1412 1413function myTimeInitMobile () { 1414 myTimeDestroy(); 1415 myTime = new Swiper('.js-swiper-time', myTimeOptionsMobile); 1416 myTime.disableTouchControl(); 1417} 1418 1419function myTimeDestroy () { 1420 if(myTime){ 1421 myTime.setWrapperTranslate('0'); 1422 myTime.destroy(); 1423 } 1424} 1425 1426function myTimeResizeHandler () { 1427 if ($('.js-swiper-time').length != 0) { 1428 if (!tabletFlag.is(':visible')) { 1429 if (myTimeFlag) { 1430 myTimeInitDesktop(); 1431 myTimeFlag = false; 1432 } 1433 } else if (tabletFlag.is(':visible')) { 1434 if(!myTime){ 1435 myTimeInitMobile(); 1436 } 1437 if (!myTimeFlag) { 1438 myTimeInitMobile(); 1439 myTimeFlag = true; 1440 } 1441 } 1442 } 1443 1444} 1445* END of TIME SWIPER */ 1446 1447/* TODO: извÑаÑÐµÐ½Ð¸Ñ Ñо ÑвайпеÑом ÑеÑиÑÑ Ð·Ð°Ð´Ð°ÑÑ Ð¾Ð´Ð½Ð¸Ð¼Ð¸ бÑейкпоинÑами не ÑдаÑÑÑÑ */ 1448/* INDUST SWIPER */ 1449var myIndust = null, 1450 myIndustFlag = true, 1451 myIndustOptions = { 1452 centeredSlides: true, 1453 speed: 50, 1454 loop: false, 1455 slidesPerView: 'auto', 1456 direction: 'vertical', 1457 autoHeight: true, 1458 mousewheelControl: true, 1459 mousewheelReleaseOnEdges: true 1460 }, 1461 myIndustOptionsMobile = { 1462 centeredSlides: false, 1463 speed: 50, 1464 loop: false, 1465 slidesPerView: 'auto', 1466 direction: 'vertical', 1467 autoHeight: true, 1468 mousewheelControl: false, 1469 mousewheelReleaseOnEdges: true, 1470 1471 } 1472; 1473 1474function myIndustInitDesktop() { 1475 myIndustDestroy(); 1476 myIndust = new Swiper('.js-swiper-indust', myIndustOptions); 1477 myIndust.enableTouchControl(); 1478} 1479 1480function myIndustInitMobile() { 1481 myIndustDestroy(); 1482 myIndust = new Swiper('.js-swiper-indust', myIndustOptionsMobile); 1483 myIndust.disableTouchControl(); 1484} 1485 1486function myIndustDestroy() { 1487 if (myIndust) { 1488 myIndust.setWrapperTranslate('0'); 1489 myIndust.destroy(); 1490 } 1491} 1492 1493function myIndustResizeHandler() { 1494 if ($('.js-swiper-indust').length != 0) { 1495 if (!tabletFlag.is(':visible')) { 1496 if (myIndustFlag) { 1497 myIndustInitDesktop(); 1498 myIndustFlag = false; 1499 } 1500 } else if (tabletFlag.is(':visible')) { 1501 if (!myIndust) { 1502 myIndustInitMobile(); 1503 } 1504 if (!myIndustFlag) { 1505 myIndustInitMobile(); 1506 myIndustFlag = true; 1507 } 1508 } 1509 } 1510 1511} 1512 1513/* END of INDUST SWIPER */ 1514 1515var mySwiperPreview = null; 1516 1517function swiperPreview() { 1518 if ($('.js-swiper-preview').length != 0 && $('.js-swiper-preview').is(':visible')) { 1519 mySwiperPreview = new Swiper('.js-swiper-preview', { 1520 speed: 400, 1521 loop: true, 1522 slidesPerView: 1, 1523 // wrapperClass: 'preview__row', 1524 // slideClass: 'preview__item', 1525 pagination: '.js-swiper-preview-pagination', 1526 paginationType: 'fraction', 1527 // paginationClickable: true, 1528 // nextButton: $('.js-swiper-quote').find('.swiper-button-next'), 1529 // prevButton: $('.js-swiper-quote').find('.swiper-button-prev'), 1530 breakpoints: { 1531 749: { 1532 spaceBetween: 50 1533 } 1534 } 1535 }); 1536 } 1537} 1538 1539swiperPreview(); 1540 1541 1542function myAlert() { 1543 $('body').on('click', '.alert', function () { 1544 alert('alert!'); 1545 }); 1546} 1547 1548 1549var list = []; 1550 1551/* _________________________ ANIMATION _________________________ */ 1552function animationBlocks() { 1553 var topNumb = null, 1554 botNumb = null, 1555 topNumbIndust = null, 1556 botNumbIndust = null; 1557 $('.js-animated-block').each(function (idx, el) { 1558 topNumb = $(window).scrollTop() + ($(window).height() / 3) + ($(el).outerHeight() / 2); 1559 botNumb = $(window).scrollTop() + ($(window).height() / 3) - ($(el).outerHeight() / 2); 1560 if (topNumb >= $(el).offset().top && botNumb < $(el).offset().top || idx === 0) { 1561 $(el).addClass('animated'); 1562 } else { 1563 $(el).removeClass('animated'); 1564 } 1565 }); 1566 1567 var winScroll = $(window).scrollTop() + ($(window).height() / 3); 1568 $('.js-animated-indust').each(function (idx, el) { 1569 topNumbIndust = winScroll + ($(el).outerHeight() / 2); 1570 botNumbIndust = winScroll - ($(el).outerHeight() / 2); 1571 1572 if (topNumbIndust >= $(el).offset().top && botNumbIndust <= $(el).offset().top) { 1573 $(this).addClass('animated'); 1574 } else { 1575 $(this).removeClass('animated'); 1576 } 1577 }); 1578 1579 if ($('.js-animated-indust').length != 0 && $($('.js-animated-indust')[0]).offset().top >= topNumbIndust) { 1580 $($('.js-animated-indust')[0]).addClass('animated'); 1581 } 1582 1583} 1584 1585var mwAnimations = { 1586 init: function () { 1587 if ($('.js-animated-block').length != 0 && tabletFlag.is(':visible') || $('.js-animated-block').length != 0 && $('.js-ctime').length != 0) { 1588 animationBlocks(); 1589 $(window).scroll(function () { 1590 animationBlocks(); 1591 }); 1592 } 1593 1594 animationBlocks(); 1595 } 1596} 1597mwAnimations.init(); 1598 1599 1600/* FORMS*/ 1601/*************/
1602/* inputs and textareas actions */ 1603var field = { 1604 init: function () { 1605 var _field = $('.js-field input, .js-field textarea'); 1606 _field.each(function () { 1607 var _this = $(this); 1608 if (_this.val() != '') { 1609 _this.parents('.js-field').addClass('focus notNull'); 1610 } 1611 }); 1612 $(document).on('focus', '.js-field input, .js-field textarea', function () { 1613 var _this = $(this), 1614 fieldWrap = _this.parent('.js-field'); 1615 1616 fieldWrap.addClass('focus'); 1617 1618 if (fieldWrap.hasClass('focus notNull')) { 1619 fieldWrap.removeClass('notNull'); 1620 } 1621 }); 1622 $(document).on('blur', '.js-field input, .js-field textarea', function () { 1623 var _this = $(this); 1624 if (_this.val() === '') { 1625 _this.parent().removeClass('focus notNull'); 1626 } else { 1627 _this.parent().addClass('notNull'); 1628 } 1629 }); 1630 }, 1631 load: function () { 1632 // ÑеÑÑ ÑикÑа Ñ Ð½Ð°Ð»Ð¾Ð¶ÐµÐ½Ð¸ÐµÐ¼ авÑоподÑÑановки повеÑÑ Ð»ÐµÐ¹Ð±Ð»Ð° 1633 1634 $.each($('.js-field input, .js-field textarea'), function (i, el) { 1635 if ($(el).attr('readonly')) { 1636 $(el).attr('shouldbereadonly', 'true'); 1637 } else { 1638 $(el).attr('readonly', 'readonly'); 1639 } 1640 }); 1641 1642 setTimeout(function () { 1643 $.each($('.js-field input, .js-field textarea'), function (i, el) { 1644 if (!$(el).attr('shouldbereadonly')) { 1645 $(el).attr('readonly', null); 1646 } 1647 }); 1648 1649 }, 500); 1650 } 1651}; 1652 1653field.init(); 1654 1655var psw = { 1656 init: function () { 1657 var eye = $('.js-psw-switch'), 1658 who = null; 1659 1660 eye.on('click', function (e) { 1661 e.preventDefault(); 1662 who = $(this).siblings('input'); 1663 psw.switch(who); 1664 }) 1665 }, 1666 switch: function (who) { 1667 if (who.attr('type') == 'password') { 1668 who.attr('type', 'text') 1669 } else if (who.attr('type') == 'text') { 1670 who.attr('type', 'password') 1671 } 1672 } 1673} 1674psw.init(); 1675 1676/* init select2 */ 1677var select = { 1678 // поведение пÑи оÑкÑÑÑии и закÑÑÑии анимиÑовал в иÑÑ Ð¾Ð´Ð½Ð¸ÐºÐ°Ñ Ð¿Ð»Ð°Ð³Ð¸Ð½Ð° в меÑÐ¾Ð´Ð°Ñ : 1679 // AttachBody.prototype._showDropdown 1680 // AttachBody.prototype._hideDropdown 1681 // Ð¿Ð¾Ð»Ð½Ð°Ñ Ð²ÐµÑÑÐ¸Ñ Ð¿Ð»Ð°Ð³Ð¸Ð½Ð° Ð»ÐµÐ¶Ð¸Ñ Ð½Ð° ÑеÑваке 1682 select: $('.js-select'), 1683 settings: { 1684 theme: 'dark', 1685 minimumResultsForSearch: Infinity, 1686 width: '300px', 1687 1688 }, 1689 1690 init: function () { 1691 var _this = this, 1692 $s = $(_this.select); 1693 if ($('.js-select').length > 0) { 1694 $s.each(function (i) { 1695 var currentSelect = $(this), 1696 theme = currentSelect.data('theme'); 1697 1698 if (theme == undefined) { 1699 theme = 'default' 1700 } 1701 select.settings['theme'] = theme; 1702 currentSelect.select2(select.settings); 1703 1704 select.removeTitle(); 1705 currentSelect.on('change', function () { 1706 select.removeTitle(); 1707 }); 1708 }); 1709 1710 } 1711 }, 1712 removeTitle: function () { 1713 $('.select2-selection__rendered').removeAttr('title'); 1714 } 1715} 1716select.init(); 1717 1718 1719var validation = { 1720 init: function () { 1721 1722 $.validator.messages = { 1723 required: '', // ÑбиÑаем ÑообÑÐµÐ½Ð¸Ñ "ÑÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ", Ñ.к. на неболÑÑÐ¸Ñ ÑкÑÐ°Ð½Ð°Ñ Ð·Ð°Ð½Ð¸Ð¼Ð°ÑÑ Ð¼Ð½Ð¾Ð³Ð¾ меÑÑа 1724 email: 'ÐведиÑе пÑавилÑнÑй e-mail адÑеÑ', 1725 1726 }; 1727 1728 $('form').not('.js-subscribe-form').each(function () { 1729 var chkError = function () { 1730 return $(this).find('.js-back-error').length > 0 1731 }; 1732 validation.addons();
1733 $(this).validate({ 1734 onfocusout: chkError, 1735 highlight: function (element) { 1736 var wrap = $(element).closest('.js-field-title'); 1737 $(element).parent().addClass("error"); 1738 1739 if (wrap.length > 0) { 1740 wrap.addClass('error'); // Ð´Ð»Ñ ÐºÐ°Ð¿Ñи 1741 } 1742 }, 1743 unhighlight: function (element) { 1744 var wrap = $(element).closest('.js-field-title'); 1745 $(element).parent().removeClass("error"); 1746 1747 if (wrap.length > 0) { 1748 wrap.removeClass('error'); // Ð´Ð»Ñ ÐºÐ°Ð¿Ñи 1749 } 1750 }, 1751 errorPlacement: function (error, element) { 1752 error.insertAfter($(element).parent()); 1753 }, 1754 rules: { 1755 NEW_PASSWORD: { 1756 required: true, 1757 minlength: 7 1758 }, 1759 NEW_PASSWORD_CONFIRM: { 1760 required: true, 1761 minlength: 7, 1762 equalTo: "#field-new-password" 1763 }, 1764 'REGISTER\[NAME\]': { 1765 wordCount: [2], // минималÑное кол-во Ñлов 1766 required: true, 1767 }, 1768 NAME: { 1769 wordCount: [2], // минималÑное кол-во Ñлов 1770 required: true, 1771 }, 1772 // 'REGISTER[EMAIL]': { 1773 // required: true, 1774 // customEmail: true 1775 // }, 1776 // 'EMAIL': { 1777 // required: true, 1778 // customEmail: true 1779 // }, 1780 }, 1781 messages: { 1782 NEW_PASSWORD: { 1783 required: "ÐÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ", 1784 minlength: "ÐаÑÐ¾Ð»Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ ÑодеÑжаÑÑ Ð±Ð¾Ð»ÑÑе 6 Ñимволов" 1785 }, 1786 NEW_PASSWORD_CONFIRM: { 1787 required: "ÐÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ", 1788 minlength: "ÐаÑÐ¾Ð»Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ ÑодеÑжаÑÑ Ð±Ð¾Ð»ÑÑе 6 Ñимволов", 1789 equalTo: "ÐведеннÑе паÑоли не ÑовпадаÑÑ" 1790 }, 1791 // 'REGISTER[EMAIL]': { 1792 // required: 'ÐÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ', 1793 // customEmail: 'E-mail должен бÑÑÑ Ð½Ð° ÑоÑÑийÑком домене (â 406-Ð¤Ð Ð¾Ñ 31.07.2023)' 1794 // }, 1795 // 'EMAIL': { 1796 // required: 'ÐÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ', 1797 // customEmail: 'E-mail должен бÑÑÑ Ð½Ð° ÑоÑÑийÑком домене (â 406-Ð¤Ð Ð¾Ñ 31.07.2023)' 1798 // }, 1799 }, 1800 submitHandler: function (form, event) { 1801 const {skipGlobalSubmitHandler} = event.target.dataset; 1802 1803 if (skipGlobalSubmitHandler) { 1804 return; 1805 } 1806 1807 event.preventDefault(); 1808 const goal = form.querySelector('input[name="goal"]')?.value.trim(); 1809 1810 if (goal) { 1811 Goal.triggerGoalCallback(goal, true, {form: form}); 1812 } 1813 1814 form.submit(); 1815 } 1816 }); 1817 }); 1818 $.validator.addMethod('wordCount', 1819 function (value, element, params) { 1820 var saveBtn = $(element).closest('form').find('.js-personal-data-save'); 1821 var count = validation.getWordCount(value); 1822 if (count >= params[0]) { 1823 saveBtn.attr('disabled', false); 1824 return true; 1825 } else { 1826 saveBtn.attr('disabled', true); 1827 } 1828 }, 1829 $.validator.format('ÐведиÑе полноÑÑÑÑ Ð¸Ð¼Ñ Ð¸ ÑамилиÑ') 1830 ); 1831 1832 $.validator.addMethod('customEmail', function (value, element) { 1833 //const domainRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.(ru|su|ÑÑ|деÑи|моÑква|онлайн|оÑг|ÑайÑ)$/; 1834 const domainRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.(?!com$)[a-zA-Z]{2,}$/; 1835 return this.optional(element) || domainRegex.test(value); 1836 }); 1837 }, 1838 addons: function () { 1839 $.extend($.validator.messages, { 1840 required: "ÐÑо поле обÑзаÑелÑно Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ", 1841 email: "ÐведиÑе коÑÑекÑнÑй E-mail", 1842 accept: "Please enter a value with a valid extension.",
1843 maxlength: jQuery.validator.format("ÐÑжно менÑÑе {0} Ñимволов."), 1844 minlength: jQuery.validator.format("ÐÑжно болÑÑе {0} Ñимволов."), 1845 1846 max: jQuery.validator.format("Please enter a value less than or equal to {0}."), 1847 min: jQuery.validator.format("Please enter a value greater than or equal to {0}.") 1848 }); 1849 $.validator.methods.email = function (value, element) { 1850 return this.optional(element) || /[a-zA-Z0-9]+@[a-zA-Z0-9-]+\.[a-zA-Z]+/.test(value); 1851 }; 1852 }, 1853 getWordCount: function (wordString) { 1854 var words = wordString.split(' '); 1855 words = words.filter(function (words) { 1856 return words.length > 0 1857 }).length; 1858 return words; 1859 }, 1860} 1861 1862var phoneMask = (function () { 1863 var keys = [], 1864 lastEntry = 0, 1865 seq = '8,8'; 1866 1867 // fix for IE 1868 var _templateObject = _taggedTemplateLiteral(['d*'], ['\\d*']); 1869 1870 function _taggedTemplateLiteral(strings, raw) { 1871 return Object.freeze(Object.defineProperties(strings, {raw: {value: Object.freeze(raw)}})); 1872 } 1873 1874 return { 1875 init: function () { 1876 var $input = $('.js-phone, input[name="phone"]'); 1877 1878 // $input.inputmask({ 1879 // mask: '+7 (999) 999-99-99', 1880 // showMaskOnHover: false 1881 // }); 1882 $input.inputmask({alias: "phone", "clearIncomplete": true, showMaskOnHover: false}); 1883 1884 $input.on('keydown', function (e) { 1885 phoneMask.checkKeyCode(e, $(this)); 1886 }); 1887 }, 1888 checkKeyCode: function (e, el) { 1889 if (e.keyCode === 8 && el.val() === '') { 1890 keys.push(e.which); 1891 if (keys.toString().indexOf(seq) !== -1) { 1892 if (e.timeStamp - lastEntry <= 1000) { 1893 el.attr('type', 'tel').val('').inputmask({mask: '', regex: String.raw(_templateObject)}); 1894 } 1895 } 1896 lastEntry = e.timeStamp; 1897 } 1898 } 1899 } 1900}()); 1901 1902 1903var tableType = (function () { 1904 var tTable = $('.js-t-table'), 1905 cols = $('.js-only-col'), 1906 tableType = $('.js-t-table-type'), 1907 tableRow = $('.js-only-cols'), 1908 lastRow = $('.js-t-table-row-last'); 1909 return { 1910 init: function () { 1911 if ($('.flag-less-1280').is(":visible")) { 1912 1913 cols.each(function () { 1914 $(this).css('height', tTable.innerHeight() - lastRow.innerHeight()); 1915 }); 1916 1917 cols.on('click', function (e) { 1918 tableType.removeClass('isActive'); 1919 $(this).parent().parent('.js-t-table-type').addClass('isActive'); 1920 1921 var setNumber = $(this).parent().parent().index(); 1922 1923 tableRow.each(function () { 1924 $(this).children(cols).removeClass('isActive') 1925 .eq(setNumber).addClass('isActive'); 1926 }); 1927 }); 1928 } 1929 } 1930 } 1931 1932}()); 1933 1934var onlySwitcher = { 1935 init: function () { 1936 var switcher = $('.js-only-switcher'), 1937 tab = $('.js-only-tab'); 1938 switcher.on('click', function (e) { 1939 1940 e.preventDefault(); 1941 var $this = $(this); 1942 const formWrapper = $this.closest('.only__form'); 1943 const loginModal = document.querySelector(".motivation-login-modal"); 1944 formWrapper.removeClass('only-1 only-2'); 1945 const $registrationMessage = formWrapper.find('[data-id="registration-message"]'); 1946 const localSwitchers = formWrapper.find('.js-only-switcher'); 1947 const localTabs = formWrapper.find('.js-only-tab'); 1948 1949 console.log($this.attr('href'), "$this"); 1950 1951 if (loginModal) { 1952 loginModal.classList.remove('motivationonly-1'); 1953 loginModal.classList.remove('motivationonly-2'); 1954 loginModal.classList.add($this.attr('href').replace('#', '')); 1955 } 1956 1957 if ($this.attr('href') === "#only-2") { 1958 $registrationMessage.addClass('hide'); 1959 } else { 1960 $registrationMessage.removeClass('hide'); 1961 } 1962 1963 formWrapper.addClass($this.attr('href').replace(/.*(only-1|only-2).*/, "$1")); 1964 localSwitchers.removeClass('isActive'); 1965 localTabs.removeClass('isActive'); 1966 $this.addClass('isActive'); 1967 1968 // $($this.attr('href')).addClass('isActive'); 1969 formWrapper.find($this.attr('href')).addClass('isActive'); 1970 }); 1971 } 1972}; 1973onlySwitcher.init(); 1974 1975var BRAISE = { 1976 block: $('.js-braise'), 1977 menu: $('.js-braise-menu'), 1978 sqrt: $('.js-braise-sqrt'), 1979 li: $('.js-braise-li'), 1980 link: $('.js-braise-link'), 1981 clicker: $('.js-braise-clicker'), 1982 pageMenu: $('.js-menu'), 1983 headerSelected: $('.js-braise-header-selected'), 1984 bodySelected: $('.js-braise-body-selected'), 1985 1986 headerTags: $('.js-braise-header-tags'), 1987 bodyTag: $('.js-braise-body-tag'), 1988 blogTag: $('.js-blog-tag'), 1989 mainSelect: $('.js-select'), 1990 flag: true, 1991 select: $('.js-select'), 1992 main: $('main'), 1993 tmpScroll: 0, 1994 scrlTop: 0, 1995 init: function () { 1996 // ajax и обновление ÑÑгов/ÑелекÑа 1997 // вÑнеÑÐµÐ½Ñ Ð² /local/templates/.default/components/bitrix/news/blog/defa/catalog.filter/.default/script.js 1998 BRAISE.actionsOnScroll(); 1999 2000 if (BRAISE.clicker.length > 0) { 2001 BRAISE.clicker.on('click', function () { 2002 if (BRAISE.block.hasClass('isRaised')) { 2003 BRAISE.turn(); 2004 } else { 2005 BRAISE.raise(); 2006 } 2007 }); 2008 } 2009 if (checkAdaptive()) { 2010 $(document).on('scroll', function () { 2011 BRAISE.scrlTop = $(document).scrollTop(); 2012 }); 2013 } 2014 2015 // BRAISE.bodyTag.on('click', 'label', function (e) { 2016 // if ($(this).siblings('input').prop('checked')) { 2017 // BRAISE.addTag($(this).text()); 2018 // } else { 2019 // BRAISE.removeTag($(this).text()) 2020 // } 2021 // 2022 // }); 2023 }, 2024 setSqurt: function (info) { 2025 if (BRAISE.menu.length != 0) { 2026 $('.js-braise-sqrt').removeClass('filled'); 2027 $('.js-braise-sqrt[href="#' + info + '"]').addClass('filled'); 2028 } 2029 },
2030 setLi: function (sect) { 2031 if (BRAISE.menu.length != 0) { 2032 BRAISE.li.removeClass('isActive'); 2033 $($('.js-braise-li[data-section="' + sect + '"]')).addClass('isActive'); 2034 } 2035 }, 2036 show: function () { 2037 if (BRAISE.block.hasClass('isActive') || BRAISE.pageMenu.hasClass('isOpen')) { 2038 } else { 2039 BRAISE.block.addClass('isActive'); 2040 } 2041 }, 2042 hide: function () { 2043 if (!BRAISE.block.hasClass('isActive') && !BRAISE.pageMenu.hasClass('isOpen')) { 2044 } else { 2045 BRAISE.block.removeClass('isActive isRaised'); 2046 } 2047 }, 2048 raise: function () { 2049 BRAISE.block.addClass('isRaised'); 2050 PAGE.body.addClass('popuped'); 2051 // setTimeout(function () { 2052 BRAISE.hideMain(); 2053 // }, 200); 2054 }, 2055 turn: function () { 2056 BRAISE.showMain(); 2057 BRAISE.block.removeClass('isRaised'); 2058 PAGE.body.removeClass('popuped'); 2059 }, 2060 showMain: function () { 2061 BRAISE.main.show(); 2062 setTimeout(function () { 2063 $('html, body').animate({ 2064 scrollTop: BRAISE.tmp 2065 }, 100); 2066 }, 100); 2067 2068 }, 2069 hideMain: function () { 2070 BRAISE.tmp = BRAISE.scrlTop; 2071 // setTimeout(function () { 2072 BRAISE.main.hide(); 2073 // }, 200); 2074 }, 2075 closeSelect: function () { 2076 BRAISE.select.select2('close'); 2077 }, 2078 actionsOnScroll: function () { 2079 var tempScrollTop, currentScrollTop = 0; 2080 $(window).scroll(function () { 2081 if (BRAISE.block.length != 0) { 2082 currentScrollTop = $(window).scrollTop(); 2083 if (tempScrollTop < currentScrollTop && currentScrollTop >= $('.js-braise-point').offset().top) { 2084 BRAISE.show(); 2085 BRAISE.closeSelect(); 2086 } else if (tempScrollTop > currentScrollTop && BRAISE.main.is(':visible')) { 2087 if (BRAISE.flag) { 2088 BRAISE.hide(); 2089 } 2090 } 2091 tempScrollTop = currentScrollTop; 2092 } 2093 }).trigger('scroll'); 2094 } 2095} 2096 2097BRAISE.init(); 2098 2099 2100if ($('#map').length != 0) { 2101 // google.maps.event.addDomListener(window, 'load', initMap); 2102 ymaps.ready(init); 2103} 2104 2105function init() { 2106 var myMap = new ymaps.Map('map', { 2107 center: [55.801284, 37.584129], 2108 zoom: 18, 2109 controls: (checkAdaptive() && checkGadget()) ? ['zoomControl'] : [] 2110 } 2111 ); 2112 var myPlacemark = new ymaps.Placemark([55.801284, 37.584129], {}); 2113 if (checkAdaptive() && checkGadget()) { 2114 myMap.behaviors.disable('scrollZoom'); 2115 // myMap.behaviors.disable('drag'); 2116 myMap.behaviors.disable('MultiTouch'); 2117 } 2118 myMap.geoObjects.add(myPlacemark); 2119} 2120 2121 2122var galleryTop = null, 2123 galleryThumbs = null; 2124 2125var swiperWithThumbs = { 2126 2127 init: function () { 2128 if ($('.flag-less-1280').length != 0) { 2129 if ($('.flag-less-1280').is(":visible")) { 2130 var galleryThumbs = new Swiper('.js-swiper-thumbs-bottom', { 2131 slidesPerView: 6, 2132 touchRatio: 0.2, 2133 autoHeight: false, 2134 normalizeSlideIndex: true, 2135 slideToClickedSlide: true, 2136 observer: true, 2137 updateTranslate: true, 2138 breakpoints: { 2139 1280: { 2140 slidesPerView: 'auto' 2141 } 2142 } 2143 }); 2144 } else { 2145 galleryThumbs = null; 2146 } 2147 galleryTop = new Swiper('.js-swiper-thumbs-top', { 2148 autoHeight: false, 2149 initialSlide: 0, 2150 onInit: function () { 2151 swiperWithThumbs.setActiveThumb(0); 2152 }, 2153 onSlideChangeEnd: function () { 2154 swiperWithThumbs.setActiveThumb(galleryTop.activeIndex); 2155 } 2156 }); 2157 2158 $('.js-gallery-thumb-slide').on('click', function () { 2159 swiperWithThumbs.setActiveTopSlide($(this).index()); 2160 }); 2161 2162 } 2163 }, 2164 setActiveThumb: function (idx) { 2165 $('.js-gallery-thumb-slide').removeClass('isActive'); 2166 $('.js-gallery-thumb-slide').eq(idx).addClass('isActive') 2167 }, 2168 setActiveTopSlide: function (idx) { 2169 galleryTop.slideTo(idx); 2170 } 2171 2172} 2173 2174swiperWithThumbs.init(); 2175 2176 2177var swiperClients = new Swiper('.js-swiper-clients', { 2178 speed: 400, 2179 autoHeight: false, 2180 centeredSlides: true, 2181 prevButton: '.js-swiper-clients-prev', 2182 nextButton: '.js-swiper-clients-next', 2183}); 2184var showMsg = false;
2185var MSG = { 2186 div: $('.js-msg'), 2187 text: $('.js-msg-text'), 2188 tmt: null, 2189 show: function (text, mini, hideTimeout, showCloseButton) { 2190 // $('.js-subscribe-lk').prop('disabled', true); 2191 // $('.checkbox__in').addClass('disabled'); 2192 //$(document).find('.js-msg').remove(); 2193 if (mini) { 2194 var g = '<div class="msg msg-mini js-msg"><div class="msg__text js-msg-text">' + text + '</div></div>'; 2195 } else if (showCloseButton) { 2196 var g = '<div class="msg js-msg"> <button class="msg-close"></button> <div class="msg__text js-msg-text">' + text + '</div></div>'; 2197 } else { 2198 var g = '<div class="msg js-msg"><div class="msg__text js-msg-text">' + text + '</div></div>'; 2199 } 2200 $('body').append(g); 2201 setTimeout(function () { 2202 $(document).find('.js-msg').eq(0).addClass('isVisible'); 2203 }, 100); 2204 // MSG.div.addClass('isVisible'); 2205 // MSG.text.text(text); 2206 const params = (new URL(document.location)).searchParams; 2207 const longMessage = params.get("long_message"); 2208 2209 if (longMessage === 'Y') { 2210 hideTimeout = 100000000; 2211 } else { 2212 hideTimeout = hideTimeout ? hideTimeout : 30000; 2213 } 2214 2215 if (!showCloseButton) { 2216 setTimeout(function () { 2217 // $('.js-subscribe-lk').prop('disabled', false); 2218 // $('.checkbox__in').removeClass('disabled'); 2219 MSG.hide(); 2220 }, hideTimeout); 2221 } 2222 $('.msg-close').on('click', () => MSG.hide()); 2223 2224 }, 2225 hide: function () { 2226 clearTimeout(MSG.tmt); 2227 $(document).find('.js-msg').removeClass('isVisible'); 2228 MSG.tmt = setTimeout(function () { 2229 $(document).find('.js-msg').remove(); 2230 showMsg = false; 2231 }, 500) 2232 } 2233}; 2234var randomColor = (function () { 2235 // ÑдалÑем ÑÐ²ÐµÑ Ð´Ð»Ñ ÐºÐ¾Ð½ÐºÑеÑного ÑлайдеÑа 2236 // по дизайнÑ, ÑвеÑа пÑиÑваиваÑÑÑÑ Ñандомно из ÑвеÑовой паллиÑÑÑ markswebb 2237 2238 var colors = ['yellowlight', 'blue', 'grey', 'lightblue', 'orange', 'red', 'purple']; 2239 2240 var removeColor = function (color) { 2241 var copyArr = []; 2242 if (typeof color === "undefined") { 2243 return colors; 2244 } 2245 if (Array.isArray(color)) { 2246 copyArr = JSON.parse(JSON.stringify(colors)); 2247 for (var i = 0; i < color.length; i++) { 2248 copyArr.splice(copyArr.indexOf(color[i]), 1); 2249 } 2250 return copyArr; 2251 } else { 2252 copyArr = JSON.parse(JSON.stringify(colors)); 2253 copyArr.splice(copyArr.indexOf(color), 1); 2254 return copyArr; 2255 } 2256 }; 2257 var addRandomClass = function (slides, color) { 2258 var arrColors = removeColor(color), 2259 current = 0; 2260 slides.each(function (i, e) { 2261 if (current >= arrColors.length) { 2262 current = 0; 2263 } 2264 $(this).addClass(arrColors[current]); 2265 current++; 2266 }); 2267 }; 2268 return { 2269 init: function (slides, color) { 2270 addRandomClass(slides, color); 2271 } 2272 } 2273}()); 2274 2275var schemeSlider = (function () { 2276 return { 2277 init: function (color, nav, items) { 2278 var schemeWrap = '.js-scheme'; 2279 randomColor.init(items, color); 2280 randomColor.init(nav, color); 2281 2282 nav.each(function () { 2283 var $this = $(this), 2284 itemsInBlock = $this.parent().siblings(items); 2285 2286 if ($this.hasClass('active')) { 2287 itemsInBlock.eq($this.index()).stop(0, 1).fadeIn(800); 2288 } 2289 }); 2290 2291 nav.on('mouseenter', function () { 2292 var $this = $(this), 2293 itemsInBlock = $this.parent().siblings(items); 2294 2295 if (!$this.hasClass('active')) { 2296 2297 $this.closest(schemeWrap).find(nav).removeClass('active'); 2298 itemsInBlock.stop(0, 1).fadeOut(0); 2299 $this.addClass('active'); 2300 itemsInBlock.eq($this.index()).stop(0, 1).fadeIn(800); 2301 } 2302 }); 2303 if (nav.hasClass('active')) { 2304 nav.parent().siblings(items).eq(nav.index()).stop(0, 1).fadeIn(800); 2305 } 2306 } 2307 } 2308}()); 2309 2310var socials = (function () { 2311 var $container = $('.js-socials'), 2312 $toogleBtn = $container.find('.js-socials-toggle'), 2313 $socialsBtn = $container.find('.socials__btn'), 2314 copyUrlBtn = $container.find('.js-copy-url'), 2315 topBtnMargin = parseInt($container.find('.socials__btn:first-of-type').css('margin-top')), 2316 $input = $container.find('.js-inp-url')[0], 2317 // desktopBtnHeight = 52, // вÑÑоÑа кнопки "оÑкÑÑÑÑ" 2318 // mobileBtnHeight = 63; 2319 2320 desktopBtnHeight = 50, // вÑÑоÑа кнопки "оÑкÑÑÑÑ" 2321 mobileBtnHeight = 50; 2322 2323 function autoHeightSocials() { 2324 var count = 0; 2325 $socialsBtn.each(function () { 2326 count++; 2327 }); 2328 // Ñ.к. пеÑеÑÑиÑÑваем Ð´Ð»Ñ ÐТÐРЫТÐÐРблока 2329 return count * mobileBtnHeight + topBtnMargin; 2330 } 2331 2332 function toggleSocials() { 2333 if ($container.hasClass('active')) { 2334 if (checkAdaptive()) { 2335 $container.removeClass('active').css('height', mobileBtnHeight) 2336 } else { 2337 $container.removeClass('active').css('height', desktopBtnHeight) 2338 } 2339 } else { 2340 $container.addClass('active').css('height', autoHeightSocials()); 2341 } 2342 } 2343 2344 return { 2345 init: function () { 2346 $toogleBtn.on('click', function (e) { 2347 e.preventDefault(); 2348 toggleSocials(); 2349 }); 2350 copyUrlBtn.on('click', function () { 2351 $input.value = document.location.href; 2352 if (navigator.clipboard) { 2353 var code = $input.value; 2354 navigator.clipboard.writeText(code); 2355 } else { 2356 if (navigator.userAgent.match(/ipad|ipod|iphone/i)) { 2357 var editable = $input.contentEditable; 2358 var readOnly = $input.readOnly; 2359 2360 $input.contentEditable = true; 2361 $input.readOnly = true; 2362 2363 var range = document.createRange(); 2364 range.selectNodeContents($input); 2365 2366 var selection = window.getSelection(); 2367 selection.removeAllRanges(); 2368 selection.addRange(range); 2369 $input.setSelectionRange(0, 999999); 2370 2371 $input.contentEditable = editable; 2372 $input.readOnly = readOnly; 2373 2374 document.execCommand('copy'); 2375 } else { 2376 $input.focus(); 2377 $input.select(); 2378 document.execCommand('copy'); 2379 } 2380 window.getSelection().removeAllRanges(); 2381 } 2382 }); 2383 } 2384 } 2385}()); 2386 2387var backgroundUpload = (function () { 2388 return { 2389 init: function () { 2390 var $heroImage = $('.js-hero-image'), 2391 desktopPath = $('.js-hero-image').data('desktop'), 2392 tabletPath = $('.js-hero-image').data('tablet'), 2393 mobilePath = $('.js-hero-image').data('mobile'); 2394 2395 var heroImage = function (path) { 2396 $heroImage.css('background-image', "url('" + path + "')"); 2397 }; 2398 if (tabletFlag.is(':visible')) { 2399 heroImage(tabletPath); 2400 } 2401 if (mobileFlag.is(':visible')) { 2402 heroImage(mobilePath); 2403 } 2404 if (!mobileFlag.is(':visible') && !tabletFlag.is(':visible')) { 2405 heroImage(desktopPath); 2406 } 2407 } 2408 } 2409}()); 2410 2411var tooltip = (function () { 2412 var hideMessage = function () { 2413 var body = $('body'); 2414 body.find(messageBlock).fadeOut(400, function () { 2415 setTimeout(function () { 2416 $(messageBlock).remove(); 2417 }, 100); 2418 }); 2419 }; 2420 var tooltipBtn = $('.js-tooltip'), 2421 tooltipBlock = '.js-tooltip-block', 2422 tooltips = $(tooltipBlock), 2423 messageBlock = '.js-rating-message', 2424 showMsg = true; 2425 2426 return { 2427 init: function () { 2428 var g = '<div class="r-rating__msg js-rating-message">' + 2429 '<div class="r-rating__msg-wrap">' + 2430 ' <svg class="r-rating__msg-icon">' + 2431 ' <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/local/templates/main/icons/sprite.svg#question-transp"></use>' +
2432 ' </svg>' + 2433 ' <div class="r-rating__msg-text">' + 2434 ' ÐликниÑе на ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð² ÑейÑинге, ÑÑÐ¾Ð±Ñ ÑвидеÑÑ Ð¿Ð¾ÑÑнение' + 2435 ' </div>' + 2436 '</div>' + 2437 '</div>'; 2438 2439 if (showMsg) { 2440 showMsg = false; 2441 $('body').append(g); 2442 $(messageBlock).css('padding-left', RSIDE.block.innerWidth()).fadeIn(400); 2443 } else { 2444 showMsg = false; 2445 } 2446 2447 setTimeout(function () { 2448 hideMessage(); 2449 showMsg = true; 2450 }, 3000); 2451 }, 2452 2453 showTooltip: function () { 2454 this.offsetTooltips(); 2455 2456 tooltipBtn.on('click', function () { 2457 var $this = $(this); 2458 tooltip.toggle($this); 2459 }); 2460 2461 $(document).on('click', function (e) { 2462 if (!tooltipBtn.is(e.target) && tooltipBtn.has(e.target).length === 0) { 2463 tooltips.removeClass('active'); 2464 tooltipBtn.removeClass('active'); 2465 } 2466 }); 2467 2468 }, 2469 2470 offsetTooltips: function (msg) { 2471 2472 tooltipBtn.each(function () { 2473 var $this = $(this); 2474 var winWidth = window.innerWidth; 2475 var blockTooltip = $this.find(tooltipBlock); 2476 var tooltipWidth = blockTooltip.innerWidth(); 2477 var tooltipLeftOffset = $this.offset().left; 2478 var tooltipBtnWidth = $this.innerWidth(); 2479 var rightOffset = winWidth - tooltipLeftOffset - tooltipBtnWidth; 2480 var tooltipWidth = blockTooltip.innerWidth(); 2481 var offsetLeft = 0; 2482 2483 $this.removeClass('tooltip-left') 2484 blockTooltip.css({ 2485 'top': '', 2486 'left': '', 2487 'right': '' 2488 }).removeClass('isWide'); 2489 2490 2491 if (mobileFlag.is(':visible')) { 2492 var topOffset = $this.offset().top + 24; 2493 var leftOffset = 0; 2494 2495 // 28 = оÑÑÑÑÐ¿Ñ Ð¾Ñ ÐºÑÐ°Ñ ÑкÑана по 14px 2496 if (tooltipWidth < (winWidth - 28) && rightOffset > tooltipWidth + 28) { 2497 2498 leftOffset = tooltipLeftOffset + (tooltipBtnWidth / 2) - (tooltipWidth / 2); 2499 blockTooltip.css({ 2500 'left': leftOffset, 2501 }); 2502 2503 } else if (tooltipWidth <= 300) { 2504 blockTooltip.css({ 2505 'left': 'auto', 2506 'right': 20 2507 }); 2508 } 2509 2510 if (tooltipWidth === (winWidth - 28)) { 2511 blockTooltip.addClass('isWide') 2512 } 2513 2514 blockTooltip.css({ 2515 'top': topOffset 2516 }); 2517 2518 } else if (tabletFlag.is(':visible')) { 2519 $this.removeClass('tooltip-left'); 2520 2521 if (tooltipLeftOffset < 200 && tooltipWidth >= 290) { 2522 2523 offsetLeft = 119; 2524 blockTooltip.css({ 2525 'left': offsetLeft 2526 }); 2527 } 2528 2529 } else if (!checkAdaptive()) { 2530 $this.removeClass('tooltip-left') 2531 2532 // еÑли Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ вÑводиÑÑ ÑÑлÑип левее 2533 if (rightOffset < tooltipWidth + 40 && tooltipWidth > 300 && rightOffset < 330 || rightOffset < 140) { 2534 var offset = 18; 2535 2536 if (winWidth >= 1418) { 2537 offset = 36; 2538 } 2539 2540 var calcOffset = -tooltipWidth / 2 + rightOffset - offset; // оÑÑÑÑп полÑÑаеÑÑÑ 22, поÑÑÐ¾Ð¼Ñ Ð½Ð°Ð´Ð¾ ÑвелиÑиÑÑ Ð´Ð¾ 40 2541 $this.addClass('tooltip-left'); 2542 blockTooltip.css({ 2543 'left': calcOffset 2544 }); 2545 } 2546 2547 // еÑли Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ вÑводиÑÑ ÑÑл
2547Ñип пÑавее 2548 // 40 - оÑÑÑÑп Ð¾Ñ ÐºÑÐ°Ñ 2549 else if ((tooltipLeftOffset - $('.js-rside').innerWidth()) < (tooltipWidth + 40)) { 2550 $this.removeClass('tooltip-left') 2551 blockTooltip.css('top', ''); 2552 2553 // 550 - оÑÑÑÑп Ð¾Ñ ÐºÑайнего левого Ñл-Ñа + 40 оÑÑÑÑп 2554 if (tooltipLeftOffset < 550) { 2555 offsetLeft = 118; // оÑÑÑÑп, Ñ ÑÑеÑом 40 пикÑелей Ñ ÐºÑаÑ, Ð¾Ñ ÑайдбаÑа 2556 blockTooltip.css({ 2557 'left': offsetLeft 2558 }); 2559 } 2560 } 2561 } 2562 2563 if (tabletFlag.is(':visible') === false) { 2564 if (tooltipLeftOffset <= 400 && tooltipWidth >= 290) { 2565 blockTooltip.css({'left': 100}) 2566 } 2567 //console.log(tooltipLeftOffset) 2568 //Ñonsole.log(blockTooltip,'blockTooltip') 2569 // if(blockTooltip.offset().left <= 370){ 2570 // blockTooltip.css({'left': '100px'}) 2571 // } 2572 } 2573 2574 }); 2575 }, 2576 2577 toggle: function (el) { 2578 var blockTooltip = el.find(tooltipBlock); 2579 2580 2581 if (blockTooltip.hasClass('active')) { 2582 2583 blockTooltip.removeClass('active'); 2584 tooltipBtn.removeClass('active'); 2585 2586 } else { 2587 tooltips.removeClass('active'); 2588 tooltipBtn.removeClass('active'); 2589 2590 blockTooltip.addClass('active'); 2591 el.addClass('active'); 2592 2593 //console.log(blockTooltip.offset().left,'el') 2594 } 2595 } 2596 } 2597}()); 2598 2599var calendarTimelineLine = (function () { 2600 return { 2601 init: function () { 2602 var timeLine = $('.js-timeline'), 2603 lastItemHeight = $('.js-timeline-item:last-child').innerHeight(); 2604 2605 2606 // 29 - вÑÑвлено ÑмпиÑиÑеÑким пÑÑем 2607 // Ð´Ð»Ñ Ð³Ð»Ð°Ð²Ð½Ð¾Ð¹ ÑÑÑаниÑÑ Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑвелиÑиваÑÑ Ð¾ÑÑÑÑп ÑÐ½Ð¸Ð·Ñ 2608 if (timeLine.hasClass('js-timeline-main-page')) { 2609 2610 if (mobileFlag.is(':visible')) { 2611 var innerPaddingBottom = parseInt(timeLine.siblings('.js-timeinner').find('.js-main-time').css('padding-bottom')); 2612 timeLine.css('bottom', lastItemHeight + innerPaddingBottom); 2613 } 2614 } else { 2615 timeLine.css('bottom', lastItemHeight + 29); 2616 } 2617 2618 } 2619 } 2620}()); 2621 2622var numericList = (function () { 2623 var list = $('.js-list-col'); 2624 return { 2625 init: function () { 2626 list.parent().each(function (i, e) { 2627 var $this = $(this), 2628 count = 0, 2629 ol = $this.find('ol'); 2630 2631 ol.each(function () { 2632 var li = $(this).find('li'); 2633 if (!$this.find(list).hasClass('js-list-col-continue')) { 2634 $(this).attr('style', 'counter-reset: list 0'); 2635 } else { 2636 $(this).attr('style', 'counter-reset: list ' + count); 2637 count += li.length; 2638 } 2639 }); 2640 }); 2641 } 2642 } 2643}()); 2644 2645var cancleEdit = (function () { 2646 var cancleBtn = $('.js-personal-data-cancel'), 2647 changeBtn = $('.js-personal-data-change'); 2648 return { 2649 init: function () { 2650 cancleBtn.on('click', function () { 2651 $('label.error').hide(); 2652 }); 2653 changeBtn.on('click', function () { 2654 if ($('label.error').is(':hidden')) { 2655 $('label.error').show(); 2656 } 2657 }); 2658 } 2659 } 2660}()); 2661 2662var sTimeIcons = (function () { 2663 return { 2664 init: function () { 2665 var icon = $('.js-stime-bg'); 2666 if (icon.length > 0) { 2667 icon.each(function () { 2668 var $this = $(this), 2669 subTitleHeight = $this.siblings('.js-stime-content').find('.js-stime-subtitle'); 2670 2671 if (tabletFlag.is(':visible')) { 2672 $this.css('padding-top', subTitleHeight.outerHeight(true)); 2673 } else { 2674 $this.css('padding-top', ''); 2675 } 2676 }); 2677 } 2678 } 2679 } 2680}()); 2681 2682var researchStepsImg = (function () { 2683 var imgBlocks = $('.js-steps-img'), 2684 svg = imgBlocks.find('svg'), 2685 desktopSize = 5, 2686 mobileSize = 4; 2687 2688 return { 2689 hideShowStepImg: function () { 2690 if (mobileFlag.is(':visible') && imgBlocks.length > 0) { 2691 imgBlocks.each(function (i, e) { 2692 var offsetHeight = $(this).innerHeight() + 60; 2693 $(this).stick_in_parent({ 2694 offset_top: offsetHeight, 2695 spacer: false, 2696 recalc_every: 1 2697 }); 2698 }); 2699 } 2700 }, 2701 init: function () { 2702 if (imgBlocks.length > 0) { 2703 svg.each(function () { 2704 var startWidth = parseInt($(this).attr('width')); 2705 var startHeight = parseInt($(this).attr('height')); 2706 2707 if (mobileFlag.is(':visible')) { 2708 $(this).attr('width', startWidth * mobileSize); 2709 $(this).attr('height', startHeight * mobileSize); 2710 } else { 2711 $(this).attr('width', startWidth * desktopSize); 2712 $(this).attr('height', startHeight * desktopSize); 2713 } 2714 }); 2715 researchStepsImg.hideShowStepImg(); 2716 } 2717 } 2718 } 2719}()); 2720 2721var blogPostImgSize = (function () { 2722 return { 2723 init: function () { 2724 var blogPost = $('.js-blog-post'); 2725 if (blogPost.length > 0) {
2726 var wrapperWidth = blogPost.innerWidth(), 2727 paddingLeftSize = parseInt(blogPost.css('padding-left')), 2728 imgs = blogPost.find('img'); 2729 2730 imgs.each(function () { 2731 var $this = $(this); 2732 $this.attr('width', wrapperWidth).css('margin-left', -paddingLeftSize); 2733 }); 2734 } 2735 } 2736 } 2737 2738}()); 2739 2740var weBlockSticky = (function () { 2741 var stickyText = $('.js-we-block-sticky'); 2742 return { 2743 init: function () { 2744 if (stickyText.length > 0 && !checkAdaptive()) { 2745 var offsetHeight = ($(window).innerHeight() - stickyText.innerHeight()) / 2; 2746 stickyText.stick_in_parent({ 2747 offset_top: offsetHeight, 2748 recalc_every: 1, 2749 spacer: false 2750 }) 2751 } 2752 } 2753 } 2754}()); 2755 2756var weBlockImgs = (function () { 2757 var items = $('.js-we-item'); 2758 return { 2759 init: function () { 2760 if (items.length > 0) { 2761 if (!checkAdaptive()) { 2762 items.css('height', items.innerWidth()) 2763 } else { 2764 items.css('height', ''); 2765 } 2766 } 2767 } 2768 } 2769 2770}()); 2771 2772var heroTitileMargin = (function () { 2773 var heightComparison = 144, 2774 heroTitle = $('.js-hero-title'), 2775 heroTitleHeight = heroTitle.innerHeight(); 2776 return { 2777 init: function () { 2778 if (!checkAdaptive()) { 2779 if (heroTitleHeight > heightComparison) { 2780 var marginTotal = heroTitleHeight - heightComparison; 2781 heroTitle.css({ 2782 'margin-top': -marginTotal, 2783 }); 2784 } 2785 } 2786 } 2787 } 2788}()); 2789 2790 2791var anchorsInMain = (function () { 2792 var sections = $('.section'); 2793 return { 2794 init: function () { 2795 // if (this.checkMainPage()) { 2796 // sections.each(function () { 2797 // var $this = $(this), 2798 // classes = $this.attr('class').split(' '); 2799 // $this.attr('id', classes[2]); 2800 // }); 2801 // } 2802 }, 2803 checkMainPage: function () { 2804 return window.location.pathname === '/' 2805 }, 2806 scrollToHash: function () { 2807 // Ñ.к. fullpage ÑÑиÑÐ°ÐµÑ Ñ 1 2808 return $('.section' + window.location.hash).index() + 1 2809 } 2810 } 2811}()); 2812 2813 2814var autoHeightTextarea = (function () { 2815 return { 2816 init: function () { 2817 var textarea = document.querySelector('textarea'); 2818 if (checkAdaptive() && textarea) { 2819 2820 textarea.addEventListener('keydown', autosize); 2821 2822 function autosize() { 2823 var el = this; 2824 var rowLength = 27; // !important 2825 2826 setTimeout(function () { 2827 var tabsCount = el.value.match(/\n/gi) ? el.value.match(/\n/gi).length + 1 : 0; 2828 var rowsCount = Math.ceil(el.value.replace('\n', '').length / rowLength); 2829 var rows = (rowsCount + tabsCount); 2830 var height = rows <= 1 ? 0 : rows * 16; 2831 2832 el.style.cssText = 'height:' + (57 + height) + 'px'; 2833 }, 40); 2834 } 2835 } 2836 } 2837 } 2838}()); 2839 2840var contactsTabs = { 2841 tabs: '.js-tabs', 2842 tab: '.js-tab', 2843 tabButton: '.js-tab-switcher', 2844 lineSwitcher: '.js-tab-switchers-icon', 2845 checkTabs: function () { 2846 return $(this.tabs).length > 0 2847 }, 2848 lineWidth: function () { 2849 if (this.checkTabs()) { 2850 var tabs = $(this.tabs); 2851 2852 var lineSwitcher = tabs.find(this.lineSwitcher); 2853 var activeBtn = $(this.tabButton).filter(function () { 2854 return $(this).hasClass('isActive'); 2855 })[0]; 2856 2857 lineSwitcher.css({ 2858 'width': activeBtn.offsetWidth, 2859 'left': activeBtn.offsetLeft 2860 }); 2861 } 2862 }, 2863 init: function () { 2864 if (this.checkTabs()) { 2865 var tabs = $(this.tabs); 2866 var lineSwitcher = tabs.find(this.lineSwitcher); 2867 var self = this; 2868 this.lineWidth(); 2869 lineSwitcher.css('left', 0); 2870 2871 tabs.each(function () { 2872 var tab = $(this).find(self.tab); 2873 var btns = tabs.find(self.tabButton); 2874 2875 btns.on('click', function () { 2876 var btn = $(this); 2877 var currentTab = btn.data('tab'); 2878 var position = btn[0].offsetLeft; 2879 2880 btns.removeClass('isActive'); 2881 btn.addClass('isActive'); 2882 tab.hide(); 2883 lineSwitcher.css({ 2884 'width': btn.innerWidth(), 2885 'left': position 2886 }); 2887 2888 tab.filter(function () { 2889 return $(this).data('tab') === currentTab; 2890 }).stop(0, 0).fadeIn(500); 2891 }); 2892 2893 }); 2894 } 2895 } 2896}; 2897 2898var accordion = { 2899 accord: '.js-accordion', 2900 btn: '.js-accordion-btn', 2901 accordBody: '.js-accordion-body', 2902 img: '.js-accordion-img', 2903 init: function () { 2904 var accords = document.querySelectorAll(this.accord); 2905 if (accords.length > 0) { 2906 this.checkHeightAccardion(accords); 2907 2908 var self = this; 2909 accords.forEach(function (accordion) { 2910 2911 var openBtn = accordion.querySelector(self.btn); 2912 var accordBody = accordion.querySelector(self.accordBody); 2913 var openAccord = function () { 2914 accordBody.classList.add('isActive'); 2915 accordBody.style.height = accordBody.scrollHeight + 'px'; 2916 accordion.classList.add('isShow', 'isCollapse'); 2917 2918 if (mobileFlag.is(':visible')) { 2919 setTimeout(function () { 2920 accordBody.style.height = accordBody.scrollHeight + 'px'; 2921 }, 350); 2922 } 2923 }; 2924 2925 var closeAccord = function () { 2926 accordBody.style.height = ''; 2927 accordion.classList.remove('isShow', 'isCollapse'); 2928 }; 2929 2930 openBtn.addEventListener('click', function () { 2931 this.classList.toggle('isActive') 2932 2933 if (accordBody.style.height) { 2934 closeAccord(); 2935 } else { 2936 openAccord(); 2937 } 2938 setTimeout(function () { 2939 $('body').off('scroll'); 2940 HEADER.init(); 2941 HEADER.setHeaderType($(window).scrollTop()); 2942 }, 500); 2943 }); 2944 2945 }); 2946 2947 } 2948 }, 2949 checkHeightAccardion: function (accords) { 2950 window.addEventListener('resize', function () { 2951 accords.forEach(function (el) { 2952 2953 if (el.classList.contains('isCollapse')) { 2954 const accBody = el.querySelector('.js-accordion-body'); 2955 accBody.style.height = ''; 2956 setTimeout(function () { 2957 accBody.style.height = accBody.scrollHeight + 'px' 2958 }, 100) 2959 } 2960 }); 2961 }) 2962 } 2963} 2964 2965 2966$(document).on('click', '[type="reset"]', function () { 2967 var _this = $(this); 2968 _this.closest('form').find('input').blur(); 2969 setTimeout(function () { 2970 _this.closest('form').find('input').blur(); 2971 }, 50); 2972}); 2973 2974 2975$(document).on('click', '.js-checkbox-submit', function () { 2976 $(this).closest('form').find('[name=Update]').trigger('click'); 2977}); 2978 2979 2980$(document).ready(function () { 2981 PAGE.init(); 2982 MENU.init(); 2983 // MENU.reset(); 2984 SEARCH.init(); 2985 SUBMENU.init(); 2986 rMenu.init(); 2987 RSIDE.init(); 2988 2989 phoneMask.init(); 2990 2991 backgroundUpload.init(); 2992 socials.init(); 2993 randomColor.init($('.js-slider-color'), ['yellowlight', 'grey']); 2994 2995 schemeSlider.init('yellowlight', $('.js-scheme-nav-light'), $('.js-scheme-item-light'));
2996 schemeSlider.init('grey', $('.js-scheme-nav-dark'), $('.js-scheme-item-dark')); 2997 // schemeSlider.init('', $('.js-scheme-nav-big'), $('.js-scheme-item-big')); 2998 showSide(); 2999 3000 customScroll.init(); 3001 3002 ARCH.init(); 3003 3004 myAlert(); 3005 calendarTimelineLine.init(); 3006 3007 numericList.init(); 3008 cancleEdit.init(); 3009 3010 field.init(); 3011 3012 sTimeIcons.init(); 3013 blogPostImgSize.init(); 3014 weBlockSticky.init(); 3015 weBlockImgs.init(); 3016 heroTitileMargin.init(); 3017 tableType.init(); 3018 3019 autoHeightTextarea.init(); 3020 accordion.init(); 3021 3022}).trigger('resize'); 3023 3024$(window).resize(function () { 3025 setTimeout(function () { 3026 $('body').off('scroll'); 3027 HEADER.init(); 3028 HEADER.setHeaderType($(window).scrollTop()); 3029 }, 500); 3030// checkHeightAccardion.init(); 3031}) 3032 3033$(document).ready(function () { 3034 3035 if (isWindows()) { 3036 $('body').addClass('windows') 3037 } 3038 3039 setTimeout(function () { 3040 // setHeaderTypeArr(); 3041 HEADER.init(); 3042 // HEADER.setHeaderTypeArr(); 3043 }, 100); 3044 swiperExamples(); 3045 swiperQuote(); 3046 3047 swiperMedia(); 3048 swiperRelease(); 3049 3050 3051 myRecentResizeHandler(); 3052 // myTimeResizeHandler(); 3053 myIndustResizeHandler(); 3054 $('body').trigger('scroll'); 3055 3056 3057 $(window).trigger('resize').trigger('scroll'); 3058 3059 /* Ð»Ð¾Ð°Ð´ÐµÑ Ð² поÑледнÑÑ Ð¾ÑеÑÐµÐ´Ñ */ 3060 3061 MENU.setStartColor(); 3062 hideLoader(); 3063 //validation.init(); 3064 researchStepsImg.init(); 3065 3066 if ($(window).innerWidth() > 3072) { 3067 setTimeout(function () { 3068 myRecent.update(); 3069 }, 500) 3070 } 3071 // // fix for autocomplete 3072 // setTimeout(function () { 3073 // field.init(); 3074 // }, 300); 3075 checkValidSubscr.init(); 3076 validation.init(); 3077 field.load(); 3078 contactsTabs.init(); 3079 setTimeout(function () { 3080 MENU.isInitializing = false; 3081 }, 600); 3082 3083}).on('resize', function () { 3084 checkGadget(); 3085 3086 backgroundUpload.init(); 3087 3088 myRecentResizeHandler(); 3089 // myTimeResizeHandler(); 3090 myIndustResizeHandler(); 3091 3092 setTimeout(function () { 3093 calendarTimelineLine.init(); 3094 }, 300); 3095 3096 rMenu.offsetsMenuAdding(); 3097 // rMenu.turn(); 3098 rMenu.hide(); 3099 // MENU.close(); 3100 3101 sTimeIcons.init(); 3102 3103 blogPostImgSize.init(); 3104 weBlockImgs.init(); 3105 3106 customScroll.init(); 3107 3108 contactsTabs.lineWidth(); 3109 3110 3111 $.throttle(400, true, function () { 3112 tooltip.offsetTooltips() 3113 })(); 3114 3115}).on('scroll', function () { 3116 var sTop = null; 3117 if ($('.js-blog-inner').length != 0) { 3118 3119 sTop = $(window).scrollTop(); 3120 3121 if (mobileFlag.is(':visible')) { 3122 if (sTop >= $(window).height() / 2) { 3123 $('.js-blog').addClass('isWide'); 3124 } else { 3125 $('.js-blog').removeClass('isWide'); 3126 } 3127 } 3128 } 3129}); 3130 3131function checkSpace() { 3132 var title = $(".h-report__title"), 3133 url = encodeURIComponent(document.location.href), 3134 share = $('.ya-share2'); 3135 if (share !== undefined) { 3136 for (var i = 0; i < share.length; i++) { 3137 var a = share[i].querySelector('.ya-share2__link'); 3138 if (a !== null) { 3139 if (share[i].getAttribute('data-services') == 'twitter') { 3140 a.setAttribute("href", "https://twitter.com/intent/tweet?text=" + title[0].innerText + "&url=" + url + "&utm_source=share2"); 3141 } else if (share[i].getAttribute('data-services') == 'telegram') { 3142 a.setAttribute("href", "https://telegram.me/share/url?url=" + url + "&text=" + title[0].innerText + "&utm_source=share2"); 3143 } else if (share[i].getAttribute('data-services') == 'vkontakte') { 3144 a.setAttribute("href", "https://vk.com/share.php?url=" + url + "&title=" + title[0].innerText + "&utm_source=share2"); 3145 } else if (share[i].getAttribute('data-services') == 'facebook') { 3146 a.setAttribute("href", "https://www.facebook.com/sharer.php?src=sp&u=" + url + "&title=" + title[0].innerText + "&utm_source=share2"); 3147 } 3148 } 3149 } 3150 } 3151} 3152 3153// ÑоÑма подпиÑки в блоге
3154// глобалÑÐ½Ð°Ñ Ð¿ÐµÑÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð½Ñжна Ð´Ð»Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð¸Ð½ÑÑ ÑеÑез ajax 3155var subscrFormSubmit = false; 3156var checkValidSubscr = (function () { 3157 return { 3158 init: function () { 3159 var form = $('.js-blog-subs-form'), 3160 hiddenFields = $('.js-blog-subs-hide'), 3161 submit = form.find('button[type=submit]'), 3162 successMessage = $('.js-blog-succes-subscr'); 3163 3164 var hideFields = function () { 3165 form.addClass('hide'); 3166 hiddenFields.addClass('hide'); 3167 submit.attr('disabled', true).addClass('hide'); 3168 successMessage.addClass('show'); 3169 }; 3170 3171 if (subscrFormSubmit) { 3172 hideFields(); 3173 } else { 3174 form.on('submit', function (e) { 3175 e.preventDefault(); 3176 $.post('', form.serialize(), 3177 function (response) { 3178 3179 }); 3180 if ($(this).val
3180id()) { 3181 $(this).addClass('hide'); 3182 hideFields(); 3183 subscrFormSubmit = true; 3184 } 3185 }); 3186 } 3187 } 3188 } 3189}()); 3190 3191$(document).on('click', '.checkbox__el', function () { 3192 if ($('[name="SUBSCRIBE[RUBRICS][]"]:checked').length != 0) { 3193 $('.subscribe__subtext--alert_tupy').fadeOut(300); 3194 } 3195}); 3196 3197$(function () { 3198 3199 const isRussianEmail = (email) => { 3200 const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.(ru|su|ÑÑ|деÑи|моÑква|онлайн|оÑг|ÑайÑ)$/; 3201 3202 return emailRegex.test(email); 3203 } 3204 3205 $('body').on('submit', '.js-subscribe-form', function (e) { 3206 e.preventDefault(); 3207 var scrollTop = $(window).scrollTop(); 3208 $(window).scrollTop(scrollTop); 3209 $('.subscribe__subtext--alert').hide(); 3210 3211 $(window).scrollTop(scrollTop); 3212 if ($('[name="SUBSCRIBE[RUBRICS][]"]:checked').length == 0) { 3213 $('.subscribe__subtext--alert_tupy').html('ÐÑбеÑиÑе Ñ Ð¾ÑÑ Ð±Ñ Ð¾Ð´Ð½Ñ ÑемÑ').fadeIn(300); 3214 $(window).scrollTop(scrollTop); 3215 return false; 3216 } 3217 3218 const emailNode = $('[name="SUBSCRIBE[EMAIL]"]'); 3219 const emailValue = emailNode.val(); 3220 const errorEmail = $('.email-not-valid'); 3221 3222 emailNode.on('input', () => { 3223 errorEmail.removeClass('email-not-valid_active'); 3224 }) 3225 3226 if (!isRussianEmail(emailValue)) { 3227 errorEmail.text('E-mail должен бÑÑÑ Ð½Ð° ÑоÑÑийÑком домене (â 406-Ð¤Ð Ð¾Ñ 31.07.2023)'); 3228 errorEmail.addClass('email-not-valid_active'); 3229 emailNode.parent().addClass("error"); 3230 return; 3231 } 3232 3233 $.post("", $(this).serialize(), function (data) { 3234 if (data.ERROR_MSG) { 3235 $('.subscribe__subtext--alert').html(data.ERROR_MSG).fadeIn(300); 3236 $(window).scrollTop(scrollTop); 3237 $('[name="SUBSCRIBE[EMAIL]"]').parent().addClass("error"); 3238 } else { 3239 Goal.triggerGoalCallback("subscribe_form", false, { 3240 form: e.target 3241 }); 3242 var subcSuccess = $('.js-subscribe-success2'); 3243 $('[name="SUBSCRIBE[EMAIL]"]').parent().removeClass("error"); 3244 $('.js-subscribe').hide(); 3245 $('.subscribe__cols.subscribe__cols-top.js-subscribe-form').removeClass('sub_form_active'); 3246 subcSuccess.siblings().hide(); 3247 setTimeout(function () { 3248 $('.js-subscribe-success2').show(); 3249 $('.js-presubscribe').fadeIn(1000); 3250 }, 0); 3251 } 3252 }, 'json'); 3253 }); 3254 3255 $('body').on('click', '.js-presubscribe .btn,.js-show-blogsubscribe', function () { 3256 $('.blog__subscribe-block').addClass('tans_h'); 3257 $('.js-presubscribe,.js-presubscribe2').hide(); 3258 $('.js-subscribe').fadeIn(1000); 3259 $('.subscribe__cols.subscribe__cols-top.js-subscribe-form').addClass('sub_form_active'); 3260 if ($(window).width() > 1000) { 3261 setTimeout(function () { 3262 $('#USER_LOGIN')[0].focus(); 3263 }, 400); 3264 } 3265 }); 3266 $('body').on('click', '.subscribe__cancel', function () { 3267 $('.blog__subscribe-block').removeClass('tans_h'); 3268 $('.js-presubscribe,.js-presubscribe2').fadeIn(1000); 3269 $('.js-subscribe').hide(); 3270 $('.subscribe__cols.subscribe__cols-top.js-subscribe-form').removeClass('sub_form_active'); 3271 }); 3272 var lasChange; 3273 $('body').on('change', '.js-subscrib-lk-form input', function () { 3274 lasChange = Date.now(); 3275 setTimeout(function () { 3276 if (lasChange + 1200 < Date.now()) { 3277 $.post("", $('.js-subscrib-lk-form').serialize(), function (data) { 3278 if (!showMsg) { 3279 showMsg = true; 3280 MSG.show('<div style="font-size: 14px; line-height: 20px;">ÐовÑе ÑÐµÐ¼Ñ e-mail подпиÑки ÑÐ¾Ñ ÑаненÑ</div>', true); 3281 } 3282 }); 3283 } 3284 }, 1500); 3285 // $.post("",$('.js-subscrib-lk-form').serialize(), function(data) { 3286 // if(!showMsg) { 3287 // setTimeout(function () { 3288 // if(lasChange + 1500 < Date.now() && !showMsg) { 3289 // showMsg = true; 3290 // MSG.show('<div style="font-size: 14px; line-height: 20px;">ÐовÑе ÑÐµÐ¼Ñ e-mail подпиÑки ÑÐ¾Ñ ÑаненÑ</div>', true); 3291 // } 3292 // }, 1500); 3293 // } 3294 // },'json'); 3295 // $('.js-subscribe-lk').prop('disabled', true); 3296 // $('.checkbox__in').addClass('disabled'); 3297 }); 3298 $(document).on('click', '.js-subscribe-all', function (e) { 3299 e.preventDefault(); 3300 $('.js-subscrib-lk-form input').attr('checked', false).eq(0).click(); 3301 lasChange = Date.now(); 3302 $.post("", $('.js-subscrib-lk-form').serialize(), function (data) { 3303 if (!showMsg) { 3304 setTimeout(function () { 3305 if (lasChange + 1500 < Date.now()) { 3306 showMsg = true; 3307 MSG.show('<div style="font-size: 14px; line-height: 20px;">ÐÑ Ð¾ÑпиÑалиÑÑ Ð¾Ñ Ð²ÑÐµÑ Ñем e-mail подпиÑки</div>', true); 3308 } 3309 }, 2000); 3310 } 3311 }, 'json'); 3312 return false;
3313 }); 3314 $('main.page form').not('.js-subscrib-lk-form, .psw-reset__form, #js-ajax-field, .psw-reset--redirect').each(function () { 3315 var that = this; 3316 $(this).find('input').click(function () { 3317 $(that).find('[name="sAnt1"]').val(2000); 3318 var form = $(that); 3319 form.attr('action', form.attr('data-action2')); 3320 }); 3321 $(this).find('.btn--subscribe2').click(function () { 3322 $(that).find('[name="sAnt1"]').val(2000); 3323 $(that).find('[name="sAnt2"]').val(2001); 3324 var form = $(that); 3325 form.attr('action', form.attr('data-action2')); 3326 }); 3327 $(this).find('input').keyup(function () { 3328 $(that).find('[name="sAnt2"]').val(2001); 3329 }); 3330 $(this).find('input').keydown(function () { 3331 $(that).find('[name="sAnt2"]').val(2001); 3332 }); 3333 if (!($(this).find("input[type='text']").filter(function () { 3334 return this.value; 3335 }).length > 2)) { 3336 $(this).append('<input type="hidden" name="sAnt1">' + "\r\n" + '<input type="hidden" name="sAnt2">'); 3337 } 3338 }); 3339 3340 $('input[name="sAnt3"]').removeProp('checked'); 3341 3342 3343 // $(".t-table__head").stick_in_parent(); 3344}); 3345 3346 3347document.addEventListener('DOMContentLoaded', () => { 3348 document.querySelector('.menu__burger').addEventListener('click', () => { 3349 MSG.hide(); 3350 }) 3351}) 3352 3353function openModal(modalId) { 3354 let modal = document.querySelector(modalId); 3355 modal.classList.add('show'); 3356 modal.classList.remove('hide'); 3357 document.body.style.overflow = "hidden"; 3358} 3359 3360function setModalShownExecuted() { 3361 const timestamp = new Date().getTime(); 3362 localStorage.setItem('modalShownExecuted', timestamp); 3363} 3364 3365function closeModal(modalId) { 3366 let modal = document.querySelector(modalId); 3367 modal.classList.remove('show'); 3368 modal.classList.add('hide'); 3369 document.body.style.overflow = ""; 3370 if (modalId == '#close_site') { 3371 // localStorage.setItem('modalShownExecuted', true); // ÐомеÑаем, ÑÑо ÑÑнкÑÐ¸Ñ Ñже вÑполнилаÑÑ 3372 setModalShownExecuted(); 3373 } 3374 3375 if (modalId == '#new_version') { 3376 document.dispatchEvent(new CustomEvent('motivation:start')); 3377 } 3378} 3379 3380function canShowModal() { 3381 const modalShown = localStorage.getItem('modalShownExecuted'); 3382 const ignorePages = ['report', 'service']; 3383 3384 const isIgnorePage = ignorePages.some(section => 3385 new RegExp(`^\\/${section}\\/.+`).test(window.location.pathname) 3386 ); 3387 3388 if (isIgnorePage) { 3389 return false; 3390 } 3391 3392 if (!modalShown) { 3393 return true; 3394 } 3395 3396 const timestamp = parseInt(modalShown, 10); 3397 const currentTime = new Date().getTime(); 3398 const dayInMs = 24 * 60 * 60 * 1000; 3399 3400 if (currentTime - timestamp >= dayInMs) { 3401 localStorage.removeItem('modalShownExecuted'); 3402 return true; 3403 } 3404 3405 return false; 3406} 3407 3408// модалÑное окно "Ðе наÑли Ñо ÑÑо иÑкали" пеÑед закÑÑÑием ÑайÑа 3409 3410// ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑеÑа вÑемени на ÑайÑе 3411function trackTimeOnSite() { 3412 // ÐолÑÑаем вÑÐµÐ¼Ñ Ð½Ð°Ñала визиÑа полÑзоваÑÐµÐ»Ñ Ð½Ð° ÑÐ°Ð¹Ñ 3413 let startTime = new Date().getTime(); 3414 3415 if (localStorage.getItem('startTime')) { 3416 startTime = localStorage.getItem('startTime'); 3417 } else { 3418 localStorage.setItem('startTime', startTime); 3419 } 3420 3421 // ÐапÑÑкаем инÑеÑвал Ð´Ð»Ñ Ð¿ÑовеÑки вÑемени Ð½Ð°Ñ Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð½Ð° ÑайÑе 3422 const intervalId = setInterval(() => { 3423 const currentTime = new Date().getTime(); 3424 const timeSpent = (currentTime - startTime) / 1000; // ÐеÑеводим в ÑекÑÐ½Ð´Ñ 3425 3426 localStorage.setItem('timeSpent', timeSpent); 3427 3428 // ÐÑовеÑÑем, еÑли полÑзоваÑÐµÐ»Ñ Ð½Ð°Ñ Ð¾Ð´Ð¸ÑÑÑ Ð½Ð° ÑайÑе болÑÑе 15 ÑекÑнд 3429 if (timeSpent > 15 && localStorage.getItem('pagesVisited') > 2 && canShowModal()) { 3430 console.log('timeSpent end'); 3431 clearInterval(intervalId); // ÐÑÑанавливаем инÑеÑвал 3432 showModalDialog(); 3433 } 3434 3435 }, 1000); // ÐÑовеÑÑем каждÑÑ ÑекÑÐ½Ð´Ñ 3436 3437} 3438 3439 3440// ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑеÑа колиÑеÑÑва поÑеÑеннÑÑ ÑÑÑÐ°Ð½Ð¸Ñ 3441function trackVisitedPages() { 3442 let pagesVisited = localStorage.getItem('pagesVisited') || 0; 3443 pagesVisited++; 3444 localStorage.setItem('pagesVisited', pagesVisited); 3445 //console.log('pagesVisited ' + pagesVisited); 3446 //console.log('modalShownExecuted ' + localStorage.getItem('modalShownExecuted')); 3447 // ÐÑовеÑÑем, еÑли полÑзоваÑÐµÐ»Ñ Ð¿Ð¾ÑеÑил болÑÑе двÑÑ ÑÑÑÐ°Ð½Ð¸Ñ Ð¸ модалÑного окна еÑе не показÑвали 3448 if (pagesVisited > 2 && canShowModal()) { 3449 showModalDialog(); 3450 3451 } 3452} 3453 3454function showModalDialog() { 3455 // document.addEventListener("mouseleave", function (event) { 3456 $(document).off('mouseleave.exitModal').on('mouseleave.exitModal', function (event) { 3457 if (canShowModal()) { 3458 if (event.clientY <= 0 || event.clientX <= 0 || (event.clientX >= window.innerWidth || event.clientY >= window.innerHeight)) { 3459 console.log("I'm out"); 3460 openModal('#close_site'); 3461 Goal.triggerGoalCallback("find_out_seen", false); 3462 } 3463 } 3464 }) 3465 3466} 3467 3468 3469document.addEventListener('DOMContentLoaded', () => { 3470 const modal = document.querySelectorAll('.modal'); 3471 const modalCloseBtn = document.querySelectorAll('[data-close]'); 3472 const body = document.body; 3473
3474 modalCloseBtn.forEach((item) => { 3475 item.addEventListener('click', (e) => { 3476 const modalEl = e.target.closest('.modal'); 3477 if (!modalEl || !modalEl.id) return; 3478 3479 closeModal('#' + modalEl.id); 3480 console.log("close", item); 3481 }); 3482 }); 3483 3484 modal.forEach((item) => { 3485 item.addEventListener('click', (e) => { 3486 if (e.target !== item || !item.id) return; 3487 3488 closeModal('#' + item.id); 3489 }); 3490 }); 3491 3492 const modalNewVersion = document.querySelector('#new_version'); 3493 const currentPage = window.location.pathname; 3494 3495 let visitedPages; 3496 try { 3497 visitedPages = JSON.parse(localStorage.getItem('visitedPages')) || []; 3498 } catch { 3499 visitedPages = []; 3500 } 3501 3502 if (modalNewVersion && !visitedPages.includes(currentPage)) { 3503 visitedPages.push(currentPage); 3504 localStorage.setItem('visitedPages', JSON.stringify(visitedPages)); 3505 3506 const main = document.querySelector('main'); 3507 if (main) { 3508 body.insertBefore(modalNewVersion, main); 3509 } 3510 3511 openModal('#new_version'); 3512 } 3513 3514 if (typeof trackTimeOnSite === 'function') { 3515 trackTimeOnSite(); 3516 } 3517 3518 if (typeof trackVisitedPages === 'function') { 3519 trackVisitedPages(); 3520 } 3521}); 3522 3523 3524$(document).ready(function () { 3525 $('.site_close_form').submit(function (evt) { 3526 evt.preventDefault(); 3527 var test_inputs = true; 3528 var inputs = evt.target.querySelectorAll("input.required"); 3529 3530 inputs.forEach(input => { 3531 if (input.value == "") { 3532 test_inputs = false; 3533 input.style.color = "red"; 3534 } 3535 }); 3536 3537 if (test_inputs) { 3538 var $that = $(this), 3539 formData = new FormData($that.get(0)); 3540 $.ajax({ 3541 url: "/local/templates/main/ajax/send_close_form.php", // пÑÑÑ Ðº php-обÑабоÑÑÐ¸ÐºÑ 3542 type: 'POST', // меÑод пеÑедаÑи даннÑÑ 3543 contentType: false, 3544 processData: false, 3545 data: formData, 3546 success: function (data) { 3547 if (data) { 3548 console.log(data); 3549 } 3550 } 3551 }); 3552 setModalShownExecuted(); 3553 //evt.target.reset(); 3554 document.getElementById("thanks_modal").classList.add('show'); 3555 document.getElementById("thanks_modal").classList.remove('hide'); 3556 3557 document.getElementById("close_site").classList.add('hide'); 3558 document.getElementById("close_site").classList.remove('show'); 3559 } 3560 3561 return false; 3562 }); 3563 //$(".modal__close").click(function() { 3564 // document.getElementById(this.dataset.close).classList.add('hide'); 3565 // document.getElementById(this.dataset.close).classList.remove('show'); 3566 //}); 3567 3568 let btnAskProject = $('.js-project'); 3569 let btnAskProject2 = $('.js-second-project'); 3570 3571 $(function () { 3572 // ÐÑовеÑÑем налиÑие оÑновной кнопки и пеÑвой ÑекÑии 3573 if (!btnAskProject.length || !$('section[data-anchor="auth-services"]').length) { 3574 return; // ÐÑÑ Ð¾Ð´Ð¸Ð¼, еÑли ÑлеменÑÑ Ð¾ÑÑÑÑÑÑвÑÑÑ 3575 } 3576 3577 // ФÑнкÑÐ¸Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ ÐºÐ½Ð¾Ð¿Ð¾Ðº 3578 function updateButtons() { 3579 let scrollTop = $(window).scrollTop(); 3580 let windowHeight = $(window).height(); 3581 let documentHeight = $(document).height(); 3582 let buttonHeight = btnAskProject.outerHeight(); 3583 let buttonBottomPosition = scrollTop + windowHeight - buttonHeight; 3584 3585 // let threshold = $(window).width() < 575 ? 1200 : 0; 3586 // console.log() 3587 // if (documentHeight - buttonBottomPosition >= threshold) { 3588 // btnAskProject.fadeIn(); 3589 // } else { 3590 // btnAskProject.fadeOut(); 3591 // } 3592 let sss = 0; 3593 let form2 = 0; 3594 3595 const $section1 = $('section[data-anchor="auth-services"]'); 3596 const $section2 = $('section[data-anchor="auth-services-2"]'); 3597 3598 if ($section1.length) { 3599 const offset1 = $section1.offset(); 3600 if (offset1 && typeof offset1.top === 'number') { 3601 sss = offset1.top; 3602 } 3603 } 3604 3605 if ($section2.length) { 3606 const offset2 = $section2.offset(); 3607 if (offset2 && typeof offset2.top === 'number') { 3608 form2 = offset2.top; 3609 } 3610 } 3611 3612 // if (documentHeight - buttonBottomPosition > $(document).height() - sss) { 3613 // btnAskProject.fadeIn(); 3614 // } else { 3615 // btnAskProject.fadeOut(); 3616 // } 3617 3618 if (documentHeight - buttonBottomPosition > $(document).height() - sss) { 3619 btnAskProject.fadeIn(); 3620 if (btnAskProject2.length) { 3621 btnAskProject2.fadeOut(); // ÑкÑÑваем вÑоÑÑÑ 3622 } 3623 } else { 3624 btnAskProject.fadeOut(); 3625 3626 // ÐÑоÑÐ°Ñ ÐºÐ½Ð¾Ð¿ÐºÐ°: показÑваеÑÑÑ Ð¼ÐµÐ¶Ð´Ñ Ð¿ÐµÑвой и вÑоÑой ÑоÑмой 3627 if (btnAskProject2.length && form2 > 0 && documentHeight - buttonBottomPosition > $(document).height() - form2) { 3628 btnAskProject2.fadeIn(); 3629 } else if (btnAskProject2.length) { 3630 btnAskProject2.fadeOut(); 3631 } 3632 } 3633 } 3634 3635 // ÐниÑиализаÑÐ¸Ñ Ð¿Ñи загÑÑзке 3636 updateButtons(); 3637 3638 // ÐбÑабоÑÑик ÑкÑолла 3639 $(window).scroll(updateButtons); 3640 }); 3641 3642 3643}); 3644 3645 3646// конвеÑÑиÑÑÐµÑ Ð³ÑадÑÑÑ Ð² ÑÐ°Ð´Ð¸Ð°Ð½Ñ 3647function toRad(deg) { 3648 return deg * (Math.PI / 180); 3649} 3650 3651// Ð²Ð¸Ð´Ð¶ÐµÑ Ð´Ð»Ñ ÑаÑÑÑановки ÑлеменÑов по кÑÑÐ³Ñ 3652var DHTMLCircle = function (options) { 3653 var root = this; 3654 3655 // опÑии jQuery виджеÑа 3656 options = $.extend({ 3657 'elementsSelector': '> div',
3658 'radius': 100, 3659 'animationSpeed': 0, 3660 'xOffset': 0, 3661 'yOffset': 0 3662 }, options || {}); 3663 3664 var slides = root.find(options.elementsSelector), // позиÑиониÑÑемÑе ÑлеменÑÑ 3665 slidesCount = slides.length, 3666 x = root.position().left, 3667 y = root.position().top; 3668 3669 // нам не нÑжно ÑÑиÑÑваÑÑ ÑмеÑение ÑодиÑÐµÐ»Ñ Ð¿Ñи оÑноÑиÑелÑном позиÑиониÑовании 3670 if (root.css('position') == 'relative') 3671 x = y = 0; 3672 3673 // вÑÑиÑлÑем ÑенÑÑ Ð¾ÐºÑÑжноÑÑи и Ñгол повоÑоÑа 3674 var cx = Math.round((root[0].offsetWidth + x) / 2), 3675 cy = Math.round((root[0].offsetHeight + y) / 2), 3676 slideAngle = toRad(360 / slidesCount); 3677 3678 3679 // поÑÑÑоение 3680 this.render = function (offset, angleOffset) { 3681 // ÑмеÑение, еÑли бÑло пеÑедано 3682 offset = offset || 0; 3683 angleOffset = angleOffset || 0; 3684 3685 for (var iter = 0; iter < slidesCount; iter++) { 3686 var elem = slides[iter], 3687 $elem = $(elem), // jQuery ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð´Ð»Ñ Ð¿Ð¾Ð·Ð¸ÑиониÑÐ¾Ð²Ð°Ð½Ð¸Ñ 3688 slideWidth = parseInt($elem.width()), // ÑиÑина 3689 slideHeight = parseInt($elem.height()); // вÑÑоÑа 3690 3691 // вÑÑиÑление кооÑÐ´Ð¸Ð½Ð°Ñ ÑлеменÑа 3692 3693 // cx - ÑенÑÑ Ð¾Ð¥, 3694 // r * cos() - абÑÑиÑÑа без ÑмеÑений, 3695 // - slideWidth(ибо ÑÑÑоиÑÑÑ Ð¿Ð¾ веÑÑ .Ð»ÐµÐ²Ð¾Ð¼Ñ ÑглÑ), 3696 // -offset - ÑÑÑное ÑмеÑение, 3697 // xOffset - изнаÑалÑное ÑмеÑение 3698 3699 // абÑÑиÑÑа 3700 var toLeft = Math.round(cx + (options.radius * Math.cos(slideAngle * (iter + angleOffset))) - slideWidth - offset - options.xOffset); 3701 // оÑдинаÑа 3702 var toTop = Math.round(cy + (options.radius * Math.sin(slideAngle * (iter + angleOffset))) - slideHeight - offset - options.yOffset); 3703 3704 $elem.animate({ 3705 left: toLeft, 3706 top: toTop, 3707 opacity: 1 3708 }, options.animationSpeed); 3709 } 3710 } 3711 3712 this.render(); 3713 3714 return this; 3715} 3716 3717 3718$.fn.DHTMLCircle = DHTMLCircle; 3719 3720document.addEventListener("DOMContentLoaded", () => { 3721 Fancybox.bind(".article__inner p img", { 3722 Image: { 3723 zoom: true, 3724 }, 3725 }); 3726 3727 (() => { 3728 const fixedButtons = document.querySelector(".fixed-buttons-wrapper"); 3729 const childrenCount = fixedButtons?.children; 3730 3731 if (childrenCount?.length === 1 && childrenCount[0].classList.contains("js-socials")) { 3732 fixedButtons?.classList?.add("align-right"); 3733 } 3734 3735 fixedButtons?.classList?.add("visible"); 3736 })() 3737})
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.