1var Mad = (function($){ 2 'use strict'; 3 4 var App = {}, 5 DOMDfd = $.Deferred(), 6 $body = $('body'), 7 $doc = $(document); 8 9 App.modules = {}; 10 App.helpers = {}; 11 App._localCache = {}; 12 13 App.ISTOUCH = Modernizr.touchevents; 14 App.ANIMATIONDURATION = 500; 15 App.ANIMATIONEASING = 'easeOutQuart'; 16 App.ANIMATIONSUPPORTED = Modernizr.cssanimations; 17 App.ANIMATIONEND = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend"; 18 App.RTL = getComputedStyle(document.body).direction === 'rtl'; 19 App.ISLEGACYBROWSER = !Modernizr.flexbox; 20 App.ISFIREFOX = window.navigator.userAgent.indexOf('Firefox') != -1; 21 22 App.afterDOMReady = function() { 23 var self = this; 24 25 if (this.ISFIREFOX) window.onunload = function(){}; 26 27 // Show message to update legacy browser 28 if(this.ISLEGACYBROWSER) { 29 if(this.helpers.showCriticalFullScreenMessage) { 30 this.helpers.showCriticalFullScreenMessage({ 31 before: '<i class="icon icon-sad"></i>', 32 content: 'Your browser does not support some technologies this site use. Please update your browser or visit the site using more modern browser.' 33 }); 34 } 35 36 // Anyway preloader must be used 37 if(this.modules.preloader) this.modules.preloader(); 38 39 return; 40 } 41 42 if(this.modules.backToTop) { 43 this.modules.backToTop({ 44 easing: 'easeOutQuint', 45 speed: 550, 46 cssPrefix: 'mad-' 47 }); 48 } 49 50 if(this.helpers.toggledFields) this.helpers.toggledFields(); 51 52 if(window.MadEventsCalendar) window.MadEventsCalendar.init($('.mad-events-calendar'), { 53 isTouch: self.ISTOUCH, 54 cssPrefix: 'mad-', 55 breakpoint: 768 56 }); 57 58 if(window.MadSidebarHidden) { 59 new window.MadSidebarHidden({ 60 cssPrefix: 'mad-' 61 }); 62 } 63 64 if(window.MadStickyHeaderSection) { 65 var $stickySections = $('[class*="mad-header-section--sticky"]:not([class*="mad-header-section--sticky-hidden"])'); 66 67 if($stickySections.length) { 68 new window.MadStickyHeaderSection($stickySections, { 69 animationEasing: self.ANIMATIONEASING, 70 animationDuration: self.ANIMATIONDURATION 71 }); 72 } 73 } 74 75 if(this.modules.dropdown) this.modules.dropdown.init(); 76 77 if(this.modules.closeBtn) this.modules.closeBtn(); 78 79 if(this.modules.hiddenSections) this.modules.hiddenSections(); 80 81 if(this.modules.viewTypes) this.modules.viewTypes(); 82 83 if(this.helpers.calendarWidget) this.helpers.calendarWidget(); 84 85 /* ------------------------------------------------ 86 Range Slider 87 ------------------------------------------------ */ 88 89 var $rangeSliders = $('.mad-range-slider'); 90 91 if ($.fn.slider && $rangeSliders.length) { 92 $rangeSliders.slider({ 93 range: "min" 94 }); 95 } 96 97 var $rangeSliders2 = $('.mad-range-slider.range-scale.range-2'); 98 99 if ($.fn.slider && $rangeSliders2.length) { 100 $rangeSliders2.slider({ 101 min: 0, 102 max: 7, 103 value: 3, 104 slide: function (event, ui) { 105 var $range = $(ui.handle).closest('.mad-range-slider'), 106 $input = $range.siblings('.mad-range-slider-input'); 107 108 if ($range.length && $input.length) { 109 $input.attr('value', + $range.slider('values', 1) + ' - ' + '$' + $range.slider('values', 0)) 110 .val('$' + $range.slider('values', 1) + ',999,000'); 111 } 112 } 113 }); 114 } 115 116 var $rangeSliders3 = $('.mad-range-slider.range-scale.range-3'); 117 118 if ($.fn.slider && $rangeSliders3.length) { 119 $rangeSliders3.slider({ 120 min: 100, 121 max: 600, 122 value: 300, 123 slide: function (event, ui) { 124 var $range = $(ui.handle).closest('.mad-range-slider'), 125 $input = $range.siblings('.mad-range-slider-input'); 126 127 if ($range.length && $input.length) { 128 $input.attr('value', + $range.slider('values', 1) + ' - ' + '$' + $range.slider('values', 0)) 129 .val('$' + $range.slider('values', 1) + ',880'); 130 } 131 } 132 }); 133 } 134 135 var $rangeSliders4 = $('.mad-range-slider.range-scale.range-4'); 136 137 if ($.fn.slider && $rangeSliders4.length) { 138 $rangeSliders4.slider({ 139 min: 0, 140 max: 6, 141 value: 4, 142 slide: function (event, ui) { 143 var $range = $(ui.handle).closest('.mad-range-slider'), 144 $input = $range.siblings('.mad-range-slider-input'); 145 146 if ($range.length && $input.length) { 147 $input.attr('value', + $range.slider('values', 1) + ' - ' + 'km' + $range.slider('values', 0)) 148 .val($range.slider('values', 1) + '%'); 149 } 150 } 151 }); 152 } 153 154 /* ------------------------------------------------ 155 End of Range Slider 156 ------------------------------------------------ */ 157 158 /* ------------------------------------------------ 159 Twitter 160 ------------------------------------------------ */ 161 162 var $twitterFeed = $('.mad-twitter-feed'); 163 164 if ($twitterFeed.length && $.fn.tweetie) { 165 $twitterFeed.tweetie({ 166 url: 'http://velikorodnov.com/html/ewent/vendors/tweetie/api/php/server.php', 167 type: 'timeline', 168 template: '<li>\ 169 <div class="mad-tweet">\ 170 <div class="mad-tweet-content">{{tweet.text}}</div>\ 171 \ 172 </div>\ 173 </li>', 174 dateFormat: '%B %d, %Y', 175 params: { 176 count: 2, 177 screen_name: null, 178 list_id: null, 179 slug: null, 180 q: null, 181 exclude_replies: false, 182 include_rts: false 183 } 184 }) 185 } 186 187 /* ------------------------------------------------ 188 End of Twitter 189 ------------------------------------------------ */ 190 191 192 /* ------------------------------------------------
193 Custom Select 194 ------------------------------------------------ */ 195 196 var $selects = $('.mad-custom-select'); 197 198 if($selects.length){ 199 $selects.MadCustomSelect({ 200 cssPrefix: 'mad-' 201 }); 202 } 203 204 /* ------------------------------------------------ 205 End of Custom Select 206 ------------------------------------------------ */ 207 208 /* ------------------------------------------------ 209 Newsletter Form 210 ------------------------------------------------ */ 211 212 var newsletterForm = $('.mad-newsletter-form'); 213 214 if(newsletterForm.length && window.MadNewsletter) { 215 window.MadNewsletter(newsletterForm); 216 } 217 218 /* ------------------------------------------------ 219 End of Newsletter Form 220 ------------------------------------------------ */ 221 222 /* ------------------------------------------------ 223 Contact Form 224 ------------------------------------------------ */ 225 226 var contactForm = $('.mad-contact-form'); 227 228 if(contactForm.length && window.MadContactForm) { 229 MadContactForm.init(contactForm); 230 } 231 232 /* ------------------------------------------------ 233 End of Contact Form 234 ------------------------------------------------ */ 235 236 /* ---------------------------------------- 237 Fancybox 238 ---------------------------------------- */ 239 240 if($.fancybox && $.fancybox.defaults) { 241 $.extend($.fancybox.defaults, { 242 transitionEffect: "slide", 243 transitionDuration: self.ANIMATIONDURATION, 244 animationDuration: self.ANIMATIONDURATION 245 }); 246 } 247 248 /* ---------------------------------------- 249 End of Fancybox 250 ---------------------------------------- */ 251 252 if(this.modules.arcticModals) this.modules.arcticModals.init( $('[data-arctic-modal]') ); 253 254 /* ------------------------------------------------ 255 Navigation 256 ------------------------------------------------ */ 257 258 var $nav = $('.mad-navigation'), 259 $verticalNav = $('.mad-navigation-vertical'); 260 261 if($nav.length){ 262 $nav.MonkeysanNav({ 263 cssPrefix: 'mad-', 264 mobileBreakpoint: 769 265 }); 266 } 267 268 if($verticalNav.length){ 269 $verticalNav.MonkeysanNav({ 270 cssPrefix: 'mad-', 271 mobileBreakpoint: 10000 272 }); 273 } 274 275 $('.mad-navigation > li > a').on('click', function (e) { 276 277 e.preventDefault; 278 279 }) 280 281 /* ------------------------------------------------ 282 End of Navigation 283 ------------------------------------------------ */ 284 285 /* ------------------------------------------------ 286 Countdown 287 ------------------------------------------------ */ 288 289 var $countdown = $('.mad-countdown'); 290 291 if($countdown.length){ 292 $countdown.each(function(){ 293 var $this = $(this), 294 endDate = $this.data(), 295 until = new Date( 296 endDate.year, 297 endDate.month || 0, 298 endDate.day || 1, 299 endDate.hours || 0, 300 endDate.minutes || 0, 301 endDate.seconds || 0 302 ); 303 304 $this.countdown({ 305 until : until, 306 padZeroes: true, 307 format : 'dHMS', 308 labels : ['Years', 'Month', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'], 309 labels1 : ['Years', 'Month', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'] 310 }); 311 }); 312 } 313 314 /* ------------------------------------------------ 315 End countdown 316 ------------------------------------------------ */ 317 318 /* ------------------------------------------------ 319 Instagram 320 ------------------------------------------------ */ 321 322 if (window.InstafeedWrapper) { 323 var instafeeds = document.querySelectorAll('.mad-instafeed > .mad-grid'), 324 galleryInstafeeds = document.querySelectorAll('.mad-instafeed-gallery'); 325 326 InstafeedWrapper.setUsersSecureOptions({ 327 'customer': { 328 userId: 8253949243, 329 accessToken: '8253949243.1677ed0.92a1c427f7274134a812ee9b13038e10', 330 clientId: 'a17ccf850aae43a0805c00ac4792a3b9' 331 } 332 }); 333 334 if (instafeeds) { 335 InstafeedWrapper.init(instafeeds, { 336 resolution: 'standard_resolution', 337 template: '<div class="mad-grid-item"><div class="mad-square-image" data-bg-image-src="{{image}}"><a rel="instagram" href="{{link}}" target="_blank" title="{{caption}}"></a></div></div>', 338 after: function () { 339 var $target = $('#' + this.options.target), 340 size = $target.data('images-y-size'), 341 posX = $target.data('images-pos-x') || 'center', 342 posY = $target.data('images-pos-y') || 'center', 343 $items = $target.find('.mad-square-image'); 344 345 if ($items.length) { 346 347 $items.addClass('mad-square-image--position-' + posX + '-' + posY); 348 349 if (size) $items.addClass('mad-square-image--size-' + size); 350 } 351 352 self.helpers.dynamicBgImage($target.find('[data-bg-image-src]')); 353 } 354 }); 355 } 356 }; 357 358 /* ------------------------------------------------ 359 End of Instagram 360 ------------------------------------------------ */ 361 362 /* ------------------------------------------------ 363 Revolution slider 364 ------------------------------------------------ */ 365 366 var $revSlider1 = $('#rev-slider-1'), 367 $revSlider2 = $('#rev-slider-2'), 368 revApi1, 369 revApi2; 370 371 if($revSlider1.length && $.fn.revolution) { 372 revApi1 = $revSlider1.show().revolution({ 373 dottedOverlay: 'mad', 374 disableProgressBar: "on", 375 spinner: 'spinner3', 376 gridheight: [1080, 1080, 980, 980], 377 gridwidth: [1580, 1024, 813, 520], 378 responsiveLevels: [1440, 1025, 813, 520], 379 navigation: { 380 keyboardNavigation: 'on', 381 keyboard_direction: 'horizontal', 382 onHoverStop: 'false', 383 arrows: { 384 enable: false, 385 }, 386 bullets: { 387 enable: true, 388 style: 'mad', 389 hide_onleave: false, 390 h_align: 'left', 391 v_align: 'bottom', 392 direction: 'horisontal', 393 h_offset: 172, 394 v_offset: 64 395 } 396 } 397 }); 398 } 399 400 if ($revSlider2.length && $.fn.revolution) { 401 revApi2 = $revSlider2.show().revolution({ 402 dottedOverlay: 'mad', 403 disableProgressBar: "on", 404 spinner: 'spinner3', 405 gridheight: [1080, 1080, 980, 980], 406 gridwidth: [1580, 1024, 813, 520], 407 responsiveLevels: [1440, 1024, 813, 520], 408 navigation: { 409 keyboardNavigation: 'on', 410 keyboard_direction: 'horizontal', 411 onHoverStop: 'false', 412 arrows: { 413 enable: false, 414 }, 415 bullets: { 416 enable: true, 417 style: 'mad', 418 hide_onleave: false, 419 h_align: 'center', 420 v_align: 'bottom', 421 direction: 'horisontal', 422 v_offset: 64, 423 h_offset: 0 424 } 425 } 426 }); 427 } 428 429 if(this.helpers.revArrowsOutside) this.helpers.revArrowsOutside(); 430 431 if($('#rev-slider-1').length) { 432 var api = revApi1; 433 434 /* no need to edit below */ 435 var divider = ' / ', 436 totalSlides, 437 numberText; 438 439 api.one('revolution.slide.onloaded', function () { 440 441 totalSlides = api.revmaxslide(); 442 numberText = api.find('.slide-status-numbers').text('0' + '1' + divider + '0' + totalSlides); 443 444 api.on('revolution.slide.onbeforeswap', function (e, data) { 445 446 numberText.text('0' + (data.nextslide.index() + 1) + divi
446der + '0' + totalSlides); 447 448 }); 449 450 }); 451 } 452 453 /* ------------------------------------------------ 454 End of Revolution slider 455 ------------------------------------------------ */ 456 457 /* ------------------------------------------------ 458 Accordions & Toggles 459 ------------------------------------------------ */ 460 461 var $accordions = $('.mad-panels--accordion'), 462 $toggles = $('.mad-panels--toggles'); 463 464 if($accordions.length) { 465 $accordions.MonkeysanAccordion({ 466 easing: self.ANIMATIONEASING, 467 speed: self.ANIMATIONDURATION, 468 cssPrefix: 'mad-' 469 }); 470 } 471 472 if($toggles.length) { 473 $toggles.MonkeysanAccordion({ 474 easing: self.ANIMATIONEASING, 475 speed: self.ANIMATIONDURATION, 476 toggle: true, 477 cssPrefix: 'mad-' 478 }); 479 } 480 481 /* ------------------------------------------------ 482 End of Accordions & Toggles 483 ------------------------------------------------ */ 484 485 /* ---------------------------------------- 486 Alert Boxes 487 ---------------------------------------- */ 488 489 var $alertBoxes = $('.mad-alert-box'); 490 491 if($alertBoxes.filter('.mad-alert-box--success').length) { 492 MadAlertBox.init($alertBoxes.filter('.mad-alert-box--success'), { 493 duration: self.ANIMATIONDURATION, 494 cssPrefix: 'mad-', 495 easing: self.ANIMATIONEASING, 496 type: 'success' 497 }); 498 } 499 500 if($alertBoxes.filter('.mad-alert-box--warning').length) { 501 MadAlertBox.init($alertBoxes.filter('.mad-alert-box--warning'), { 502 duration: self.ANIMATIONDURATION, 503 cssPrefix: 'mad-', 504 easing: self.ANIMATIONEASING, 505 type: 'warning' 506 }); 507 } 508 509 if($alertBoxes.filter('.mad-alert-box--info').length) { 510 MadAlertBox.init($alertBoxes.filter('.mad-alert-box--info'), { 511 duration: self.ANIMATIONDURATION, 512 cssPrefix: 'mad-', 513 easing: self.ANIMATIONEASING, 514 type: 'info' 515 }); 516 } 517 518 if($alertBoxes.filter('.mad-alert-box--error').length) { 519 MadAlertBox.init($alertBoxes.filter('.mad-alert-box--error'), { 520 duration: self.ANIMATIONDURATION, 521 cssPrefix: 'mad-', 522 easing: self.ANIMATIONEASING, 523 type: 'error' 524 }); 525 } 526 527 /* ---------------------------------------- 528 End of Alert Boxes 529 ---------------------------------------- */ 530 531 /* ---------------------------------------- 532 Tooltips 533 ---------------------------------------- */ 534 535 if( $('[data-tooltip]').length && $.fn.MonkeysanTooltip ) { 536 $('[data-tooltip]').MonkeysanTooltip({ 537 animationIn: 'fadeInDown', 538 animationOut: 'fadeOutUp', 539 tooltipPosition: 'top', 540 jQueryAnimationEasing: self.ANIMATIONEASING, 541 jQueryAnimationDuration: self.ANIMATIONDURATION, 542 skin: 'mad' 543 }); 544 } 545 546 /* ---------------------------------------- 547 End of Tooltips 548 ---------------------------------------- */ 549 550 /* ---------------------------------------- 551 IsotopeWrapper 552 ---------------------------------------- */ 553 554 $(window).on('load resize', function () { 555 556 var $isotope = $('.mad-grid--isotope:not(.mad-sponsors)'); 557 558 if ($isotope.length && window.MadIsotopeWrapper) { 559 $isotope.each(function (index, container) { 560 var $container = $(container), 561 $stretchedSection = $container.closest('.mad-section--stretched-content, .mad-section--stretched-content-no-px'); 562 563 if ($stretchedSection.length) { 564 $stretchedSection.on('stretched.mad.Section', function () { 565 if ($container.data('IsotopeWrapper')) return; 566 567 MadIsotopeWrapper.init($container, { 568 itemSelector: '.mad-grid-item', 569 transitionDuration: self.ANIMATIONDURATION 570 }); 571 }); 572 } 573 else { 574 MadIsotopeWrapper.init($container, { 575 itemSelector: '.mad-grid-item', 576 transitionDuration: self.ANIMATIONDURATION 577 }); 578 } 579 }); 580 } 581 582 if ($isotope.length && window.MadIsotopeWrapper) { 583 $isotope.each(function (index, container) { 584 var $container = $(container), 585 $stretchedSection = $container.closest('.mad-section--stretched-content, .mad-section--stretched-content-no-px'); 586 587 if ($stretchedSection.length) { 588 $stretchedSection.on('stretched.mad.Section', function () { 589 if ($container.data('IsotopeWrapper')) return; 590 591 MadIsotopeWrapper.init($container, { 592 itemSelector: '.mad-grid-item', 593 transitionDuration: self.ANIMATIONDURATION 594 }); 595 }); 596 } 597 else { 598 MadIsotopeWrapper.init($container, { 599 itemSelector: '.mad-grid-item', 600 transitionDuration: self.ANIMATIONDURATION 601 }); 602 } 603 }); 604 } 605 606 }); 607 608 609 /* ---------------------------------------- 610 End of IsotopeWrapper 611 ---------------------------------------- */ 612 613 /* ---------------------------------------- 614 Dynamic background image 615 ---------------------------------------- */ 616 617 var $backgrounds = $('[data-bg-image-src]:not([class*="mad-colorizer--scheme-"])'); 618 619 if($backgrounds.length && this.helpers.dynamicBgImage) { 620 this.helpers.dynamicBgImage($backgrounds); 621 } 622 623 /* ---------------------------------------- 624 End of Dynamic background image 625 ---------------------------------------- */ 626 627 /* ---------------------------------------- 628 Owl Carousel
629 ---------------------------------------- */ 630 631 // owl carousel adaptive 632 if($('.owl-carousel').length) this.helpers.owlAdaptive(); 633 634 var $simpleSlideshow = $('.mad-simple-slideshow'), 635 $testimonialsCarousel = $('.mad-testimonials-inner.owl-carousel'); 636 637 if($simpleSlideshow.length && $.fn.owlCarousel) { 638 $simpleSlideshow.each(function(index, carousel){ 639 var $carousel = $(carousel), 640 $stretchedSection = $carousel.closest('.mad-section--stretched-content, .mad-section--stretched-content-no-px'); 641 642 if($stretchedSection.length) { 643 $stretchedSection.each(function(scindex, scelement){ 644 $(scelement).on('stretched.mad.Section', function() { 645 $carousel.owlCarousel(self.helpers.owlSettings({ 646 margin: 1, 647 loop: true, 648 autoplay: $carousel.hasClass('mad-simple-slideshow--autoplay') 649 })); 650 }); 651 }); 652 } 653 else { 654 655 $carousel.owlCarousel(self.helpers.owlSettings({ 656 margin: 1, 657 animateOut: 'fadeOut', 658 navText: App.RTL ? ['<img class="svg" src="steakbreak_svg_icons/short_arrow_left.svg" alt="">', '<img class="svg" src="steakbreak_svg_icons/short_arrow_right.svg" alt="">'] : ['<img class="svg" src="steakbreak_svg_icons/short_arrow_left.svg" alt="">', '<img class="svg" src="steakbreak_svg_icons/short_arrow_right.svg" alt="">'], 659 loop: true, 660 autoplay: $carousel.hasClass('mad-simple-slideshow--autoplay') 661 })); 662 } 663 }); 664 } 665 666 if($testimonialsCarousel.length && $.fn.owlCarousel) { 667 $testimonialsCarousel.each(function(index, carousel) { 668 var $carousel = $(carousel), 669 $stretchedSection = $carousel.closest('.mad-section--stretched-content, .mad-section--stretched-content-no-px'); 670 671 if($stretchedSection.length) { 672 $stretchedSection.on('stretched.mad.Section', function() { 673 if($carousel.data('owl.carousel')) return; 674 $carousel.owlCarousel(self.helpers.owlSettings({ 675 margin: 0, 676 loop: true, 677 nav: true, 678 dots: true 679 })); 680 }); 681 } 682 else { 683 $carousel.owlCarousel(self.helpers.owlSettings({ 684 margin: 0, 685 loop: true, 686 nav: true, 687 dots: true 688 })); 689 } 690 }); 691 } 692 693 this.helpers.gridOwl.extendConfigFor('.with-dots', { 694 nav: true, 695 dots: true, 696 startPosition: 1, 697 loop: true 698 }); 699 700 this.helpers.gridOwl.extendConfigFor('.mad-testimonials', { 701 nav: true, 702 dots: true, 703 startPosition: 1, 704 autoplay: true, 705 margin: 60, 706 loop: true, 707 responsive: { 708 0: { 709 items: 1 710 }, 711 480: { 712 items: 1 713 }, 714 780: { 715 items: 1 716 }, 717 1200: { 718 items: 2 719 }, 720 1300: { 721 items: 2 722 } 723 }, 724 }); 725 726 this.helpers.gridOwl.extendConfigFor('.mad-testimonials .mad-grid--cols-1', { 727 nav: true, 728 dots: true, 729 startPosition: 1, 730 autoplay: true, 731 loop: true, 732 responsive: { 733 0: { 734 items: 1 735 }, 736 480: { 737 items: 1 738 }, 739 780: { 740 items: 1 741 }, 742 1200: { 743 items: 1 744 }, 745 1300: { 746 items: 1 747 } 748 }, 749 }); 750 751 this.helpers.gridOwl.extendConfigFor('.mad-products.owl-carousel', { 752 responsive: { 753 0: { 754 items: 1 755 }, 756 480: { 757 items: 1 758 }, 759 780: { 760 items: 1 761 }, 762 1200: { 763 items: 2 764 }, 765 1380: { 766 items: 3 767 } 768 } 769 }); 770 771 this.helpers.gridOwl.extendConfigFor('.mad-tabs--tour-sections .mad-products.owl-carousel', { 772 nav: true, 773 dots: false, 774 startPosition: 1, 775 autoplay: true, 776 loop: true, 777 responsive: { 778 0: { 779 items: 1 780 }, 781 480: { 782 items: 2 783 }, 784 780: { 785 items: 1 786 }, 787 1200: { 788 items: 2 789 }, 790 1300: { 791 items: 2 792 }, 793 1500: { 794 items: 4 795 } 796 } 797 }); 798 799 // Initialization owl carousels placed in the stretched sections 800 $('[class*="mad-section--stretched-content"]').on('stretched.mad.Section', function(event, $section) { 801 var $gridOwlCarousels = $section.find('.mad-grid.owl-carousel'), 802 $simpleThumbs = $section.find('.mad-simple-slideshow-thumbs.owl-carousel'); 803 804 if($gridOwlCarousels.length) self.helpers.gridOwl.add($gridOwlCarousels); 805 806 if($simpleThumbs.length) { 807 $simpleThumbs.owlCarousel(self.helpers.owlSettings({ 808 responsive: { 809 0: { 810 items: 2 811 }, 812 380: { 813 items: 3 814 }, 815 992: { 816 items: 4 817 }, 818 1200: { 819 items: 6 820 } 821 }, 822 margin: 10, 823 loop: false 824 })); 825 } 826 }); 827 828 // Initialization owl carousels placed in the normal sections 829 var $simpleThumbs = $('.mad-simple-slideshow-thumbs.owl-carousel').filter(function(index, element){ 830 return !$(element).closest('[class*="mad-section--stretched-content"]').length; 831 }); 832 833 if($simpleThumbs.length) { 834 $simpleThumbs.owlCarousel(self.helpers.owlSettings({ 835 responsive: { 836 0: { 837 items: 2 838 }, 839 380: { 840 items: 3 841 }, 842 992: { 843 items: 4 844 }, 845 1200: { 846 items: 6 847 } 848 }, 849 margin: 10, 850 dots: true, 851 loop: false 852 })); 853 } 854 855 this.helpers.gridOwl.add($('.mad-grid.owl-carousel').filter(function(index, element){ 856 return !$(element).closest('[class*="mad-section--stretched-content"]').length; 857 })); 858 859 this.helpers.owlSync.init(); 860 861 /* ---------------------------------------- 862 End of Owl Carousel
863 ---------------------------------------- */ 864 865 /* ---------------------------------------- 866 Rating 867 ---------------------------------------- */ 868 869 var $ratingFields = $('.mad-rating-field'), 870 $ratings; 871 872 if($ratingFields.length) { 873 $ratings = $ratingFields.find('.mad-rating'); 874 875 if($ratings.length) { 876 $ratings.on('built.mad.Rating', function(event, $rating) { 877 var $tabs = $rating.closest('.mad-tabs'), 878 Tabs; 879 880 if($tabs.length) { 881 Tabs = $tabs.data('tabs'); 882 883 if(Tabs) Tabs.updateContainer(); 884 } 885 }); 886 } 887 } 888 889 if (this.helpers.rating) this.helpers.rating($('.mad-rating:not(.mad-rating--independent)'), { 890 topLevelElements: '<i class="mad-icon"><img class="svg" src="steakbreak_svg_icons/star.svg" alt=""></i>', 891 bottomLevelElements: '<i class="mad-icon"><img class="svg" src="steakbreak_svg_icons/star.svg" alt=""></i>' 892 }); 893 894 if (this.helpers.rating) this.helpers.rating($('.mad-rating--independent'), { 895 topLevelElements: '<i class="mad-icon"><img class="svg" src="steakbreak_svg_icons/star.svg" alt=""></i>', 896 bottomLevelElements: '<i class="mad-icon"><img class="svg" src="steakbreak_svg_icons/star.svg" alt=""></i>' 897 }); 898 899 if (this.helpers.ratingField) this.helpers.ratingField($('.mad-rating-field')); 900 901 /* ---------------------------------------- 902 End of Rating 903 ---------------------------------------- */ 904 905 DOMDfd.resolve(); 906 907 }; 908 909 App.afterOuterResourcesLoaded = function() { 910 911 var self = this; 912 913 // Stop initializing any modules in case legacy browser is using 914 if(this.ISLEGACYBROWSER) return; 915 916 var $sections = $('.mad-section'); 917 918 if(this.helpers.Colorizer) this.helpers.Colorizer.init($('[class*="mad-colorizer--scheme-"]')); 919 920 if(this.modules.Section && $sections.length) { 921 this.modules.Section.init($sections); 922 } 923 924 if(this.helpers.Breadcrumb) this.helpers.Breadcrumb.init($('.mad-header--transparent + .mad-breadcrumb[data-bg-image-src]')); 925 926 if(this.helpers.fullScreenArea) this.helpers.fullScreenArea.init({ 927 except: $('#mad-header:not(.mad-header--transparent)').add($('#mad-footer')) 928 }); 929 930 /* ---------------------------------------- 931 SameHeight 932 ---------------------------------------- */ 933 934 if ($.fn.MonkeysanSameHeight) { 935 936 var $sameheightContainers = $('.mad-entities--style-6 .mad-grid:not([data-isotope-layout="masonry"]):not(.mad-grid--cols-1), .mad-entities--style-7 .mad-grid:not([data-isotope-layout="masonry"]):not(.mad-grid--cols-1), .mad-entities--style-8 .mad-grid:not([data-isotope-layout="masonry"]):not(.mad-grid--cols-1)').not('.mad-shortcode-container'), 937 $pricingTables = $('.mad-portfolio'); 938 939 if ($sameheightContainers.length) { 940 941 $sameheightContainers.each(function (index, container) { 942 var $container = $(container), 943 $items = $container.find('.mad-grid-item'); 944 945 if ($items.length) { 946 $container.MonkeysanSameHeight({ 947 target: $container.closest('.mad-entities--style-7').length ? '.mad-entity' : '.mad-entity-content .mad-aligner-inner', 948 isIsotope: $container.find('.mad-grid--isotope').length, 949 columns: $items.length ? Math.floor($container.outerWidth() / $items.first().outerWidth()) : null 950 }); 951 } 952 }); 953 } 954 955 if ($pricingTables.length) { 956 957 $pricingTables.each(function (index, container) { 958 var $container = $(container), 959 $items = $container.find('.mad-grid-item'); 960 961 if ($items.length) { 962 $container.MonkeysanSameHeight({ 963 target: '.mad-gallery-item', 964 isIsotope: $container.find('.mad-grid--isotope').length, 965 columns: $items.length ? Math.ceil($container.outerWidth() / $items.first().outerWidth()) : null 966 }); 967 } 968 }); 969 } 970 } 971 972 /* ---------------------------------------- 973 End of SameHeight 974 ---------------------------------------- */ 975 976 /* ---------------------------------------- 977 Tabs & Tour Sections 978 ---------------------------------------- */ 979 980 var $tabs = $('.mad-tabs'); 981 982 if($tabs.length) { 983 $tabs.MonkeysanTabs({ 984 speed: self.ANIMATIONDURATION, 985 easing: self.ANIMATIONEASING, 986 cssPrefix: 'mad-' 987 }); 988 $('.mad-tabs-nav .mad-tab-link').on('click', function () { 989 $('.owl-carousel').trigger('refresh.owl.carousel'); 990 $('.inner-container').css({ 'height': ($(".inner-container .mad-tab.mad-active").height() + 'px') }); 991 }); 992 var $utabs = $('.mad-tabs').data('tabs'); 993 $('.mad-iso-tabs .mad-tabs-nav .mad-tab-link').on('click', function () { 994 setTimeout(function () { 995 $utabs.updateContainer(); 996 }, 300); 997 }); 998 } 999 1000 var tabs = $('.tabs-section'); 1001 if (tabs.length) { 1002 tabs.tabs({ 1003 active: 0, 1004 beforeActivate: function (event, ui) { 1005 var hash = ui.newTab.find("li a").attr("href"); 1006 }, 1007 hide: { 1008 effect: "fadeOut", 1009 duration: 450 1010 }, 1011 show: { 1012 effect: "fadeIn", 1013 duration: 450 1014 }, 1015 updateHash: false 1016 }); 1017 } 1018 1019 /* ---------------------------------------- 1020 End of Tabs & Tour Sections 1021 ---------------------------------------- */ 1022 1023 if(this.modules.preloader) this.modules.preloader(); 1024 1025 var $parallaxSections = $('.mad-colorizer--parallax .mad-colorizer-bg-image'); 1026 1027 if($parallaxSections.length) { 1028 $parallaxSections.parallax("50%",.4); 1029 } 1030 }; 1031 1032 /* ---------------------------------------- 1033 Back to top 1034 ---------------------------------------- */ 1035 1036 App.modules.backToTop = function(config) { 1037 1038 var backToTop = { 1039 1040 init: function(config){ 1041 1042 var self = this; 1043 1044 if(config) this.config = $.extend(this.config, config); 1045 1046 this.btn = $('<button></button>', { 1047 class: self.config.cssPrefix+'back-to-top animated stealthy', 1048 html: '<span class="icon material-icons">expand_less</span>' 1049 }); 1050 1051 this.bindEvents(); 1052 1053 $body.append(this.btn); 1054 1055 }, 1056 1057 config: { 1058 breakpoint: 700, 1059 showClass: 'zoomIn', 1060 hideClass: 'zoomOut', 1061 easing: 'linear', 1062 speed: 500, 1063 cssPrefix: '' 1064 }, 1065 1066 bindEvents: function(){ 1067 1068 var page = $('html, body'), 1069 self = this; 1070 1071 this.btn.on('click', function(e){ 1072 1073 page.stop().animate({ 1074 1075 scrollTop: 0 1076 1077 }, { 1078 easing: self.config.easing, 1079 duration: self.config.speed 1080 }); 1081 1082 }); 1083 1084 this.btn.on(App.ANIMATIONEND, function(e){ 1085 1086 e.preventDefault(); 1087 1088 var $this = $(this); 1089 1090 if($this.hasClass(self.config.hideClass)){ 1091 1092 $this 1093 .addClass('stealthy') 1094 .removeClass(self.config.hideClass + " " + self.config.cssPrefix + "inview"); 1095 1096 } 1097 1098 }); 1099 1100 $(window).on('scroll.backtotop', { self: this}, this.toggleBtn); 1101 1102 }, 1103 1104 toggleBtn: function(e){ 1105 1106 var $this = $(this), 1107 self = e.data.self; 1108 1109 if($this.scrollTop() > self.config.breakpoint && !self.btn.hasClass(self.config.cssPrefix + 'inview')){ 1110 1111 self.btn 1112 .addClass(self.config.cssPrefix + 'inview') 1113 .removeClass('stealthy'); 1114 1115 if(App.ANIMATIONSUPPORTED){ 1116 self.btn.addClass(self.config.showClass); 1117 } 1118 1119 } 1120 else if($this.scrollTop() < self.config.breakpoint && self.btn.hasClass(self.config.cssPrefix + 'inview')){ 1121 1122 self.btn.removeClass(self.config.cssPrefix + 'inview'); 1123 1124 if(!App.ANIMATIONSUPPORTED){ 1125 self.btn.addClass('stealthy'); 1126 } 1127 else{ 1128 self.btn.removeClass(self.config.showClass) 1129 .addClass(self.config.hideClass); 1130 } 1131 1132 } 1133 1134 } 1135 1136 }; 1137 1138 backToTop.init(config); 1139 1140 return this; 1141 1142 }; 1143 1144 /* ---------------------------------------- 1145 End of Back to top 1146 ---------------------------------------- */ 1147 1148 /* ---------------------------------------- 1149 Preloader 1150 ---------------------------------------- */ 1151 1152 App.modules.preloader = function() { 1153 var $preloader = $('.mad-preloader'), 1154 leftPos = parseInt($preloader.css('margin-left'), 10), 1155 topPos = parseInt($preloader.css('margin-top'), 10), 1156 $w = $(window), 1157 $nav = $('.mad-navigation, .mad-navigation-vertical'); 1158 1159 if($nav.length) { 1160 $nav.off('click.MadPreloader').on('click.MadPreloader', 'a', function(event){ 1161 1162 var $this = $(this),
1163 $circle = $('<div></div>', { 1164 style: 'left: '+ event.clientX +'px; top: '+ event.clientY +'px;', 1165 class: 'mad-preloader-circle' 1166 }); 1167 1168 if($body.hasClass('mad-body--moving-to-another-page')) { 1169 $circle.appendTo($body); 1170 1171 setTimeout(function(){ 1172 $circle.addClass('mad-preloader-circle--appearing'); 1173 }, 20); 1174 } 1175 }); 1176 } 1177 1178 if(!$preloader.length) return; 1179 1180 $body.off('mousemove.MadPreloader').on('mousemove.MadPreloader', function(event) { 1181 $preloader.css({ 1182 'margin-left': leftPos - ($w.width() / 2 - event.pageX), 1183 'margin-top': topPos - ($w.height() / 2 - (event.pageY - $w.scrollTop())), 1184 }); 1185 }).jQueryImagesLoaded().then(function(){ 1186 1187 $preloader.addClass('mad-preloader--disappearing'); 1188 setTimeout(function() { 1189 $preloader.remove(); 1190 $body.off('mousemove.MadPreloader'); 1191 }, 700); 1192 // can be removed in production (demo only): 1193 if(window.location.hash == '#mad-footer') { 1194 $('html, body').stop().animate({ 1195 scrollTop: $doc.height() 1196 }, { 1197 duration: self.ANIMATIONDURATION, 1198 easing: self.ANIMATIONEASING 1199 }); 1200 } 1201 }); 1202 }; 1203 1204 /* ---------------------------------------- 1205 End of Preloader 1206 ---------------------------------------- */ 1207 1208 /* ---------------------------------------- 1209 Dropdown 1210 ---------------------------------------- */ 1211 1212 App.modules.dropdown = {}; 1213 1214 App.modules.dropdown.config = { 1215 uncloseable: '.mad-dropdown, .select2-container--mad', 1216 cssPrefix: 'mad-', 1217 availableError: 30, 1218 rtl: App.RTL, 1219 classMap: { 1220 active: 'dropdown--opened', 1221 container: 'dropdown', 1222 title: 'dropdown-title', 1223 element: 'dropdown-element', 1224 leftPlaced: 'dropdown-element--x-left', 1225 rightPlaced: 'dropdown-element--x-right', 1226 topPlaced: 'dropdown-element--y-top' 1227 } 1228 }; 1229 1230 App.modules.dropdown.init = function(config) { 1231 if(this._initialized) return; 1232 1233 if($.isPlainObject(config)) $.extend(true, this.config, config); 1234 1235 Object.defineProperties(this, { 1236 activeClass: { 1237 get: function() { 1238 return this.config.cssPrefix + this.config.classMap.active; 1239 } 1240 }, 1241 containerClass: { 1242 get: function() { 1243 return this.config.cssPrefix + this.config.classMap.container; 1244 } 1245 }, 1246 titleClass: { 1247 get: function() { 1248 return this.config.cssPrefix + this.config.classMap.title; 1249 } 1250 }, 1251 elementClass: { 1252 get: function() { 1253 return this.config.cssPrefix + this.config.classMap.element; 1254 } 1255 }, 1256 rightPlacedClass: { 1257 get: function() { 1258 return this.config.cssPrefix + this.config.classMap.rightPlaced; 1259 } 1260 }, 1261 leftPlacedClass: { 1262 get: function() { 1263 return this.config.cssPrefix + this.config.classMap.leftPlaced; 1264 } 1265 }, 1266 topPlacedClass: { 1267 get: function() { 1268 return this.config.cssPrefix + this.config.classMap.topPlaced; 1269 } 1270 }, 1271 $dropdowns: { 1272 get: function() { 1273 return $('.' + this.containerClass); 1274 } 1275 } 1276 }); 1277 1278 this._bindEvents(); 1279 }; 1280 1281 App.modules.dropdown._bindEvents = function() { 1282 var self = this; 1283 1284 $doc.off('click.MadDropdown').on('click.MadDropdown', function(e) { 1285 var $target = $(e.target); 1286 1287 if(!$target.closest(self.config.uncloseable).length) { 1288 self.close(self.$dropdowns); 1289 } 1290 }).on('keydown.MadDropdown', function(event) { 1291 if(event.keyCode && event.keyCode == 27) { 1292 self.close(self.$dropdowns); 1293 } 1294 }); 1295 1296 $body.off('click.MadDropdown').on('click.MadDropdown', '.' + self.titleClass, function(e) { 1297 var $dropdown = $(this).closest('.' + self.containerClass), 1298 $others = self.$dropdowns.not($dropdown); 1299 1300 if($dropdown.length) { 1301 self.toggle($dropdown); 1302 e.preventDefault(); 1303 } 1304 1305 self.close($others); 1306 }); 1307 1308 this._initialized = true; 1309 }; 1310 1311 App.modules.dropdown.close = function($dropdowns) { 1312 if(!$.isjQuery($dropdowns, true)) return; 1313 1314 $dropdowns.removeClass(this.activeClass) 1315 .find('.' + this.elementClass) 1316 .attr('aria-hidden', 'true') 1317 .end() 1318 .find('.' + this.titleClass) 1319 .attr('aria-expanded', 'false'); 1320 }; 1321 1322 App.modules.dropdown.open = function($dropdowns) { 1323 if(!$.isjQuery($dropdowns, true)) return; 1324 1325 this.fixPosition($dropdowns); 1326 1327 $dropdowns.addClass(this.activeClass) 1328 .find('.' + this.elementClass) 1329 .attr('aria-hidden', 'false') 1330 .end() 1331 .find('.' + this.titleClass) 1332 .attr('aria-expanded', 'true'); 1333 }; 1334 1335 App.modules.dropdown.fixPosition = function($dropdowns) { 1336 var self = this, 1337 $w = $(window); 1338 1339 if(!$.isjQuery($dropdowns, true)) return; 1340 1341 return $dropdowns.each(function(index, dropdown) { 1342 var $dropdown = $(dropdown), 1343 $element = $dropdown.find('.' + self.elementClass), 1344 dOffset; 1345 1346 $element.removeClass(self.leftPlacedClass) 1347 .removeClass(self.rightPlacedClass) 1348 .removeClass(self.topPlacedClass); 1349 1350 dOffset = $element.offset(); 1351 1352 // x 1353 if(dOffset.left - self.config.availableError < 0) { 1354 $element.addClass(self.leftPlacedClass); 1355 } 1356 else if(dOffset.left + $element.outerWidth() + self.config.availableError > $w.width()) { 1357 $element.addClass(self.rightPlacedClass); 1358 } 1359 1360 // y 1361 if(dOffset.top + $element.outerHeight() + self.config.availableError > $w.scrollTop() + $w.height()) { 1362 $element.addClass(self.topPlacedClass); 1363 } 1364 }); 1365 }; 1366 1367 App.modules.dropdown.toggle = function($dropdowns) { 1368 if(!$.isjQuery($dropdowns, true)) return; 1369 var self = this; 1370 1371 return $dropdowns.each(function(index, dropdown){ 1372 var $dropdown = $(dropdown); 1373 1374 if($dropdown.hasClass(self.activeClass)) self.close($dropdown); 1375 else self.open($dropdown); 1376 }); 1377 }; 1378 1379 /* ---------------------------------------- 1380 End of Dropdown 1381 ---------------------------------------- */ 1382 1383 /* ---------------------------------------- 1384 Arctic Modal 1385 ---------------------------------------- */ 1386 1387 App.modules.arcticModals = { 1388 _config: { 1389 type: 'html', 1390 closeOnOverlayClick: true, 1391 overlay: { 1392 css: { 1393 backgroundColor: '#000000' 1394 } 1395 }, 1396 clickableElements: null 1397 }, 1398 _collection: $(), 1399 init: function( collection, config ) { 1400 1401 if( !collection || !collection.length ) return; 1402 1403 config = $.isPlainObject( config ) ? $.extend(true, {}, this._config, config) : this._config; 1404 1405 config = this._prepareCallbacks( config ); 1406 1407 if( config && config.clickableElements ) { 1408 $body.on('click.MadArcticModals', '.arcticmodal-container', function(e){ 1409 var $target = $(e.target); 1410 if( !$target.closest( config.clickableElements ).length ) { 1411 $.arcticmodal('close'); 1412 } 1413 }); 1414 } 1415 1416 collection.on('click.MadArcticModals', function(e) { 1417 1418 var $this = $(this); 1419 1420 if( $this.data('arctic-modal-type') == 'ajax' ) { 1421 if(!$this.data('arctic-modal-ajax-action')) { 1422 return; 1423 } 1424 1425 $.arcticmodal($.extend(true, {}, config, { 1426 type: 'ajax', 1427 url: MadAJAXData.url, 1428 ajax: { 1429 cache: false, 1430 dataType: 'html', 1431 data: { 1432 action: $this.data('arctic-modal-ajax-action'), 1433 data: $this.data('arctic-modal-ajax-data'), 1434 AJAX_token: MadAJAXData.AJAX_token 1435 }, 1436 success: function(data, el, response) { 1437 data.body.html( response ); 1438 } 1439 } 1440 })); 1441 } 1442 else { 1443 $($this.data('arctic-modal')).arcticmodal(config); 1444 } 1445 1446 e.preventDefault(); 1447 }); 1448 }, 1449 _prepareCallbacks: function(config) { 1450 var beforeOpenCallback = config.beforeOpen || function(){}, 1451 beforeCloseCallback = config.beforeClose || function(){}, 1452 afterOpenCallback = config.afterOpen || function(){}, 1453 afterCloseCallback = config.afterClose || function(){}; 1454 1455 config.beforeOpen = function() { 1456 1457 beforeOpenCallback.apply(this, Array.prototype.slice(arguments, 0)); 1458 }; 1459 1460 config.afterOpen = function () { 1461 afterOpenCallback.apply(this, Array.prototype.slice(arguments, 0)); 1462 }; 1463 1464 config.beforeClose = function(event) { 1465 1466 beforeCloseCallback.apply(this, Array.prototype.slice(arguments, 0)); 1467 }; 1468 1469 config.afterClose = function(event) { 1470 $body.css('overflow', ''); 1471 1472 afterCloseCallback.apply(this, Array.prototype.slice(arguments, 0)); 1473 }; 1474 1475 return config; 1476 1477 } 1478 }; 1479 1480 /* ---------------------------------------- 1481 End of Arctic Modal 1482 ---------------------------------------- */ 1483 1484 /* ---------------------------------------- 1485 Alert Message Module 1486 ---------------------------------------- */ 1487 1488 App.modules.alertMessage = function(options) { 1489 if(!('Handlebars' in window)) return; 1490 var config = {
1491 target: $body.children().last(), 1492 type: 'info', 1493 timeout: 4000 1494 }; 1495 config = options && $.isPlainObject(options) ? $.extend(true, {}, config, options) : config; 1496 1497 var template = 1498 '<div class="mad-alert-box mad-alert-box--{{type}}" style="display: none;">\ 1499 <div class="mad-alert-box-inner">\ 1500 {{message}}\ 1501 </div>\ 1502 </div>'; 1503 1504 var messageBox = $(Handlebars.compile(template)(config)); 1505 messageBox.data('timeOut', setTimeout(function(){ 1506 messageBox.stop().slideUp({ 1507 duration: 350, 1508 easing: 'linear', 1509 complete: function() { 1510 $(this).remove(); 1511 } 1512 }); 1513 }, config.timeout)).insertAfter(config.target).stop().slideDown({ 1514 duration: 350, 1515 easing: 'linear' 1516 }); 1517 }; 1518 1519 /* ---------------------------------------- 1520 End of Alert Message Module 1521 ---------------------------------------- */ 1522 1523 /* ---------------------------------------- 1524 Section Module 1525 ---------------------------------------- */ 1526 1527 App.modules.Section = {}; 1528 App.modules.Section._$collection = $(); 1529 App.modules.Section.config = { 1530 cssPrefix: 'mad-', 1531 resizeDelay: 10, 1532 boddyPaddings: false, 1533 classMap: { 1534 loading: 'section--loading', 1535 stretched: 'section--stretched', 1536 stretchedContent: 'section--stretched-content', 1537 stretchedContentNoPadding: 'section--stretched-content-no-px', 1538 bgColorElementClass: 'colorizer-bg-color', 1539 bgImageElementClass: 'colorizer-bg-image' 1540 } 1541 }; 1542 1543 Object.defineProperties(App.modules.Section, { 1544 bgColorElementClass: { 1545 get: function() { 1546 return this.config.cssPrefix + this.config.classMap.bgColorElementClass; 1547 } 1548 }, 1549 bgImageElementClass: { 1550 get: function() { 1551 return this.config.cssPrefix + this.config.classMap.bgImageElementClass; 1552 } 1553 }, 1554 stretchedClass: { 1555 get: function() { 1556 return this.config.cssPrefix + this.config.classMap.stretched; 1557 } 1558 }, 1559 stretchedContentClass: { 1560 get: function() { 1561 return this.config.cssPrefix + this.config.classMap.stretchedContent; 1562 } 1563 }, 1564 stretchedContentNoPaddingClass: { 1565 get: function() { 1566 return this.config.cssPrefix + this.config.classMap.stretchedContentNoPadding; 1567 } 1568 }, 1569 loadingClass: { 1570 get: function() { 1571 return this.config.cssPrefix + this.config.classMap.loading; 1572 } 1573 } 1574 }); 1575 1576 App.modules.Section.changeConfig = function(config) { 1577 return $.extend(true, this.config, config); 1578 }; 1579 1580 App.modules.Section.init = function($collection) { 1581 var self = this; 1582 1583 if(!$.isjQuery($collection, true)) return; 1584 1585 if(!this._bindedGlobalEvents) this._bindGlobalEvents(); 1586 1587 return $collection.each(function(index, section){ 1588 var $section = $(section); 1589 1590 if(self._$collection.filter($section).length) return; 1591 1592 self.build($section); 1593 self._$collection = self._$collection.add($section); 1594 }); 1595 }; 1596 1597 App.modules.Section._bindGlobalEvents = function () { 1598 var self = this; 1599 1600 $(window).on('resize.App.modules.Section', function() { 1601 if(self._resizeTimeOutId) clearTimeout(self._resizeTimeOutId); 1602 1603 self._resizeTimeOutId = setTimeout(function(){ 1604 self.rebuild(); 1605 }, self.config.resizeDelay); 1606 }); 1607 }; 1608 1609 App.modules.Section.rebuild = function() { 1610 var self = this; 1611 1612 return this._$collection.each(function(index, section){ 1613 var $section = $(section); 1614 1615 self.reset($section).build($section); 1616 }); 1617 }; 1618 1619 App.modules.Section.reset = function($section) { 1620 if(!$.isjQuery($section, true)) return; 1621 1622 $section.css({ 1623 'margin-left': '', 1624 'margin-right': '' 1625 }); 1626 1627 return this; 1628 }; 1629 1630 App.modules.Section.build = function($section) { 1631 if(!$.isjQuery($section, true)) return; 1632 1633 if($section.hasClass(this.stretchedClass)) { 1634 this.stretch($section); 1635 } 1636 else if($section.hasClass(this.stretchedContentClass) || $section.hasClass(this.stretchedContentNoPaddingClass)) { 1637 this.stretchContent($section); 1638 } 1639 1640 return this; 1641 }; 1642 1643 App.modules.Section.getDocumentGeometry = function() { 1644 return { 1645 'padding-left': parseInt($body.css('padding-left'), 10), 1646 'padding-right': parseInt($body.css('padding-right'), 10) 1647 }; 1648 }; 1649 1650 App.modules.Section.stretch = function($section) { 1651 var $bgs, xOffsetDiff, documentGeometry; 1652 1653 if(!$.isjQuery($section, true)) return; 1654 1655 $bgs = $section.find('.' + this.bgColorElementClass + ', .' + this.bgImageElementClass); 1656 1657 if(!$bgs.length) return; 1658 1659 xOffsetDiff = $section.offset().left; 1660 documentGeometry = this.getDocumentGeometry(); 1661 1662 if(xOffsetDiff > 0) { 1663 $bgs.css({ 1664 left: (xOffsetDiff - documentGeometry['padding-left']) / -1, 1665 right: (xOffsetDiff - documentGeometry['padding-right']) / -1 1666 }); 1667 } 1668 1669 $section.removeClass(this.loadingClass).trigger('stretched.mad.Section', [$
1669section]); 1670 1671 return $section; 1672 }; 1673 1674 App.modules.Section.stretchContent = function($section) { 1675 var xOffsetDiff, documentGeometry; 1676 1677 if(!$.isjQuery($section) || !$section.length) return; 1678 1679 xOffsetDiff = $section.offset().left; 1680 documentGeometry = this.getDocumentGeometry(); 1681 1682 if(xOffsetDiff > 0) { 1683 $section.css({ 1684 'margin-left': (xOffsetDiff - documentGeometry['padding-left']) / -1, 1685 'margin-right': (xOffsetDiff - documentGeometry['padding-right']) / -1 1686 }); 1687 } 1688 1689 $section.removeClass(this.loadingClass).trigger('stretched.mad.Section', [$section]); 1690 1691 return $section; 1692 }; 1693 1694 /* ---------------------------------------- 1695 End of Section Module 1696 ---------------------------------------- */ 1697 1698 1699 /* ---------------------------------------- 1700 Colorizer 1701 ---------------------------------------- */ 1702 1703 App.helpers.Colorizer = {}; 1704 App.helpers.Colorizer.config = { 1705 cssPrefix: 'mad-', 1706 classMap: { 1707 bgColorElement: 'colorizer-bg-color', 1708 bgImageElement: 'colorizer-bg-image', 1709 parallax: 'colorizer--parallax' 1710 }, 1711 afterInit: function() {} 1712 }; 1713 1714 Object.defineProperties(App.helpers.Colorizer, { 1715 bgColorElementClass: { 1716 get: function() { 1717 return this.config.cssPrefix + this.config.classMap.bgColorElement; 1718 } 1719 }, 1720 bgImageElementClass: { 1721 get: function() { 1722 return this.config.cssPrefix + this.config.classMap.bgImageElement; 1723 } 1724 }, 1725 parallaxClass: { 1726 get: function() { 1727 return this.config.cssPrefix + this.config.classMap.parallax; 1728 } 1729 } 1730 }); 1731 1732 /** 1733 * 1734 * @param {jQuery} $collection - collection of elements to colorize 1735 * @returns {jQuery} $collection 1736 */ 1737 App.helpers.Colorizer.init = function($collection, config) { 1738 var self = this; 1739 1740 if(!$.isjQuery($collection, true)) return $collection; 1741 1742 this.config = $.extend(true, {}, this.config, config); 1743 1744 $collection.each(function(index, element) { 1745 var $element = $(element); 1746 1747 if(!self.hasBGColorElement($element)) { 1748 self.appendBGColorElement($element); 1749 } 1750 1751 if(!self.hasBGImageElement($element) && $element.data('bg-image-src')) { 1752 self.appendBGImageElement($element); 1753 } 1754 }); 1755 1756 this.config.afterInit.call(this); 1757 1758 return $collection; 1759 }; 1760 1761 /** 1762 * 1763 * @param {jQuery} $element 1764 * @returns {Boolean} 1765 */ 1766 App.helpers.Colorizer.hasBGColorElement = function($element) { 1767 return $element.children('.' + this.bgColorElementClass).length; 1768 }; 1769 1770 /** 1771 * 1772 * @param {jQuery} $element 1773 * @returns {Boolean} 1774 */ 1775 App.helpers.Colorizer.hasBGImageElement = function($element) { 1776 return $element.children('.' + this.bgImageElementClass).length; 1777 }; 1778 1779 /** 1780 * 1781 * @param {jQuery} $element 1782 * @returns {jQuery} 1783 */ 1784 App.helpers.Colorizer.appendBGColorElement = function($element) { 1785 var self = this, 1786 $bgColorElement = $('<div></div>', { 1787 class: self.bgColorElementClass 1788 }); 1789 1790 return $element.prepend($bgColorElement); 1791 }; 1792 1793 /** 1794 * 1795 * @param {jQuery} $element 1796 * @returns {jQuery} 1797 */ 1798 App.helpers.Colorizer.appendBGImageElement = function($element) { 1799 var self = this, 1800 src = $element.data('bg-image-src'), 1801 $bgImageElement = $('<div></div>', { 1802 class: self.bgImageElementClass 1803 }); 1804
1805 $bgImageElement.css('background-image', 'url("'+src+'")'); 1806 $element.prepend($bgImageElement); 1807 1808 return $element; 1809 }; 1810 1811 /* ---------------------------------------- 1812 End of Colorizer 1813 ---------------------------------------- */ 1814 1815 1816 /* ---------------------------------------- 1817 Breadcrumb 1818 ---------------------------------------- */ 1819 1820 App.helpers.Breadcrumb = {}; 1821 App.helpers.Breadcrumb.$collection = $(); 1822 App.helpers.Breadcrumb.$w = $(window); 1823 1824 App.helpers.Breadcrumb.config = { 1825 until: 767, 1826 cssPrefix: 'mad-', 1827 resizeTimeoutDelay: 10, 1828 classMap: { 1829 bgColorElement: 'colorizer-bg-color', 1830 bgImageElement: 'colorizer-bg-image' 1831 } 1832 }; 1833 1834 Object.defineProperties(App.helpers.Breadcrumb, { 1835 bgColorElementClass: { 1836 get: function() { 1837 return this.config.cssPrefix + this.config.classMap.bgColorElement; 1838 } 1839 }, 1840 bgImageElementClass: { 1841 get: function() { 1842 return this.config.cssPrefix + this.config.classMap.bgImageElement; 1843 } 1844 }, 1845 bgsSelectors: { 1846 get: function() { 1847 return '.' + this.bgColorElementClass + ', .' + this.bgImageElementClass; 1848 } 1849 } 1850 }); 1851 1852 App.helpers.Breadcrumb.init = function($breadcrumbs) { 1853 var self = this; 1854 1855 if(!$.isjQuery($breadcrumbs, true)) return; 1856 1857 this._bindEvents(); 1858 1859 $breadcrumbs.each(function(index, element) { 1860 var $element = $(element); 1861 1862 if(self.$collection.filter($element).length) return; 1863 1864 self.initCertainElement($element); 1865 }); 1866 }; 1867 1868 App.helpers.Breadcrumb._bindEvents = function() { 1869 var self = this; 1870 1871 if(!this._eventsBinded) { 1872 $body.on('spaceremoved.mad.stickysection', function() { 1873 self.$collection.each(function(index, element){ 1874 self.stretch($(element)); 1875 }); 1876 }); 1877 1878 this.$w.on('resize', function() { 1879 if(self._resizeTimeOutId) clearTimeout(self._resizeTimeOutId); 1880 1881 self._resizeTimeOutId = setTimeout(function(){ 1882 self.$collection.each(function(index, element){ 1883 self.stretch($(element)); 1884 }); 1885 }, self.config.resizeTimeoutDelay); 1886 }); 1887 } 1888 }; 1889 1890 App.helpers.Breadcrumb.initCertainElement = function($breadcrumb) { 1891 this.$collection = this.$collection.add($breadcrumb); 1892 1893 this.stretch($breadcrumb); 1894 }; 1895 1896 App.helpers.Breadcrumb.stretch = function($breadcrumb) { 1897 var $prev = $breadcrumb.prev(), 1898 prevOH, 1899 $bgs, 1900 $stickedSections; 1901 1902 if($.isjQuery($prev, true)) { 1903 prevOH = $prev.outerHeight(); 1904 $bgs = $breadcrumb.find(this.bgsSelectors); 1905 $stickedSections = $('.mad-header-section--sticked'); 1906 1907 if($bgs.length) { 1908 $bgs.css({ 1909 top: -prevOH 1910 }); 1911 } 1912 if($stickedSections.length) { 1913 $bgs.css({ 1914 top: $stickedSections.outerHeight() * -1 1915 }); 1916 } 1917 } 1918 1919 return $breadcrumb; 1920 }; 1921 1922 /* ---------------------------------------- 1923 End of Breadcrumb 1924 ---------------------------------------- */ 1925 1926 /* ---------------------------------------- 1927 Critical Error 1928 ---------------------------------------- */ 1929 1930 App.helpers.showCriticalFullScreenMessage = function(config) { 1931 var _config = { 1932 after: '', 1933 before: '', 1934 content: '', 1935 cssPrefix: 'mad-', 1936 cssClass: '' 1937 }, 1938 template = '<div class="%cssPrefix%fullscreen-message %cssClass% %cssPrefix%aligner">\ 1939 <div class="%cssPrefix%aligner-outer">\ 1940 <div class="%cssPrefix%aligner-inner">\ 1941 <div class="%cssPrefix%fullscreen-message-before">%before%</div>\ 1942 <div class="%cssPrefix%fullscreen-message-content">%content%</div>\ 1943 <div class="%cssPrefix%fullscreen-message-after">%after%</div>\ 1944 </div>\ 1945 </div>\ 1946 </div>'; 1947 1948 1949 config = $.extend(_config, config); 1950 1951 for(var option in config) { 1952 template = template.replace(new RegExp('%' + option + '%', 'g'), config[option]); 1953 } 1954 1955 $body.html('').addClass(config.cssPrefix + 'body--has-critical-fullscreen-message').append(template); 1956 }; 1957 1958 /* ---------------------------------------- 1959 End of Critical Error 1960 ---------------------------------------- */ 1961 1962 /* ---------------------------------------- 1963 Dynamic background image 1964 ---------------------------------------- */ 1965 1966 App.helpers.dynamicBgImage = function(collection) { 1967 collection = $.isjQuery(collection) ? collection : $('[data-bg-image-src]'); 1968 if(!collection.length) return; 1969 1970 return collection.each(function(i, el){ 1971 var $this = $(el); 1972 if( !$this.data('bg-image-src') ) return; 1973 1974 $this.css('background-image', 'url("'+ $this.data('bg-image-src') +'")'); 1975 }); 1976 }, 1977 1978 /* ---------------------------------------- 1979 End of Dynamic background image 1980 ---------------------------------------- */ 1981 1982 /* ---------------------------------------- 1983 Toggled fields 1984 ---------------------------------------- */ 1985 1986 App.helpers.toggledFields = function() { 1987 $body.off('click.MadToggledFields').on('click.MadToggledFields', '.mad-toggled-fields-invoker', function(event) { 1988 var $this = $(this), 1989 $fields = $this.siblings('.mad-toggled-fields'); 1990 1991 $this.toggleClass('mad-toggled-fields-invoker--opened'); 1992 1993 if($fields.length) { 1994 $fields.stop().slideToggle({ 1995 duration: App.ANIMATIONDURATION, 1996 easing: App.ANIMATIONEASING, 1997 }); 1998 } 1999 }); 2000 }; 2001 2002 /* ---------------------------------------- 2003 End of Toggled fields 2004 ---------------------------------------- */ 2005 2006 /* ---------------------------------------- 2007 Calendar Widget 2008 ---------------------------------------- */ 2009 2010 App.helpers.calendarWidget = function() { 2011 var $calendar = $('.calendar_wrap'), 2012 $caption, 2013 $prev, 2014 $next; 2015 if(!$calendar.length || $calendar.hasClass('mad-calendar-rendered')) return; 2016 2017 $caption = $calendar.find('caption'); 2018 2019 if(!$caption.length) return; 2020 2021 $prev = $calendar.find('#prev > a');
2022 $next = $calendar.find('#next > a'); 2023 2024 if($prev.length) { 2025 $('<a></a>', { 2026 class: 'calendar-caption-prev mad-ln--independent', 2027 html: App.RTL ? '<i class="icon licon-arrow-right"></i>' : '<i class="icon licon-arrow-left"></i>', 2028 href: $prev.attr('href') 2029 }).appendTo($caption); 2030 } 2031 2032 if($next.length) { 2033 $('<a></a>', { 2034 class: 'calendar-caption-next mad-ln--independent', 2035 html: App.RTL ? '<i class="icon licon-arrow-left"></i>' : '<i class="icon licon-arrow-right"></i>', 2036 href: $next.attr('href') 2037 }).appendTo($caption); 2038 } 2039 2040 $calendar.addClass('mad-calendar-rendered'); 2041 }; 2042 2043 /* ---------------------------------------- 2044 End of Calendar Widget 2045 ---------------------------------------- */ 2046 2047 /* ---------------------------------------- 2048 Owl Carousel helpers 2049 ---------------------------------------- */ 2050 2051 App.baseOwlSettings = { 2052 items: 1, 2053 margin: 32, 2054 nav: true, 2055 rtl: App.RTL, 2056 navText: App.RTL ? ['<img class="svg" src="steakbreak_svg_icons/arrow_left.svg" alt="">', '<img class="svg" src="steakbreak_svg_icons/arrow_right.svg" alt="">'] : ['<img class="svg" src="steakbreak_svg_icons/arrow_left.svg" alt="">', '<img class="svg" src="steakbreak_svg_icons/arrow_right.svg" alt="">'], 2057 dots: false, 2058 loop: true, 2059 autoplayHoverPause: true, 2060 smartSpeed: App.ANIMATIONDURATION, 2061 fluidSpeed: App.ANIMATIONDURATION, 2062 autoplaySpeed: App.ANIMATIONDURATION, 2063 navSpeed: App.ANIMATIONDURATION, 2064 dotsSpeed: App.ANIMATIONDURATION, 2065 dragEndSpeed: App.ANIMATIONDURATION 2066 }; 2067 2068 App.helpers.owlAdaptive = function(collection) { 2069
2070 collection = collection ? collection : $('.owl-carousel'); 2071 if(!collection.length) return; 2072 2073 }; 2074 2075 App.helpers.owlContainerHeight = function(owl, resized) { 2076 2077 if(owl.hasClass('owl-carousel--vadaptive')) return; 2078 2079 setTimeout(function(){ 2080 2081 var max = 0, 2082 items = owl.find('.owl-item'), 2083 activeItems = items.filter('.active').children(); 2084 2085 items.children().css('height', 'auto'); 2086 2087 activeItems.each(function(i, el){ 2088 2089 var $this = $(el), 2090 height = $this.outerHeight(); 2091 2092 if(height > max) max = height; 2093 2094 }); 2095 2096 owl.find('.owl-stage-outer').stop().animate({ 2097 height: max 2098 }, { 2099 duration: 150, 2100 complete: function() { 2101 if(!resized) return; 2102 App.helpers.owlUpdateIsotopeParent($(this)); 2103 } 2104 }); 2105 2106 }, 1); 2107 2108 }; 2109 2110 App.helpers.owlUpdateIsotopeParent = function($owl) { 2111 var $isotope = $owl.closest('.mad-grid--isotope'); 2112 if($isotope.length) $isotope.isotope('layout'); 2113 }; 2114 2115 App.helpers.owlNav = function(owl) { 2116 2117 setTimeout(function(){ 2118 2119 var settings = owl.data('owl.carousel').settings; 2120 if(settings.autoplay || settings.loop) return; 2121 2122 var prev = owl.find('.owl-prev'), 2123 next = owl.find('.owl-next'); 2124 2125 if(owl.find('.owl-item').first().hasClass('active')) prev.addClass('mad-disabled'); 2126 else prev.removeClass('mad-disabled'); 2127 2128 if(owl.find('.owl-item').last().hasClass('active')) next.addClass('mad-disabled'); 2129 else next.removeClass('mad-disabled'); 2130 2131 }, 100); 2132 2133 }; 2134 2135 App.helpers.owlSettings = function(settings) { 2136 2137 return $.extend(true, {}, App.baseOwlSettings, settings); 2138 2139 }; 2140 2141 App.helpers.owlSync = { 2142 2143 init: function() { 2144 2145 this.collection = $('.owl-carousel[data-sync]'); 2146 if(!this.collection.length) return; 2147 2148 this.prepare(); 2149 }, 2150 2151 prepare: function(){ 2152 2153 this.collection.each(function(i, el){ 2154 2155 var $this = $(el), 2156 sync = $($this.data('sync')); 2157 2158 sync.on('changed.owl.carousel', function(e){ 2159 2160 var index = e.item.index; 2161 2162 if(!sync.data('afterClicked')) $this.trigger('to.owl.carousel', [index, 350, true]); 2163 2164 sync.data('afterClicked', false); 2165 2166 }); 2167 2168 $this.on('prev.owl.carousel', function(){ 2169 2170 sync.trigger('prev.owl.carousel'); 2171 2172 }); 2173 2174 $this.on('next.owl.carousel', function(){ 2175 2176 sync.trigger('next.owl.carousel'); 2177 2178 }); 2179 2180 $this.on('click.owlSync', '.owl-item', function(e){ 2181 2182 e.preventDefault(); 2183 2184 var index = $(this).index(); 2185 2186 sync.data('afterClicked', true); 2187 2188 sync.trigger('to.owl.carousel', [index, 350, true]); 2189 2190 }); 2191 2192 }); 2193 2194 } 2195 2196 }; 2197 2198 /* ---------------------------------------- 2199 End of Owl Carousel helpers 2200 ---------------------------------------- */ 2201 2202 /* ---------------------------------------- 2203 Rating 2204 ---------------------------------------- */ 2205 2206 function MadRating($element, config) { 2207 this.$element = $element; 2208 this.config = $.extend(MadRating.config, config); 2209 2210 Object.defineProperties(this, { 2211 bottomLevelElementClass: { 2212 get: function() { 2213 return this.config.cssPrefix + this.config.classMap.bottomLevelElement; 2214 } 2215 }, 2216 topLevelElementClass: { 2217 get: function() { 2218 return this.config.cssPrefix + this.config.classMap.topLevelElement; 2219 } 2220 } 2221 }); 2222 }; 2223 2224 MadRating.config = { 2225 cssPrefix: 'mad-', 2226 bottomLevelElements: '<i class="icon licon-star"></i>', 2227 topLevelElements: '<i class="icon licon-star"></i>', 2228 estimate: 5, 2229 rtl: App.RTL, 2230 classMap: { 2231 bottomLevelElement: 'rating-bottom-level', 2232 topLevelElement: 'rating-top-level' 2233 } 2234 }; 2235 2236 MadRating.prototype.init = function() { 2237 this._buildMarkup(); 2238 2239 return this; 2240 }; 2241 2242 MadRating.prototype._buildMarkup = function() { 2243 var _self = this; 2244 2245 if(this._markupBuilded) return; 2246 2247 this.$element.css({ 2248 'position': 'relative', 2249 'display': 'inline-block' 2250 }); 2251 2252 if(this.config.topLevelElements) {
2253 this.$topLevelEl = $('<div></div>', { 2254 class: _self.topLevelElementClass, 2255 style: 'position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 2; white-space: nowrap; overflow: hidden;' 2256 }); 2257 2258 for(var i = 0; i < 5; i++) this.$topLevelEl.append(this.config.topLevelElements); 2259 2260 this.$element.append(this.$topLevelEl); 2261 } 2262 2263 if(this.config.bottomLevelElements) { 2264 this.$bottomLevelEl = $('<div></div>', { 2265 class: _self.bottomLevelElementClass, 2266 style: 'position: relative; z-index: 1;' 2267 }); 2268 2269 for(var i = 0; i < 5; i++) this.$bottomLevelEl.append(this.config.bottomLevelElements); 2270 2271 this.$element.append(this.$bottomLevelEl); 2272 } 2273 2274 2275 this.update(this.config.estimate); 2276 2277 this._markupBuilded = true; 2278 2279 this.$element.trigger('built.mad.Rating', [this.$element]); 2280 }; 2281 2282 MadRating.prototype.update = function(estimate) { 2283 if(this.config.topLevelElements) { 2284 this.$topLevelEl.css('width', (estimate / 5 * 100) + '%'); 2285 } 2286 else { 2287 if(this.config.bottomLevelElements) { 2288 this.$bottomLevelEl.html(''); 2289 for(var i = 0; i < Math.round(estimate); i++) this.$bottomLevelEl.append(this.config.bottomLevelElements); 2290 } 2291 } 2292 }; 2293 2294 App.helpers.rating = function($collection, config) { 2295 config = config || {}; 2296 2297 if(!$.isjQuery($collection) || !$collection.length) return $collection; 2298 2299 return $collection.each(function(index, element) { 2300 var $element = $(element), 2301 elementConfig = $.extend(true, {}, config, {estimate: $element.data('estimate')}); 2302 2303 if(!$element.data('Rating')) $element.data('Rating', new MadRating($element, elementConfig).init()); 2304 }); 2305 }; 2306 2307 2308 2309 App.helpers.ratingField = function($collection) { 2310 if(!$.isjQuery($collection)) return; 2311 2312 $collection.on('click.MadRatingField', '.icon', function(event) { 2313 var $icon = $(this), 2314 $rating = $icon.closest('[data-estimate]'), 2315 index = $icon.index() + 1, 2316 Rating = $rating.data('Rating'), 2317 $field = $rating.siblings('input[type="hidden"]'); 2318 2319 if(Rating) { 2320 Rating.update( App.RTL ? 6 - index : index); 2321 2322 if($field.length) { 2323 $field.val(index); 2324 } 2325 } 2326 2327 event.preventDefault(); 2328 event.stopPropagation(); 2329 }); 2330 }; 2331 2332 /* ---------------------------------------- 2333 End of Rating 2334 ---------------------------------------- */ 2335 2336 /* ---------------------------------------- 2337 gridOwl 2338 ---------------------------------------- */ 2339 2340 App.helpers.gridOwl = { 2341 _commonLayoutConfig: { 2342 'columns-4': { 2343 responsive: { 2344 0: { 2345 items: 1 2346 }, 2347 768: { 2348 items: 2 2349 }, 2350 1200: { 2351 items: 4 2352 } 2353 } 2354 }, 2355 'columns-4-sidebar': { 2356 responsive: { 2357 0: { 2358 items: 1 2359 }, 2360 992: { 2361 items: 2 2362 }, 2363 1200: { 2364 items: 3 2365 } 2366 } 2367 }, 2368 'columns-3': { 2369 responsive: { 2370 0: { 2371 items: 1 2372 }, 2373 768: { 2374 items: 2 2375 }, 2376 1200: { 2377 items: 3 2378 } 2379 } 2380 }, 2381 'columns-3-sidebar': { 2382 responsive: { 2383 0: { 2384 items: 1 2385 }, 2386 992: { 2387 items: 2 2388 }, 2389 1200: { 2390 items: 3 2391 } 2392 } 2393 }, 2394 'columns-2': { 2395 responsive: { 2396 0: { 2397 items: 1 2398 }, 2399 768: { 2400 items: 2 2401 } 2402 } 2403 }, 2404 'columns-2-sidebar': { 2405 responsive: { 2406 0: { 2407 items: 1 2408 }, 2409 992: { 2410 items: 2 2411 } 2412 } 2413 } 2414 }, 2415 _$collection: $(), 2416 _individualConfigs: {} 2417 }; 2418 2419 /** 2420 * Initializes the gridOwl helper 2421 * @param {jQuery} $collection 2422 * 2423 * @returns {jQuery} 2424 */ 2425 App.helpers.gridOwl.init = function($collection) { 2426 var self = this; 2427 2428 $collection = $.isjQuery($collection) ? $collection : $('.mad-grid.owl-carousel'); 2429 2430 $collection.each(function(index, element){ 2431 var $element = $(element); 2432 2433 if(self._$collection.filter($element).length) return; 2434 2435 self._$collection = self._$collection.add($element); 2436 }); 2437 2438 this.update(); 2439 2440 return $collection; 2441 }; 2442 2443 /** 2444 * Modifies config for the elements with parents that match specified selector. 2445 * @param {String} selector 2446 * @param {Object} config 2447 * 2448 * @returns {Object} 2449 */ 2450 App.helpers.gridOwl.extendConfigFor = function(selector, config) { 2451 this._individualConfigs[selector] = config; 2452 2453 return this; 2454 }; 2455 2456 /** 2457 * Adds new carousel to the collection 2458 * 2459 * @param {jQuery} $carousel
2460 * 2461 * @returns {Object} 2462 */ 2463 App.helpers.gridOwl.add = function($carousel) { 2464 if($.isjQuery($carousel) && !this._$collection.filter($carousel).length) { 2465 this._$collection = this._$collection.add($carousel); 2466 this.update(); 2467 } 2468 2469 return this; 2470 }; 2471 2472 /** 2473 * Initializes not initialized carousels. 2474 * 2475 * @returns {Object} 2476 */ 2477 App.helpers.gridOwl.update = function() { 2478 var self = this; 2479 2480 this._$collection.each(function(index, element){ 2481 var $element = $(element), 2482 config = {}, 2483 columnsCount, 2484 layoutConfigProp; 2485 2486 if($element.data('owl.carousel')) return; 2487 2488 // detect layout settings 2489 columnsCount = self._getColumnsCount($element); 2490 2491 if(columnsCount > 1) { 2492 // check if sidebar 2493 if($element.closest('.mad-has-sidebar').length) { 2494 layoutConfigProp = 'columns-' + columnsCount + '-sidebar'; 2495 } 2496 else { 2497 layoutConfigProp = 'columns-' + columnsCount; 2498 } 2499 2500 $.extend(config, self._commonLayoutConfig[layoutConfigProp]); 2501 } 2502 2503 for(var selector in self._individualConfigs) { 2504 if($element.closest(selector).length) { 2505 $.extend(config, self._individualConfigs[selector]); 2506 2507 if($element.closest('.mad-has-sidebar').length) { 2508 config.responsive = config.responsiveWithSidebar; 2509 } 2510 } 2511 } 2512 2513 2514 $element.owlCarousel(App.helpers.owlSettings(config)); 2515 }); 2516 2517 return this; 2518 }; 2519 2520 /** 2521 * Returns amount of columns in the specified element. 2522 * 2523 * @param {jQuery} $element 2524 * @returns {Number} 2525 */ 2526 App.helpers.gridOwl._getColumnsCount = function($element) { 2527 if($element.hasClass('mad-grid--cols-4')) return 3; 2528 else if($element.hasClass('mad-grid--cols-3')) return 3; 2529 else if($element.hasClass('mad-grid--cols-2')) return 2; 2530 else if($element.hasClass('mad-grid--cols-5')) return 5; 2531 2532 return 1; 2533 }; 2534 2535 /* ---------------------------------------- 2536 End of gridOwl 2537 ---------------------------------------- */ 2538 2539 /* ---------------------------------------- 2540 Full Screen Area 2541 ---------------------------------------- */ 2542 2543 App.helpers.fullScreenArea = { 2544 init: function(config){ 2545 2546 var self = this; 2547 2548 this.collection = $('.mad-fullscreen-area'); 2549 if(!this.collection.length) return; 2550 2551 this.config = config || {}; 2552 this.defPaddingTop = parseInt(this.collection.css('padding-top'), 10); 2553 this.defPaddingBottom = parseInt(this.collection.css('padding-bottom'), 10); 2554 2555 this.w = $(window); 2556 this.$body = $body; 2557 2558 this.run(); 2559 2560 this.w.on('resize.fullscreen', function() { 2561 self.run(); 2562 }); 2563 2564 return this.collection; 2565 2566 }, 2567 2568 reset: function(){ 2569 2570 if(!this.collection) return; 2571 2572 this.run(); 2573 2574 }, 2575 2576 updateDocumentState: function(){ 2577 2578 var self = this; 2579 2580 this.collection.css({ 2581 'padding-top': self.defPaddingTop, 2582 'padding-bottom': self.defPaddingBottom 2583 }); 2584 2585 this.cH = this.collection.outerHeight(); 2586 2587 this.eH = this.config.except && this.config.except.length ? this.getTotalHeightOfExceptedElements() : 0; 2588 this.documentPadding = parseInt(this.$body.css('padding-top'), 10) + parseInt(this.$body.css('padding-bottom'), 10); 2589 2590 this.wH = this.w.height(); 2591 2592 }, 2593 2594 getTotalHeightOfExceptedElements: function() { 2595 return this.config.except.toArray().reduce(function(accumulator, currentValue, index, array){ 2596 return accumulator + $(currentValue).outerHeight(); 2597 }, 0); 2598 }, 2599 2600 run: function(){ 2601 2602 var self = this; 2603 2604 this.updateDocumentState(); 2605 2606 if(this.timeoutId) clearTimeout(this.timeoutId); 2607 2608 this.timeoutId = setTimeout(function(){ 2609 2610 if(self.cH < self.wH){ 2611 2612 var diff = (self.wH - self.cH) / 2; 2613 2614 self.collection.css({
2615 'padding-top': diff + self.defPaddingTop - ((self.eH + self.documentPadding)/2), 2616 'padding-bottom': diff + self.defPaddingBottom - ((self.eH + self.documentPadding)/2) 2617 }); 2618 2619 } 2620 2621 self.collection.addClass('mad-fullscreen-area--ready'); 2622 2623 }, 100); 2624 2625 } 2626 2627 }; 2628 2629 /* ---------------------------------------- 2630 End of Full Screen Area 2631 ---------------------------------------- */ 2632 2633 /* ---------------------------------------- 2634 Google Maps 2635 ---------------------------------------- */ 2636 2637 if ($('#googleMap').length) { 2638 2639 function loadMap() { 2640 var mapProp = { 2641 center: { lat: 51.503454, lng: -0.124755 }, 2642 zoom: 14, 2643 mapTypeId: google.maps.MapTypeId.ROADMAP, 2644 styles: [ 2645 { 2646 "elementType": "geometry", 2647 "stylers": [ 2648 { 2649 "color": "#ebe3cd" 2650 } 2651 ] 2652 }, 2653 { 2654 "elementType": "labels", 2655 "stylers": [ 2656 { 2657 "visibility": "on" 2658 } 2659 ] 2660 }, 2661 { 2662 "elementType": "labels.text.fill", 2663 "stylers": [ 2664 { 2665 "color": "#523735" 2666 } 2667 ] 2668 }, 2669 { 2670 "elementType": "labels.text.stroke", 2671 "stylers": [ 2672 { 2673 "color": "#f5f1e6" 2674 } 2675 ] 2676 }, 2677 { 2678 "featureType": "administrative", 2679 "elementType": "geometry.stroke", 2680 "stylers": [ 2681 { 2682 "color": "#c9b2a6" 2683 } 2684 ] 2685 }, 2686 { 2687 "featureType": "administrative.country", 2688 "elementType": "geometry.fill", 2689 "stylers": [ 2690 { 2691 "color": "#78c2aa" 2692 } 2693 ] 2694 }, 2695 { 2696 "featureType": "administrative.land_parcel", 2697 "elementType": "geometry.stroke", 2698 "stylers": [ 2699 { 2700 "color": "#dcd2be" 2701 } 2702 ] 2703 }, 2704 { 2705 "featureType": "administrative.land_parcel", 2706 "elementType": "labels.text.fill", 2707 "stylers": [ 2708 { 2709 "color": "#ae9e90" 2710 } 2711 ] 2712 }, 2713 { 2714 "featureType": "landscape", 2715 "stylers": [ 2716 { 2717 "color": "#dedad5" 2718 }, 2719 { 2720 "weight": 3 2721 } 2722 ] 2723 }, 2724 { 2725 "featureType": "landscape", 2726 "elementType": "labels.text", 2727 "stylers": [ 2728 { 2729 "color": "#262123" 2730 }, 2731 { 2732 "weight": 0.5 2733 } 2734 ] 2735 }, 2736 { 2737 "featureType": "landscape.natural", 2738 "elementType": "geometry", 2739 "stylers": [ 2740 { 2741 "color": "#dfd2ae" 2742 }, 2743 { 2744 "weight": 2 2745 } 2746 ] 2747 }, 2748 { 2749 "featureType": "poi", 2750 "elementType": "geometry", 2751 "stylers": [ 2752 { 2753 "color": "#dfd2ae" 2754 } 2755 ] 2756 }, 2757 { 2758 "featureType": "poi", 2759 "elementType": "labels.text.fill", 2760 "stylers": [ 2761 { 2762 "weight": 0.5 2763 } 2764 ] 2765 }, 2766 { 2767 "featureType": "poi.medical", 2768 "elementType": "geometry.fill", 2769 "stylers": [ 2770 { 2771 "color": "#dedad5" 2772 } 2773 ] 2774 }, 2775 { 2776 "featureType": "poi.park", 2777 "elementType": "geometry.fill", 2778 "stylers": [ 2779 { 2780 "color": "#d1cdca" 2781 } 2782 ] 2783 }, 2784 { 2785 "featureType": "poi.park", 2786 "elementType": "labels.text.fill", 2787 "stylers": [ 2788 { 2789 "color": "#262123" 2790 } 2791 ] 2792 }, 2793 { 2794 "featureType": "poi.place_of_worship", 2795 "elementType": "geometry.fill", 2796 "stylers": [ 2797 { 2798 "color": "#d1cdca" 2799 } 2800 ] 2801 }, 2802 { 2803 "featureType": "road", 2804 "elementType": "geometry", 2805 "stylers": [ 2806 { 2807 "color": "#f5f1e6" 2808 }, 2809 { 2810 "lightness": 5 2811 } 2812 ] 2813 }, 2814 { 2815 "featureType": "road", 2816 "elementType": "geometry.fill", 2817 "stylers": [ 2818 { 2819 "color": "#9e9e9f" 2820 } 2821 ] 2822 }, 2823 { 2824 "featureType": "road.arterial", 2825 "elementType": "geometry", 2826 "stylers": [ 2827 { 2828 "color": "#fdfcf8" 2829 } 2830 ] 2831 }, 2832 { 2833 "featureType": "road.arterial", 2834 "elementType": "geometry.fill", 2835 "stylers": [ 2836 { 2837 "color": "#dedad4" 2838 } 2839 ] 2840 }, 2841 { 2842 "featureType": "road.arterial", 2843 "elementType": "geometry.stroke", 2844 "stylers": [ 2845 { 2846 "color": "#9e9d9b" 2847 } 2848 ] 2849 }, 2850 { 2851 "featureType": "road.highway", 2852 "stylers": [ 2853 { 2854 "weight": 2 2855 } 2856 ] 2857 }, 2858 { 2859 "featureType": "road.highway", 2860 "elementType": "geometry", 2861 "stylers": [ 2862 { 2863 "color": "#f8c967" 2864 } 2865 ] 2866 }, 2867 { 2868 "featureType": "road.highway", 2869 "elementType": "geometry.fill", 2870 "stylers": [ 2871 { 2872 "color": "#dedad5" 2873 } 2874 ] 2875 }, 2876 { 2877 "featureType": "road.highway", 2878 "elementType": "geometry.stroke", 2879 "stylers": [ 2880 { 2881 "color": "#9e9d9b" 2882 } 2883 ] 2884 }, 2885 { 2886 "featureType": "road.highway.controlled_access", 2887 "elementType": "geometry", 2888 "stylers": [ 2889 { 2890 "color": "#e98d58" 2891 } 2892 ] 2893 }, 2894 { 2895 "featureType": "road.highway.controlled_access", 2896 "elementType": "geometry.fill", 2897 "stylers": [ 2898 { 2899 "color": "#dedad5" 2900 } 2901 ] 2902 }, 2903 { 2904 "featureType": "road.highway.controlled_access", 2905 "elementType": "geometry.stroke", 2906 "stylers": [ 2907 { 2908 "color": "#a19e9e" 2909 } 2910 ] 2911 }, 2912 { 2913 "featureType": "road.local", 2914 "elementType": "labels.text.fill", 2915 "stylers": [ 2916 { 2917 "color": "#806b63" 2918 } 2919 ] 2920 }, 2921 { 2922 "featureType": "transit.line", 2923 "elementType": "geometry", 2924 "stylers": [ 2925 { 2926 "color": "#dfd2ae" 2927 } 2928 ] 2929 }, 2930 { 2931 "featureType": "transit.line", 2932 "elementType": "labels.text.fill", 2933 "stylers": [ 2934 { 2935 "color": "#8f7d77" 2936 } 2937 ] 2938 }, 2939 { 2940 "featureType": "transit.line", 2941 "elementType": "labels.text.stroke", 2942 "stylers": [ 2943 { 2944 "color": "#ebe3cd" 2945 } 2946 ] 2947 }, 2948 { 2949 "featureType": "transit.station", 2950 "elementType": "geometry", 2951 "stylers": [ 2952 { 2953 "color": "#dfd2ae" 2954 } 2955 ] 2956 }, 2957 { 2958 "featureType": "water", 2959 "elementType": "geometry.fill", 2960 "stylers": [ 2961 { 2962 "color": "#cedcda" 2963 } 2964 ] 2965 }, 2966 { 2967 "featureType": "water", 2968 "elementType": "labels.text.fill", 2969 "stylers": [ 2970 { 2971 "color": "#92998d" 2972 } 2973 ] 2974 } 2975 ] 2976 }; 2977 2978 var map = document.getElementById('googleMap'); 2979 2980 if (map !== null) { 2981 2982 var map = new google.maps.Map(document.getElementById("googleMap"), mapProp); 2983 2984 } 2985 2986 var marker = new google.maps.Marker({ 2987 position: { lat: 51.503454, lng: -0.124755 }, 2988 map: map, 2989 icon: 'images/marker.png' 2990 }); 2991
2992 marker.setMap(map); 2993 2994 //Zoom to 7 when clicked on marker 2995 google.maps.event.addListener(marker, 'click', function () { 2996 map.setZoom(9); 2997 map.setCenter(marker.getPosition()); 2998 }); 2999 3000 } 3001 3002 google.maps.event.addDomListener(window, 'load', loadMap); 3003 3004 } 3005 3006 /* ---------------------------------------- 3007 End of Google Maps 3008 ---------------------------------------- */ 3009 3010 /* ---------------------------------------- 3011 Bg move 3012 ---------------------------------------- */ 3013 3014 App.modules.bgMove = function () { 3015 3016 var lFollowX = 0, 3017 lFollowY = 0, 3018 x = 0, 3019 y = 0, 3020 friction = 1 / 30; 3021 3022 function moveBackground() { 3023 x += (lFollowX - x) * friction; 3024 y += (lFollowY - y) * friction; 3025 3026 var translate = 'translate(' + x + 'px, ' + y + 'px) scale(1)'; 3027 3028 $('.bg-move').css({ 3029 '-webit-transform': translate, 3030 '-moz-transform': translate, 3031 'transform': translate 3032 }); 3033 3034 window.requestAnimationFrame(moveBackground); 3035 } 3036 3037 $(window).on('mousemove click', function (e) { 3038 3039 var lMouseX = Math.max(-100, Math.min(100, $(window).width() / 2 - e.clientX)); 3040 var lMouseY = Math.max(-100, Math.min(100, $(window).height() / 2 - e.clientY)); 3041 lFollowX = (20 * lMouseX) / 100; // 100 : 12 = lMouxeX : lFollow 3042 lFollowY = (10 * lMouseY) / 100; 3043 3044 }); 3045 3046 moveBackground(); 3047 } 3048 3049 /* ---------------------------------------- 3050 Bg move 3051 ---------------------------------------- */ 3052 3053 /* ---------------------------------------- 3054 Shop item close 3055 ---------------------------------------- */ 3056 3057 /** 3058 * Initialize global close event 3059 * @return Object Core; 3060 **/ 3061 App.modules.closeBtn = function() { 3062 $('body').on('click.globalclose', '.mad-close-item:not(.shopping-cart-full .mad-close-item)', function (e) { 3063 e.preventDefault(); 3064 $(this).parent().stop().animate({ 3065 opacity: 0 3066 }, function () { 3067 $(this).stop().slideUp(function () { 3068 $(this).remove(); 3069 }); 3070 }); 3071 }); 3072 var c = $('.shopping-cart-full'); 3073 c.on('click.removeProduct', '.mad-close-item', function (e) { 3074 e.preventDefault(); 3075 $(this).closest('tr').stop().fadeOut(function () { 3076 $(this).remove(); 3077 }); 3078 }); 3079 return this; 3080 } 3081 3082 /* ---------------------------------------- 3083 Shop item close 3084 ---------------------------------------- */ 3085 3086 /* ---------------------------------------- 3087 View Types 3088 ---------------------------------------- */ 3089 3090 App.modules.viewTypes = function() { 3091 3092 var collection = $('[data-view]'); 3093 if (!collection.length) return; 3094 3095 if ($('.mad-full-page-wrap').length) { 3096 $('.toggle-map').on('click', function (e) { 3097 e.preventDefault(); 3098 $(this).toggleClass('active'); 3099 $('body').toggleClass('mad-full-page'); 3100 }); 3101 $('.toggle-list').on('click', function (e) { 3102 e.preventDefault(); 3103 $('.toggle-map').addClass('active not-active'); 3104 $('body').addClass('mad-full-page'); 3105 }); 3106 $('.toggle-grid').on('click', function (e) { 3107 e.preventDefault(); 3108 $('.toggle-map').removeClass('not-active'); 3109 }); 3110 } else { 3111 $('.toggle-map').on('click', function (e) { 3112 e.preventDefault(); 3113 $(this).toggleClass('active'); 3114 $('.gmap-toggle').slideToggle(); 3115 }); 3116 } 3117 3118 collection.on('click', function (e) { 3119 3120 e.preventDefault(); 3121 var $this = $(this), 3122 target = $($this.data('target')); 3123 3124 $this 3125 .addClass('active') 3126 .siblings("a:not('.toggle-map')") 3127 .removeClass('active'); 3128 3129 target 3130 .removeClass('mad-entity-hr mad-entity-vr mad-entity-ar') 3131 .addClass('mad-entity-' + $this.data('view')); 3132 3133 target 3134 .removeClass('style-2 style-4 mad-entity-2 mad-entity-4') 3135 .addClass('style-' + $this.data('view')); 3136 3137 $('.owl-carousel').trigger('refresh.owl.carousel'); 3138 3139 }); 3140 3141 $('.view-type a').on('click', function () { 3142 $('.owl-carousel').trigger('refresh.owl.carousel'); 3143 }); 3144 3145 return collection; 3146 3147 } 3148 3149 /* ---------------------------------------- 3150 View Types 3151 ---------------------------------------- */ 3152 3153 /** 3154 * Emulates single accordion item 3155 * @param Function callback 3156 * @return jQuery collection; 3157 **/ 3158 App.modules.hiddenSections = function(callback) { 3159 3160 var collection = $('.hidden-section'); 3161 if (!collection.length) return; 3162 3163 collection.each(function (i, el) { 3164 $(el).find('.content').hide(); 3165 }); 3166 3167 collection.on('click.hidden', '.invoker', function (e) { 3168 3169 e.preventDefault(); 3170 3171 var content = $(this).closest('.hidden-section').find('.content'); 3172 3173 content.slideToggle({ 3174 duration: 500, 3175 easing: 'easeOutQuint', 3176 complete: callback ? callback : function () { } 3177 }); 3178 3179 }); 3180 3181 return collection; 3182 3183 }, 3184 3185 $.extend({ 3186 isjQuery: function(element, elementExists) { 3187 if(element === undefined || element === null) return false;
3188 3189 if(elementExists === undefined) { 3190 return element instanceof jQuery; 3191 } 3192 else { 3193 return $.isjQuery(element) && element.length; 3194 } 3195 } 3196 }); 3197 3198 $.fn.extend({ 3199 jQueryImagesLoaded : function () { 3200 var $imgs = this.find('img[src!=""]'); 3201 3202 if (!$imgs.length) {return $.Deferred().resolve().promise();} 3203 3204 var dfds = []; 3205 3206 $imgs.each(function(){ 3207 var dfd = $.Deferred(); 3208 dfds.push(dfd); 3209 var img = new Image(); 3210 img.onload = function(){dfd.resolve();}; 3211 img.onerror = function(){dfd.resolve();}; 3212 img.src = this.src; 3213 }); 3214 3215 return $.when.apply($,dfds); 3216 } 3217 }); 3218 3219 $doc.on('beforeClose', function(event) { 3220 if($(event.target).hasClass('mad-modal')) { 3221 event.stopImmediatePropagation(); 3222 } 3223 }); 3224 3225 $doc.ready(function() { 3226 App.afterDOMReady(); 3227 }); 3228 $(window).on('load', function() { 3229 3230 DOMDfd.done(function() { 3231 App.afterOuterResourcesLoaded(); 3232 }); 3233 3234 // Vertical menu 3235 3236 $('.mad-vr-nav > ul > li.menu-item-has-children > a').on('click', function (e) { 3237 e.preventDefault(); 3238 $(this).next('.sub-menu').slideToggle(); 3239 $(this).parent().siblings().children('.sub-menu').slideUp(); 3240 }); 3241 3242 }); 3243 3244 /* ---------------------------------------------------- */ 3245 /* Elevate zoom */ 3246 /* ---------------------------------------------------- */ 3247 3248 if ($('[data-zoom-image]').length) { 3249 3250 var button = $('.qv-preview'); 3251 3252 $("#zoom-image").elevateZoom({ 3253 gallery: 'thumbnails', 3254 galleryActiveClass: 'active', 3255 zoomType: "inner", 3256 cursor: "crosshair", 3257 responsive: true, 3258 zoomWindowFadeIn: 500, 3259 zoomWindowFadeOut: 500, 3260 easing: true, 3261 lensFadeIn: 500, 3262 lensFadeOut: 500 3263 }); 3264 3265 } 3266 3267 /* ---------------------------------------------------- */ 3268 /* Elevate zoom */ 3269 /* ---------------------------------------------------- */ 3270 3271 /* ---------------------------------------------------- */ 3272 /* Quantity */ 3273 /* ---------------------------------------------------- */ 3274 3275 if ($('.quantity').length) { 3276 var q = $('.quantity'); 3277 q.each(function () { 3278 var $this = $(this), 3279 button = $this.children('button'), 3280 input = $this.children('input[type="text"]'), 3281 val = +input.val(); 3282 button.on('click', function () { 3283 if ($(this).hasClass('qty-minus')) { 3284 if (val === 1) return false; 3285 input.val(--val); 3286 } 3287 else { 3288 input.val(++val); 3289 } 3290 }); 3291 }); 3292 } 3293 3294 /* ---------------------------------------------------- */ 3295 /* Quantity */ 3296 /* ---------------------------------------------------- */ 3297 3298 /* ---------------------------------------------------- */ 3299 /* Team Section */ 3300 /* ---------------------------------------------------- */ 3301 3302 if ($('.mad-team-section').length) { 3303 $('.mad-col').on('mouseenter', function () { 3304 $(this).siblings().removeClass('active'); 3305 $(this).addClass('active'); 3306 }) 3307 }; 3308 3309 /* ---------------------------------------------------- */ 3310 /* Team Section */ 3311 /* ---------------------------------------------------- */ 3312 3313 $(window).on('scroll resize load', function () { 3314 if ($(window).width() > 1280) { 3315 if ($(this).scrollTop() > 450) { 3316 $('.mad-element').addClass("mad-fixed"); 3317 $('.mad-property-section').css({ 'padding-top': ($(".mad-element").height() + 'px') }); 3318 } else { 3319 $('.mad-element').removeClass("mad-fixed"); 3320 $('.mad-property-section').css({ 'padding-top': (0 + 'px') }); 3321 } 3322 if ($('.mad-element.mad-fixed')) { 3323 $('.mad-element.mad-fixed').css({ 'top': ($(".mad-header-section--sticked").height() + 'px') }); 3324 } 3325 } else { 3326 return false;
3327 } 3328 }); 3329 3330 /* ---------------------------------------------------- */ 3331 /* Animate a regular anchor navigation */ 3332 /* ---------------------------------------------------- */ 3333 3334 if ($('a.animated').length) { 3335 3336 $('body').localScroll({ 3337 hash: true, 3338 filter: '.animated', 3339 onBefore: function () { 3340 this.offset = -300; 3341 } 3342 }); 3343 3344 // highlight menu element on scroll 3345 calculateScroll(); 3346 $(window).scroll(function (event) { 3347 calculateScroll(); 3348 }); 3349 3350 /* Automatically Highlights Navigation Item */ 3351 var rangeTop = 400; //rangeTop is used for changing the class a little sooner that reaching the top of the page 3352 var rangeBottom = 400; //rangeBottom is similar but used for when scrolling bottom to top 3353 function calculateScroll() { 3354 var winTop = $(window).scrollTop(); 3355 var contentTop = []; 3356 var contentBottom = []; 3357 $('#menu').find('a.animated').each(function () { 3358 contentTop.push($($(this).attr('href')).offset().top); 3359 contentBottom.push($($(this).attr('href')).offset().top + $($(this).attr('href')).height()); 3360 }) 3361 3362 $.each(contentTop, function (i) { 3363 if (winTop > contentTop[i] - rangeTop && winTop < contentBottom[i] - rangeBottom) { 3364 $('#menu > span').removeClass('tab-active').eq(i).addClass('tab-active'); 3365 } 3366 }) 3367 } 3368 3369 } 3370 3371 /* ---------------------------------------------------- */ 3372 /* Multiscroll */ 3373 /* ---------------------------------------------------- */ 3374 3375 if ($('#myContainer').length) { 3376 3377 if ($(window).width() <= 1024) { 3378 3379 $('.ms-right .ms-section').unwrap().appendTo('.ms-left'); 3380 3381 var ul = $('.ms-left').find('.ms-section').sort(function (a, b) { 3382 return $(a).data('id') - $(b).data('id') 3383 }) 3384 3385 $('.ms-left').empty().append(ul); 3386 3387 } else { 3388 $('#myContainer').multiscroll({ 3389 navigation: true, 3390 loopBottom: true, 3391 css3: true 3392 }); 3393 } 3394 3395 } 3396 3397 // Click btns 3398 3399 if ($('.mad-calendar').length) { 3400 $('.mad-calendar-item').on('click', function () { 3401 $('.mad-calendar-item').removeClass('active') 3402 $(this).addClass('active'); 3403 }); 3404 } 3405 3406 if ($('.toggle-btn').length) { 3407 $('.toggle-btn').on('click', function (e) { 3408 e.preventDefault(); 3409 $(this).toggleClass('toggled'); 3410 $(this).siblings('.toggle-section').slideToggle(); 3411 setTimeout(function () { 3412 $('.mad-tabs').data('tabs').updateContainer(); 3413 }, 300); 3414 $(this).siblings('.mad-table-wrap').find('.toggle-section').slideToggle(); 3415 }) 3416 } 3417 3418 return App; 3419 3420})(window.jQuery); 3421 3422/* 3423Plugin Name: SVG for jQuery. 3424*/ 3425$(function () { 3426 jQuery('img.svg').each(function () { 3427 var $img = jQuery(this); 3428 var imgID = $img.attr('id'); 3429 var imgClass = $img.attr('class'); 3430 var imgURL = $img.attr('src'); 3431 3432 jQuery.get(imgURL, function (data) { 3433 // Get the SVG tag, ignore the rest 3434 var $svg = jQuery(data).find('svg'); 3435 3436 // Add replaced image's ID to the new SVG 3437 if (typeof imgID !== 'undefined') { 3438 $svg = $svg.attr('id', imgID); 3439 } 3440 // Add replaced image's classes to the new SVG 3441 if (typeof imgClass !== 'undefined') { 3442 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 3443 } 3444 3445 // Remove any invalid XML tags as per http://validator.w3.org 3446 $svg = $svg.removeAttr('xmlns:a'); 3447 3448 // Check if the viewport is set, else we gonna set it if we can. 3449 if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) { 3450 $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')) 3451 } 3452 3453 // Replace image with new SVG 3454 $img.replaceWith($svg); 3455 3456 }, 'xml'); 3457 3458 }); 3459}); 3460 3461/* 3462Video Play 3463*/ 3464$(document).on('click', '.js-videoPoster', function (e) { 3465 //оÑменÑем ÑÑандаÑÑное дейÑÑвие button 3466 e.preventDefault(); 3467 var poster = $(this); 3468 // иÑем ÑодиÑÐµÐ»Ñ Ð±Ð»Ð¸Ð¶Ð°Ð¹Ñего по клаÑÑÑ 3469 var wrapper = poster.closest('.js-videoWrapper'); 3470 videoPlay(wrapper); 3471}); 3472 3473//вопÑоизводим видео, пÑи ÑÑом ÑкÑÑÐ²Ð°Ñ Ð¿Ð¾ÑÑÐµÑ 3474function videoPlay(wrapper) { 3475 var iframe = wrapper.find('.js-videoIframe'); 3476 // ÐеÑем ÑÑÑÐ»ÐºÑ Ð²Ð¸Ð´ÐµÐ¾ из data 3477 var src = iframe.data('src'); 3478 // ÑкÑÑваем поÑÑÐµÑ 3479 wrapper.addClass('videoWrapperActive'); 3480 // подÑÑавлÑем в src паÑамеÑÑ Ð¸Ð· data 3481 iframe.attr('src', src); 3482} 3483 3484/* ------------------------------------------------
3485 Sticky sidebar 3486------------------------------------------------ */ 3487 3488$(window).on("load resize", function () { 3489 3490 if ($(window).width() > 992 && $('.sticky-bar').length) { 3491 3492 $('.content, .sidebar , #sidebar').theiaStickySidebar({ 3493 // Settings 3494 additionalMarginTop: 160 3495 }); 3496 3497 } 3498 3499});
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.