1var almayer = (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 26 if(this.modules.backToTop) { 27 this.modules.backToTop({ 28 easing: 'easeOutQuint', 29 speed: 550, 30 cssPrefix: '' 31 }); 32 } 33 34 if(this.helpers.toggledFields) this.helpers.toggledFields(); 35 36 37 if(window.almayerSidebarHidden) { 38 new window.almayerSidebarHidden({ 39 cssPrefix: 'almayer-' 40 }); 41 } 42 43 44 45 if(this.modules.dropdown) this.modules.dropdown.init(); 46 47 if(this.modules.fancyboxAlbum) this.modules.fancyboxAlbum.init(); 48 49 if(this.modules.hiddenFilters) this.modules.hiddenFilters(); 50 51 if(this.modules.fieldCounter) this.modules.fieldCounter(); 52 53 if(this.modules.fieldDatepicker) this.modules.fieldDatepicker(); 54 55 if(this.modules.WPGallery) this.modules.WPGallery.init($('.gallery')); 56 57 58 var $datepickers = $('.almayer-datepicker'), 59 borderBottomDatepickerContainers = '.booking-form'; 60 61 if($datepickers.length && $.fn.datepicker) { 62 $datepickers.datepicker({ 63 showOtherMonths: true, 64 selectOtherMonths: true, 65 isRTL: self.RTL, 66 dayNamesMin: ["S", "M", "T", "W", "T", "F", "S"], 67 prevText: self.RTL ? '<i class="icon icon-chevron-right"></i>' : '<i class="icon icon-chevron-left"></i>', 68 nextText: self.RTL ? '<i class="icon icon-chevron-left"></i>' : '<i class="icon icon-chevron-right"></i>', 69 beforeShow: function(input, instance) { 70 var $input = $(input); 71 72 if($input.closest(borderBottomDatepickerContainers).length) { 73 instance.dpDiv.addClass('ui-datepicker--bordered-container'); 74 } 75 else { 76 instance.dpDiv.removeClass('ui-datepicker--bordered-container'); 77 } 78 } 79 }); 80 } 81 82 83 84 /* ------------------------------------------------ 85 Custom Select 86 ------------------------------------------------ */ 87 88 var $selects = $('.almayer-custom-select'); 89 90 if($selects.length){ 91 $selects.MadCustomSelect({ 92 cssPrefix: 'almayer-' 93 }); 94 } 95 96 97 98 /* ---------------------------------------- 99 Fancybox 100 ---------------------------------------- */ 101 102 if($.fancybox && $.fancybox.defaults) { 103 $.extend($.fancybox.defaults, { 104 transitionEffect: "slide", 105 transitionDuration: self.ANIMATIONDURATION, 106 animationDuration: self.ANIMATIONDURATION 107 }); 108 } 109 110 /* ---------------------------------------- 111 End of Fancybox 112 ---------------------------------------- */ 113 114 if(this.modules.arcticModals) this.modules.arcticModals.init( $('[data-arctic-modal]') ); 115 116 /* ------------------------------------------------ 117 Navigation 118 ------------------------------------------------ */ 119 120 var $nav = $('.almayer-navigation'), 121 $verticalNav = $('.almayer-navigation-vertical'); 122 123 if($nav.length){ 124 $nav.MonkeysanNav({ 125 cssPrefix: 'almayer-' 126 }); 127 128 $nav.on('submenumobileopened.jquery.nav', function() { 129 self.LinkUnderliner.toUnderline($(this).find('a')); 130 }); 131 } 132 133 if($verticalNav.length){ 134 $verticalNav.MonkeysanNav({ 135 cssPrefix: 'almayer-', 136 mobileBreakpoint: 10000 137 }); 138 $verticalNav.on('submenumobileopened.jquery.nav', function() { 139 self.LinkUnderliner.toUnderline($(this).find('a')); 140 }); 141 } 142 143 /* ------------------------------------------------ 144 End of Navigation 145 ------------------------------------------------ */ 146 147 /* ------------------------------------------------ 148 Custom Scrollbar 149 ------------------------------------------------ */ 150 151 var $customScrollbar = $('.almayer-sidebar-hidden .almayer-sidebar-hidden-content .almayer-navigation-container'), 152 $customScrollbarVerticalNav = $customScrollbar.children('.almayer-navigation-vertical'); 153 if($customScrollbar.length && $.fn.niceScroll) {
154 $customScrollbar.niceScroll({ 155 scrollspeed: 60, 156 mousescrollstep: 40, 157 cursorwidth: 2, 158 cursorborder: 0, 159 rtlmode: self.RTL, 160 railalign: self.RTL ? 'left': 'right', 161 cursorborderradius: 0, 162 cursorcolor: "#1c1c1c", 163 autohidemode: false, 164 horizrailenabled: false 165 }); 166 167 if($customScrollbarVerticalNav.length) { 168 $customScrollbarVerticalNav.on('navigationopening.jquery.nav submenumobileopening.jquery.nav submenumobileclosing.jquery.nav', function() { 169 $customScrollbar.getNiceScroll().resize(); 170 }); 171 } 172 } 173 174 /* ------------------------------------------------ 175 End of Custom Scrollbar 176 ------------------------------------------------ */ 177 178 /* ------------------------------------------------ 179 Revolution slider 180 ------------------------------------------------ */ 181 182 var $revSlider1 = $('#rev-slider-1'), 183 revApi1; 184 185 if($revSlider1.length && $.fn.revolution) { 186 revApi1 = $revSlider1.show().revolution({ 187 fullScreenOffsetContainer: ($(window).width() > 767 && $(window).height() > 600) ? '#almayer-header:not(.almayer-header--transparent-single)' : '', 188 sliderLayout: 'fullscreen', 189 dottedOverlay: 'almayer', 190 disableProgressBar: "on", 191 spinner: 'spinner3', 192 gridwidth:[1400, 1024, 813, 580], 193 responsiveLevels: [1400, 1024, 813, 580], 194 parallax: { 195 type: 'mouse+scroll', 196 origo: 'slidercenter', 197 speed: 400, 198 levels: [5,10,15,20,25,30,35,40,45,46,47,48,49,50,51,55], 199 disable_onmobile: 'on' 200 }, 201 navigation: { 202 keyboardNavigation: 'on', 203 keyboard_direction: 'horizontal', 204 onHoverStop: 'false', 205 arrows: { 206 enable: false, 207 }, 208 bullets: { 209 enable: true, 210 style: 'almayer', 211 hide_onleave: false, 212 h_align: 'right', 213 v_align: 'center', 214 direction: 'vertical', 215 h_offset: 60, 216 v_offset: 0, 217 space: 12, 218 hide_under: 1200 219 } 220 } 221 }); 222 223 revApi1.on('revolution.slide.onchange', function() { 224 self.helpers.updateGlobalNiceScroll(); 225 }); 226 } 227 228 if(this.helpers.revArrowsOutside) this.helpers.revArrowsOutside(); 229 230 /* ------------------------------------------------ 231 End of Revolution slider 232 ------------------------------------------------ */ 233 234 235 /* ---------------------------------------- 236 IsotopeWrapper 237 ---------------------------------------- */ 238 239 var $isotope = $('.almayer-grid--isotope:not(.almayer-grid--isotope-lazy)'), 240 $isotopeLazy = $('.almayer-grid--isotope.almayer-grid--isotope-lazy'); 241 242 if($isotope.length && window.almayerIsotopeWrapper) { 243 $isotope.each(function(index, container){ 244 var $container = $(container), 245 $stretchedSection = $container.closest('.almayer-section--stretched-content, .almayer-section--stretched-content-no-px'); 246 247 if($stretchedSection.length) { 248 $stretchedSection.on('stretched.almayer.Section', function() { 249 if($container.data('IsotopeWrapper')) return; 250 251 almayerIsotopeWrapper.init($container, { 252 itemSelector: '.almayer-grid-item', 253 transitionDuration: self.ANIMATIONDURATION 254 }); 255 }); 256 } 257 else { 258 almayerIsotopeWrapper.init($container, { 259 itemSelector: '.almayer-grid-item', 260 transitionDuration: self.ANIMATIONDURATION 261 }); 262 } 263 }); 264 } 265 266 if($isotopeLazy.length && window.almayerIsotopeWrapper) { 267 $isotopeLazy.each(function(index, container){ 268 var $container = $(container), 269 $stretchedSection = $container.closest('.almayer-section--stretched-content, .almayer-section--stretched-content-no-px'); 270 271 if($stretchedSection.length) { 272 $stretchedSection.on('stretched.almayer.Section', function() { 273 if($container.data('IsotopeWrapper')) return; 274 275 setTimeout(function(){ 276 almayerIsotopeWrapper.init($container, { 277 itemSelector: '.almayer-grid-item', 278 transitionDuration: self.ANIMATIONDURATION 279 }); 280 }, 500); 281 }); 282 } 283 else { 284 setTimeout(function(){ 285 almayerIsotopeWrapper.init($container, { 286 itemSelector: '.almayer-grid-item', 287 transitionDuration: self.ANIMATIONDURATION 288 }); 289 }, 500); 290 } 291 }); 292 } 293 294 /* ---------------------------------------- 295 End of IsotopeWrapper 296 ---------------------------------------- */ 297 298 /* ---------------------------------------- 299 Dynamic background image 300 ---------------------------------------- */ 301 302 var $backgrounds = $('[data-bg-image-src]:not([class*="almayer-colorizer--scheme-"])'); 303 304 if($backgrounds.length && this.helpers.dynamicBgImage) { 305 this.helpers.dynamicBgImage($backgrounds); 306 } 307 308 /* ---------------------------------------- 309 End of Dynamic background image 310 ---------------------------------------- */ 311 312 /* ---------------------------------------- 313 Owl Carousel
314 ---------------------------------------- */ 315 316 // owl carousel adaptive 317 if($('.owl-carousel').length) this.helpers.owlAdaptive(); 318 319 var $simpleSlideshow = $('.almayer-simple-slideshow') 320 321 if($simpleSlideshow.length && $.fn.owlCarousel) { 322 $simpleSlideshow.each(function(index, carousel){ 323 var $carousel = $(carousel), 324 $stretchedSection = $carousel.closest('.almayer-section--stretched-content, .almayer-section--stretched-content-no-px'); 325 326 if($stretchedSection.length) { 327 $stretchedSection.each(function(scindex, scelement){ 328 $(scelement).on('stretched.almayer.Section', function() { 329 $carousel.owlCarousel(self.helpers.owlSettings({ 330 margin: 1, 331 loop: false, 332 autoplay: $carousel.hasClass('almayer-simple-slideshow--autoplay') 333 })); 334 }); 335 }); 336 } 337 else { 338 339 $carousel.owlCarousel(self.helpers.owlSettings({ 340 margin: 1, 341 loop: false, 342 autoplay: $carousel.hasClass('almayer-simple-slideshow--autoplay') 343 })); 344 } 345 }); 346 } 347 348 349 this.helpers.gridOwl.extendConfigFor('.almayer-tabbed-carousel-thumbs', { 350 nav: true, 351 dots: false, 352 margin: 0, 353 loop: false, // !important 354 autoplay: false, 355 responsive: { 356 0: { 357 items: 1 358 }, 359 480: { 360 items: 2 361 }, 362 1200: { 363 items: 3 364 }, 365 1300: { 366 items: 4 367 } 368 }, 369 responsiveWithSidebar: { 370 0: { 371 items: 1 372 }, 373 480: { 374 items: 2 375 }, 376 1350: { 377 items: 3 378 } 379 } 380 }); 381 382 // Initialization owl carousels placed in the stretched sections 383 $('[class*="almayer-section--stretched-content"]').on('stretched.almayer.Section', function(event, $section) { 384 var $gridOwlCarousels = $section.find('.almayer-grid.owl-carousel'), 385 $simpleThumbs = $section.find('.almayer-simple-slideshow-thumbs.owl-carousel'); 386 387 if($gridOwlCarousels.length) self.helpers.gridOwl.add($gridOwlCarousels); 388 389 if($simpleThumbs.length) { 390 $simpleThumbs.owlCarousel(self.helpers.owlSettings({ 391 responsive: { 392 0: { 393 items: 2 394 }, 395 380: { 396 items: 3 397 }, 398 992: { 399 items: 4 400 }, 401 1200: { 402 items: 6 403 } 404 }, 405 margin: 10, 406 loop: false 407 })); 408 } 409 }); 410 411 // Initialization owl carousels placed in the normal sections 412 var $simpleThumbs = $('.almayer-simple-slideshow-thumbs.owl-carousel').filter(function(index, element){ 413 return !$(element).closest('[class*="almayer-section--stretched-content"]').length; 414 }); 415 416 if($simpleThumbs.length) { 417 $simpleThumbs.owlCarousel(self.helpers.owlSettings({ 418 responsive: { 419 0: { 420 items: 2 421 }, 422 380: { 423 items: 3 424 }, 425 992: { 426 items: 4 427 }, 428 1200: { 429 items: 6 430 } 431 }, 432 margin: 10, 433 loop: false 434 })); 435 } 436 437 this.helpers.gridOwl.add($('.almayer-grid.owl-carousel').filter(function(index, element){ 438 return !$(element).closest('[class*="almayer-section--stretched-content"]').length; 439 })); 440 441 this.helpers.owlSyncTabbed.init($("[data-tabbed-sync]")); 442 this.helpers.owlSync.init(); 443 444 445 /* ---------------------------------------- 446 End of Owl Carousel
447 ---------------------------------------- */ 448 449 450 451 /* ---------------------------------------- 452 Tabbed Grid 453 ---------------------------------------- */ 454 455 if(window.almayerTabbedGrid) { 456 window.almayerTabbedGrid.init($('.almayer-grid--tabbed'), { 457 cssPrefix: 'almayer-', 458 easing: self.ANIMATIONEASING, 459 duration: self.ANIMATIONDURATION 460 }); 461 462 $('[class*="almayer-section--stretched-content"]').on('stretched.almayer.Section', function(event, $section) { 463 var $gridTabbed = $section.find('.almayer-grid--tabbed'); 464 465 setTimeout(function(){ 466 if($gridTabbed.length) $gridTabbed.data('TabbedGrid').resize(); 467 }, self.ANIMATIONDURATION); 468 }); 469 470 $('.almayer-grid--tabbed').on('grid.resized.tabbedgrid item.shown.tabbedgrid', function(event, $grid) { 471 if($grid.data('TabsResizeTimeOutId')) clearTimeout($grid.data('TabsResizeTimeOutId')); 472 self.helpers.updateGlobalNiceScroll(); 473 474 $grid.data('TabsResizeTimeOutId', setTimeout(function(){ 475 var $tabs = $grid.closest('.almayer-tabs'), 476 Tabs; 477 if(!$tabs.length) return; 478 479 Tabs = $tabs.data('tabs'); 480 481 if(Tabs) Tabs.updateContainer(); 482 }, 100)); 483 }); 484 } 485 486 /* ---------------------------------------- 487 End of Tabbed Grid 488 ---------------------------------------- */ 489 490 /* ---------------------------------------- 491 Google Maps 492 ---------------------------------------- */ 493 494 if($('.almayer-gmap').length) this.modules.GoogleMaps.init(); 495 496 /* ---------------------------------------- 497 End of Google Maps 498 ---------------------------------------- */ 499 500 if(this.helpers.touchHoverEmulator) this.helpers.touchHoverEmulator($('.almayer-entities--style-17'), '.almayer-entity-link', '.almayer-entity'); 501 502 503 504 $body.on('spaceadded.almayer.stickysection spaceremoved.almayer.stickysection', function(){ 505 self.helpers.updateGlobalNiceScroll(); 506 }); 507 508 509 510 DOMDfd.resolve(); 511 }; 512 513 App.afterOuterResourcesLoaded = function() { 514 515 var self = this; 516 517 // Stop initializing any modules in case legacy browser is using 518 if(this.ISLEGACYBROWSER) return; 519 520 setTimeout(function(){ if(self.LinkUnderliner) self.LinkUnderliner.init($('a, .btn--link')); }, 100); 521 522 var $sections = $('.almayer-section'); 523 524 if(this.helpers.Colorizer) this.helpers.Colorizer.init($('[class*="almayer-colorizer--scheme-"]')); 525 526 if(this.modules.Section && $sections.length) { 527 this.modules.Section.init($sections); 528 } 529 530 if(this.helpers.Breadcrumb) this.helpers.Breadcrumb.init($('.almayer-header--transparent + .almayer-breadcrumb[data-bg-image-src]')); 531 532 /* ---------------------------------------- 533 SameHeight 534 ---------------------------------------- */ 535 536 if($.fn.MonkeysanSameHeight) { 537 538 var $sameheightContainers = $('.almayer-entities--style-6 .almayer-grid:not([data-isotope-layout="masonry"]):not(.almayer-grid--cols-1)').not('.almayer-shortcode-container'), 539 $pricingTables = $('.almayer-flexbox .offers-services'); 540 541 if( $sameheightContainers.length ) { 542 543 $sameheightContainers.each(function(index, container){ 544 var $container = $(container), 545 $items = $container.find('.almayer-grid-item'); 546 547 if($items.length) { 548 $container.MonkeysanSameHeight({ 549 target: $container.closest('.almayer-entities--style-6').length ? '.almayer-entity' : '.almayer-entity-content .almayer-aligner-inner', 550 isIsotope: $container.find('.almayer-grid--isotope').length, 551 columns: $items.length ? Math.floor( $container.outerWidth() / $items.first().outerWidth() ) : null 552 }); 553 } 554 }); 555 } 556 557 } 558 559 /* ---------------------------------------- 560 End of SameHeight 561 ---------------------------------------- */ 562 563 if(this.helpers.fullScreenArea) this.helpers.fullScreenArea.init({ 564 except: $('#almayer-header:not(.almayer-header--trans
564parent)').add($('#footer')) 565 }); 566 567 568 if(this.modules.preloader) this.modules.preloader(); 569 570 var $parallaxSections = $('.almayer-colorizer--parallax .almayer-colorizer-bg-image'); 571 572 if($parallaxSections.length) { 573 $parallaxSections.parallax("50%",.4); 574 } 575 }; 576 577 App.LinkUnderliner = { 578 _$collection: $(), 579 init: function($collection) { 580 var self = this, 581 $currentFilteredCollection; 582 583 if(!$.isjQuery($collection) || !$collection.length) return; 584 585 if(!this._bindedEvents) this._bindEvents(); 586 587 $currentFilteredCollection = $(); 588 589 $collection.each(function(index, element){ 590 var $element = $(element); 591 592 if(self._$collection.filter($element).length) return; 593 594 self._$collection = self._$collection.add($element); 595 $currentFilteredCollection = $currentFilteredCollection.add($element); 596 }); 597 598 return this.toUnderline($currentFilteredCollection); 599 }, 600 isRTL: function() { 601 return getComputedStyle(document.body).direction === 'rtl'; 602 }, 603 _bindEvents: function() { 604 var self = this; 605 606 $(window).on('resize.almayerLinksUnderline', function() { 607 if(self.resizeTimeOutId) clearTimeout(self.resizeTimeOutId); 608 609 self.resizeTimeOutId = setTimeout(function(){ 610 self.toUnderline(self._$collection); 611 }, 100); 612 }); 613 }, 614 toUnderline: function($collection) { 615 var self = this; 616 617 if(!$.isjQuery($collection) || !$collection.length) return; 618 619 return $collection.each(function(index, element){ 620 var $element = $(element), 621 transitionDuration = getComputedStyle($element.get(0)).transitionDuration, 622 transitionDurationMS = parseFloat(transitionDuration, 10) * 1000; 623 624 if(transitionDurationMS) { 625 setTimeout(function(){ 626 self.setUnderlineToElement($element); 627 }, transitionDurationMS); 628 } 629 else { 630 self.setUnderlineToElement($element); 631 } 632 }); 633 }, 634 setUnderlineToElement: function($element) { 635 var backgroundPosition = $element.css('background-position').split(' '), 636 resultLineHeight; 637 638 $element.css('white-space', 'nowrap'); 639 resultLineHeight = $element.outerHeight() - 1; 640 $element.css('white-space', ''); 641 642 if(this.isRTL() && backgroundPosition[0]) backgroundPosition[0] = '100%'; 643 644 if(backgroundPosition[1]) backgroundPosition[1] = resultLineHeight + 'px'; 645 646 $element.css('background-position', backgroundPosition.join(' ')); 647 } 648 }; 649 650 /* ---------------------------------------- 651 Back to top 652 ---------------------------------------- */ 653 654 App.modules.backToTop = function(config) { 655 656 var backToTop = { 657 658 init: function(config){ 659 660 var self = this; 661 662 if(config) this.config = $.extend(this.config, config); 663 664 this.btn = $('<button></button>', { 665 class: 'naVrh animated stealthy', 666 html: '<span class="icon icon-chevron-up"></span>' 667 }); 668 669 this.bindEvents(); 670 671 $body.append(this.btn); 672 673 }, 674 675 config: { 676 breakpoint: 700, 677 showClass: 'zoomIn', 678 hideClass: 'zoomOut', 679 easing: 'linear', 680 speed: 500, 681 cssPrefix: '' 682 }, 683 684 bindEvents: function(){ 685 686 var page = $('html, body'), 687 self = this; 688 689 this.btn.on('click', function(e){ 690 691 $body.getNiceScroll().stop(); 692 693 page.stop().animate({ 694 695 scrollTop: 0 696 697 }, { 698 easing: self.config.easing, 699 duration: self.config.speed 700 }); 701 702 }); 703 704 this.btn.on(App.ANIMATIONEND, function(e){ 705 706 e.preventDefault(); 707 708 var $this = $(this); 709 710 if($this.hasClass(self.config.hideClass)){ 711 712 $this 713 .addClass('stealthy') 714 .removeClass(self.config.hideClass + " " + self.config.cssPrefix + "inview"); 715 716 } 717 718 }); 719 720 $(window).on('scroll.backtotop', { self: this}, this.toggleBtn); 721 722 }, 723 724 toggleBtn: function(e){ 725 726 var $this = $(this), 727 self = e.data.self; 728 729 if($this.scrollTop() > self.config.breakpoint && !self.btn.hasClass(self.config.cssPrefix + 'inview')){ 730 731 self.btn 732 .addClass(self.config.cssPrefix + 'inview') 733 .removeClass('stealthy'); 734 735 if(App.ANIMATIONSUPPORTED){ 736 self.btn.addClass(self.config.showClass); 737 } 738 739 } 740 else if($this.scrollTop() < self.config.breakpoint && self.btn.hasClass(self.config.cssPrefix + 'inview')){ 741 742 self.btn.removeClass(self.config.cssPrefix + 'inview'); 743 744 if(!App.ANIMATIONSUPPORTED){ 745 self.btn.addClass('stealthy'); 746 } 747 else{ 748 self.btn.removeClass(self.config.showClass) 749 .addClass(self.config.hideClass); 750 } 751 752 } 753 754 } 755 756 }; 757 758 backToTop.init(config); 759 760 return this; 761 762 }; 763 764 /* ---------------------------------------- 765 End of Back to top 766 ---------------------------------------- */ 767 768 /* ---------------------------------------- 769 Preloader 770 ---------------------------------------- */ 771 772 App.modules.preloader = function() { 773 var $preloader = $('.preloader'), 774 leftPos = parseInt($preloader.css('margin-left'), 10), 775 topPos = parseInt($preloader.css('margin-top'), 10), 776 $w = $(window), 777 $nav = $('.almayer-navigation, .almayer-navigation-vertical'); 778 779 if($nav.length) { 780 $nav.off('click.almayerPreloader').on('click.almayerPreloader', 'a', function(event){ 781 782 var $this = $(this),
783 $circle = $('<div></div>', { 784 style: 'left: '+ event.clientX +'px; top: '+ event.clientY +'px;', 785 class: 'preloader-krug' 786 }); 787 788 if($body.hasClass('almayer-body--moving-to-another-page')) { 789 $circle.appendTo($body); 790 791 setTimeout(function(){ 792 $circle.addClass('preloader-krug--appearing'); 793 }, 20); 794 } 795 }); 796 } 797 798 if(!$preloader.length) return; 799 800 $body.off('mousemove.almayerPreloader').on('mousemove.almayerPreloader', function(event) { 801 $preloader.css({ 802 'margin-left': leftPos - ($w.width() / 2 - event.pageX), 803 'margin-top': topPos - ($w.height() / 2 - (event.pageY - $w.scrollTop())), 804 }); 805 }).jQueryImagesLoaded().then(function(){ 806 var $niceScrollRails = $('.nicescroll-rails'); 807 808 $preloader.addClass('preloader--disappearing'); 809 setTimeout(function() { 810 $preloader.remove(); 811 $body.off('mousemove.almayerPreloader'); 812 App.helpers.updateGlobalNiceScroll(); 813 if($niceScrollRails.length) $niceScrollRails.css('visibility', 'visible'); 814 }, 700); 815 // can be removed in production (demo only): 816 if(window.location.hash == '#footer') { 817 $('html, body').stop().animate({ 818 scrollTop: $doc.height() 819 }, { 820 duration: self.ANIMATIONDURATION, 821 easing: self.ANIMATIONEASING 822 }); 823 } 824 }); 825 }; 826 827 /* ---------------------------------------- 828 End of Preloader 829 ---------------------------------------- */ 830 831 /* ---------------------------------------- 832 Field Counter 833 ---------------------------------------- */ 834 835 App.modules.fieldCounter = function() { 836 $body.on('click.almayerFieldCounter', '.almayer-field-counter-control', function(e) { 837 var $this = $(this), 838 $field = $this.siblings('.almayer-field-counter-target'), 839 $value = $this.siblings('.almayer-field-counter-value'), 840 val = +$field.val(); 841 842 if($this.hasClass('almayer-field-counter-control--decrease') && val != 0) { 843 val--; 844 } 845 else if($this.hasClass('almayer-field-counter-control--increase adults')&& val != 7) { 846 val++; 847 } 848 else if($this.hasClass('almayer-field-counter-control--increase kids')&& val != 3) { 849 val++; 850 } 851 else if($this.hasClass('almayer-field-counter-control--increase nights')&& val != 14) { 852 val++; 853 } 854 855 $field.val(val); 856 $value.text(val); 857 858 e.preventDefault(); 859 }); 860 861 862 }; 863 864 865 866 /* ---------------------------------------- 867 End of Field Counter 868 ---------------------------------------- */ 869 870 /* ---------------------------------------- 871 WPGallery 872 ---------------------------------------- */ 873 874 App.modules.WPGallery = {}; 875 App.modules.WPGallery._cache = []; 876 877 App.modules.WPGallery.init = function($collection) { 878 var self = this; 879 880 if(!$.isjQuery($collection, true)) return $collection; 881 882 return $collection.each(function(index, gallery){ 883 var $gallery = $(gallery); 884 885 if(self.isInitialized($gallery)) return; 886 887 self.initializeSingle($gallery); 888 }); 889 }; 890 891 App.modules.WPGallery.isInitialized = function($gallery) { 892 return !$.isjQuery($gallery, true) || $gallery.data('almayer-wp-gallery-initialized'); 893 }; 894 895 App.modules.WPGallery.initializeSingle = function($gallery) { 896 var $items, 897 id; 898 899 if(!$.isjQuery($gallery, true)) return $gallery; 900 901 $items = $gallery.find('a[href$=".jpg"], a[href$=".png"], a[href$=".jpeg"], a[href$=".gif"]'); 902 903 if($items.length) { 904 id = App.helpers.getRandomId('gallery'); 905 906 $items.data('fancybox', id).attr('data-fancybox', id); 907 908 $gallery.data('almayer-wp-gallery-initialized', true); 909 } 910 911 return $gallery; 912 }; 913 914 /* ---------------------------------------- 915 End of WPGallery 916 ---------------------------------------- */ 917 918 919 /* ---------------------------------------- 920 Field Datepicker 921 ---------------------------------------- */ 922 923 App.modules.fieldDatepicker = function() { 924 $body.on('change.almayerFieldDatepicker', 'input.almayer-field-datepicker-invoker', function(event) { 925 var $field = $(this), 926 $markupField = $field.siblings('.almayer-field-datepicker'), 927 $day, 928 $yearAndMonth, 929 $dayName, 930 currentDate = moment($field.datepicker("getDate")); 931 932 if($markupField.length && $markupField.hasClass('almayer-field-datepicker--style-1')) { 933 $day = $markupField.find('.almayer-field-datepicker-day'); 934 $yearAndMonth = $markupField.find('.almayer-field-datepicker-month-year'); 935 $dayName = $markupField.find('.almayer-field-datepicker-dayname'); 936 937 if($day.length) { 938 $day.text(currentDate.date()); 939 } 940 941 if($yearAndMonth.length) { 942 $yearAndMonth.text(currentDate.format('MMMM, YYYY')); 943 } 944 945 if($dayName.length) { 946 $dayName.text(currentDate.format('dddd')); 947 } 948 } 949 950 }); 951 }; 952 953 /* ---------------------------------------- 954 End of Field Datepicker 955 ---------------------------------------- */ 956 957 958 /* ---------------------------------------- 959 Fancybox Album 960 ---------------------------------------- */ 961 962 App.modules.fancyboxAlbum = {}; 963 964 App.modules.fancyboxAlbum.init = function() { 965 $body.off('click.almayerFancyboxAlbum').on('click.almayerFancyboxAlbum', '[data-fancybox-album-src]', function(event) { 966 var $this = $(this), 967 srcs; 968 969 if($.fn.fancybox) { 970 srcs = $this.data('fancybox-album-src'); 971 if(srcs) $.fancybox.open(srcs); 972 } 973 974 event.preventDefault(); 975 }); 976 }; 977 978 /* ---------------------------------------- 979 End of Fancybox Album 980 ---------------------------------------- */ 981 982 /* ---------------------------------------- 983 Dropdown 984 ---------------------------------------- */ 985 986 App.modules.dropdown = {}; 987 988 App.modules.dropdown.config = { 989 uncloseable: '.almayer-dropdown', 990 cssPrefix: 'almayer-', 991 availableError: 30, 992 rtl: App.RTL, 993 classMap: { 994 active: 'dropdown--opened', 995 container: 'dropdown', 996 title: 'dropdown-title', 997 element: 'dropdown-element', 998 leftPlaced: 'dropdown-element--x-left', 999 rightPlaced: 'dropdown-element--x-right', 1000 topPlaced: 'dropdown-element--y-top' 1001 } 1002 }; 1003 1004 App.modules.dropdown.init = function(config) { 1005 if(this._initialized) return; 1006 1007 if($.isPlainObject(config)) $.extend(true, this.config, config); 1008 1009 Object.defineProperties(this, { 1010 activeClass: { 1011 get: function() { 1012 return this.config.cssPrefix + this.config.classMap.active; 1013 } 1014 }, 1015 containerClass: { 1016 get: function() { 1017 return this.config.cssPrefix + this.config.classMap.container; 1018 } 1019 }, 1020 titleClass: { 1021 get: function() { 1022 return this.config.cssPrefix + this.config.classMap.title; 1023 } 1024 }, 1025 elementClass: { 1026 get: function() { 1027 return this.config.cssPrefix + this.config.classMap.element; 1028 } 1029 }, 1030 rightPlacedClass: { 1031 get: function() { 1032 return this.config.cssPrefix + this.config.classMap.rightPlaced; 1033 } 1034 }, 1035 leftPlacedClass: { 1036 get: function() { 1037 return this.config.cssPrefix + this.config.classMap.leftPlaced; 1038 } 1039 }, 1040 topPlacedClass: { 1041 get: function() { 1042 return this.config.cssPrefix + this.config.classMap.topPlaced; 1043 } 1044 }, 1045 $dropdowns: { 1046 get: function() { 1047 return $('.' + this.containerClass); 1048 } 1049 } 1050 }); 1051 1052 this._bindEvents(); 1053 }; 1054 1055 App.modules.dropdown._bindEvents = function() { 1056 var self = this; 1057 1058 $doc.off('click.almayerDropdown').on('click.almayerDropdown', function(e) { 1059 var $target = $(e.target); 1060 1061 if(!$target.closest(self.config.uncloseable).length) { 1062 self.close(self.$dropdowns); 1063 } 1064 }).on('keydown.almayerDropdown', function(event) { 1065 if(event.keyCode && event.keyCode == 27) { 1066 self.close(self.$dropdowns); 1067 } 1068 }); 1069 1070 $body.off('click.almayerDropdown').on('click.almayerDropdown', '.' + self.titleClass, function(e) { 1071 var $dropdown = $(this).closest('.' + self.containerClass), 1072 $others = self.$dropdowns.not($dropdown); 1073 1074 if($dropdown.length) { 1075 self.toggle($dropdown); 1076 e.preventDefault(); 1077 } 1078 1079 self.close($others); 1080 }); 1081 1082 this._initialized = true; 1083 }; 1084 1085 App.modules.dropdown.close = function($dropdowns) { 1086 if(!$.isjQuery($dropdowns, true)) return; 1087 1088 $dropdowns.removeClass(this.activeClass) 1089 .find('.' + this.elementClass) 1090 .attr('aria-hidden', 'true') 1091 .end() 1092 .find('.' + this.titleClass) 1093 .attr('aria-expanded', 'false'); 1094 }; 1095 1096 App.modules.dropdown.open = function($dropdowns) { 1097 if(!$.isjQuery($dropdowns, true)) return; 1098 1099 this.fixPosition($dropdowns); 1100 1101 $dropdowns.addClass(this.activeClass) 1102 .find('.' + this.elementClass) 1103 .attr('aria-hidden', 'false') 1104 .end() 1105 .find('.' + this.titleClass) 1106 .attr('aria-expanded', 'true'); 1107 }; 1108 1109 App.modules.dropdown.fixPosition = function($dropdowns) { 1110 var self = this, 1111 $w = $(window); 1112 1113 if(!$.isjQuery($dropdowns, true)) return; 1114 1115 return $dropdowns.each(function(index, dropdown) { 1116 var $dropdown = $(dropdown), 1117 $element = $dropdown.find('.' + self.elementClass), 1118 dOffset; 1119 1120 $element.removeClass(self.leftPlacedClass) 1121 .removeClass(self.rightPlacedClass) 1122 .removeClass(self.topPlacedClass); 1123 1124 dOffset = $element.offset(); 1125 1126 // x 1127 if(dOffset.left - self.config.availableError < 0) { 1128 $element.addClass(self.leftPlacedClass); 1129 } 1130 else if(dOffset.left + $element.outerWidth() + self.config.availableError > $w.width()) { 1131 $element.addClass(self.rightPlacedClass); 1132 } 1133 1134 // y 1135 if(dOffset.top + $element.outerHeight() + self.config.availableError > $w.scrollTop() + $w.height()) { 1136 $element.addClass(self.topPlacedClass); 1137 } 1138 }); 1139 }; 1140 1141 App.modules.dropdown.toggle = function($dropdowns) { 1142 if(!$.isjQuery($dropdowns, true)) return; 1143 var self = this; 1144 1145 return $dropdowns.each(function(index, dropdown){ 1146 var $dropdown = $(dropdown); 1147 1148 if($dropdown.hasClass(self.activeClass)) self.close($dropdown); 1149 else self.open($dropdown); 1150 }); 1151 }; 1152 1153 /* ---------------------------------------- 1154 End of Dropdown 1155 ---------------------------------------- */ 1156 /* ---------------------------------------- 1157 Arctic Modal 1158 ---------------------------------------- */ 1159 1160 App.modules.arcticModals = { 1161 _config: { 1162 type: 'html', 1163 closeOnOverlayClick: true, 1164 overlay: { 1165 css: { 1166 opacity: .9, 1167 backgroundColor: '#000000' 1168 } 1169 }, 1170 clickableElements: null 1171 }, 1172 _collection: $(), 1173 init: function( collection, config ) { 1174 1175 if( !collection || !collection.length ) return; 1176 1177 config = $.isPlainObject( config ) ? $.extend(true, {}, this._config, config) : this._config; 1178 1179 config = this._prepareCallbacks( config ); 1180 1181 if( config && config.clickableElements ) { 1182 $body.on('click.almayerArcticModals', '.arcticmodal-container', function(e){ 1183 var $target = $(e.target); 1184 if( !$target.closest( config.clickableElements ).length ) { 1185 $.arcticmodal('close'); 1186 } 1187 }); 1188 } 1189 1190 collection.on('click.almayerArcticModals', function(e) { 1191 1192 var $this = $(this); 1193 1194 if( $this.data('arctic-modal-type') == 'ajax' ) { 1195 if(!$this.data('arctic-modal-ajax-action')) { 1196 return; 1197 } 1198 1199 $.arcticmodal($.extend(true, {}, config, { 1200 type: 'ajax', 1201 url: almayerAJAXData.url, 1202 ajax: { 1203 cache: false, 1204 dataType: 'html', 1205 data: { 1206 action: $this.data('arctic-modal-ajax-action'), 1207 data: $this.data('arctic-modal-ajax-data'), 1208 AJAX_token: almayerAJAXData.AJAX_token 1209 }, 1210 success: function(data, el, response) { 1211 data.body.html( response ); 1212 } 1213 } 1214 })); 1215 } 1216 else { 1217 $($this.data('arctic-modal')).arcticmodal(config); 1218 } 1219 1220 e.preventDefault(); 1221 }); 1222 }, 1223 _prepareCallbacks: function(config) { 1224 var beforeOpenCallback = config.beforeOpen || function(){}, 1225 beforeCloseCallback = config.beforeClose || function(){}, 1226 afterOpenCallback = config.afterOpen || function(){}, 1227 afterCloseCallback = config.afterClose || function(){}; 1228 1229 config.b
1229eforeOpen = function() { 1230 1231 beforeOpenCallback.apply(this, Array.prototype.slice(arguments, 0)); 1232 }; 1233 1234 config.afterOpen = function () { 1235 if(App.LinkUnderliner) { 1236 App.LinkUnderliner.init(this.body.find('a')); 1237 } 1238 afterOpenCallback.apply(this, Array.prototype.slice(arguments, 0)); 1239 }; 1240 1241 config.beforeClose = function(event) { 1242 1243 beforeCloseCallback.apply(this, Array.prototype.slice(arguments, 0)); 1244 }; 1245 1246 config.afterClose = function(event) { 1247 $body.css('overflow', ''); 1248 1249 afterCloseCallback.apply(this, Array.prototype.slice(arguments, 0)); 1250 }; 1251 1252 return config; 1253 1254 } 1255 }; 1256 1257 /* ---------------------------------------- 1258 End of Arctic Modal 1259 ---------------------------------------- */ 1260 1261 /* ---------------------------------------- 1262 Alert Message Module 1263 ---------------------------------------- */ 1264 1265 App.modules.alertMessage = function(options) { 1266 if(!('Handlebars' in window)) return; 1267 var config = { 1268 target: $body.children().last(), 1269 type: 'info', 1270 timeout: 4000 1271 }; 1272 config = options && $.isPlainObject(options) ? $.extend(true, {}, config, options) : config; 1273 1274 var template = 1275 '<div class="almayer-alert-box almayer-alert-box--{{type}}" style="display: none;">\ 1276 <div class="almayer-alert-box-inner">\ 1277 {{message}}\ 1278 </div>\ 1279 </div>'; 1280 1281 var messageBox = $(Handlebars.compile(template)(config)); 1282 messageBox.data('timeOut', setTimeout(function(){ 1283 messageBox.stop().slideUp({ 1284 duration: 350, 1285 easing: 'linear', 1286 complete: function() { 1287 $(this).remove(); 1288 App.helpers.updateGlobalNiceScroll(); 1289 }, 1290 step: function() { 1291 var $this = $(this), 1292 $niceScrolled = $this.closest('.almayer--nice-scrolled'); 1293 1294 if($niceScrolled.length) { 1295 $niceScrolled.getNiceScroll().resize(); 1296 } 1297 App.helpers.updateGlobalNiceScroll(); 1298 1299 } 1300 }); 1301 }, config.timeout)).insertAfter(config.target).stop().slideDown({ 1302 duration: 350, 1303 easing: 'linear', 1304 step: function() { 1305 var $this = $(this), 1306 $niceScrolled = $this.closest('.almayer--nice-scrolled'); 1307 1308 if($niceScrolled.length) { 1309 $niceScrolled.getNiceScroll().resize(); 1310 } 1311 App.helpers.updateGlobalNiceScroll(); 1312 1313 }, 1314 completer: function() { 1315 App.helpers.updateGlobalNiceScroll(); 1316 } 1317 }); 1318 }; 1319 1320 /* ---------------------------------------- 1321 End of Alert Message Module 1322 ---------------------------------------- */ 1323 1324 1325 /* ---------------------------------------- 1326 Section Module 1327 ---------------------------------------- */ 1328 1329 App.modules.Section = {}; 1330 App.modules.Section._$collection = $(); 1331 App.modules.Section.config = { 1332 cssPrefix: 'almayer-', 1333 resizeDelay: 10, 1334 boddyPaddings: false, 1335 classMap: { 1336 loading: 'section--loading', 1337 stretched: 'section--stretched', 1338 stretchedContent: 'section--stretched-content', 1339 stretchedContentNoPadding: 'section--stretched-content-no-px', 1340 bgColorElementClass: 'colorizer-bg-color', 1341 bgImageElementClass: 'colorizer-bg-image' 1342 } 1343 }; 1344 1345 Object.defineProperties(App.modules.Section, { 1346 bgColorElementClass: { 1347 get: function() { 1348 return this.config.cssPrefix + this.config.classMap.bgColorElementClass; 1349 } 1350 }, 1351 bgImageElementClass: { 1352 get: function() { 1353 return this.config.cssPrefix + this.config.classMap.bgImageElementClass; 1354 } 1355 }, 1356 stretchedClass: { 1357 get: function() { 1358 return this.config.cssPrefix + this.config.classMap.stretched; 1359 } 1360 }, 1361 stretchedContentClass: { 1362 get: function() { 1363 return this.config.cssPrefix + this.config.classMap.stretchedContent; 1364 } 1365 }, 1366 stretchedContentNoPaddingClass: { 1367 get: function() { 1368 return this.config.cssPrefix + this.config.classMap.stretchedContentNoPadding; 1369 } 1370 }, 1371 loadingClass: { 1372 get: function() { 1373 return this.config.cssPrefix + this.config.classMap.loading; 1374 } 1375 } 1376 }); 1377 1378 App.modules.Section.changeConfig = function(config) { 1379 return $.extend(true, this.config, config); 1380 }; 1381 1382 App.modules.Section.init = function($collection) { 1383 var self = this; 1384 1385 if(!$.isjQuery($collection, true)) return; 1386 1387 if(!this._bindedGlobalEvents) this._bindGlobalEvents(); 1388 1389 return $collection.each(function(index, section){ 1390 var $section = $(section); 1391 1392 if(self._$collection.filter($section).length) return; 1393 1394 self.build($section); 1395 self._$collection = self._$collection.add($section); 1396 }); 1397 }; 1398 1399 App.modules.Section._bindGlobalEvents = function () { 1400 var self = this; 1401 1402 $(window).on('resize.App.modules.Section', function() { 1403 if(self._resizeTimeOutId) clearTimeout(self._resizeTimeOutId); 1404 1405 self._resizeTimeOutId = setTimeout(function(){ 1406 self.rebuild(); 1407 }, self.config.resizeDelay); 1408 }); 1409 }; 1410 1411 App.modules.Section.rebuild = function() { 1412 var self = this; 1413 1414 return this._$collection.each(function(index, section){ 1415 var $section = $(section); 1416 1417 self.reset($section).build($section); 1418 }); 1419 }; 1420 1421 App.modules.Section.reset = function($section) { 1422 if(!$.isjQuery($section, true)) return; 1423 1424 $section.css({ 1425 'margin-left': '', 1426 'margin-right': '' 1427 }); 1428 1429 return this; 1430 }; 1431 1432 App.modules.Section.build = function($section) { 1433 if(!$.isjQuery($section, true)) return; 1434 1435 if($section.hasClass(this.stretchedClass)) { 1436 this.stretch($section); 1437 } 1438 else if($section.hasClass(this.stretchedContentClass) || $section.hasClass(this.stretchedContentNoPaddingClass)) { 1439 this.stretchContent($section); 1440 } 1441 1442 return this; 1443 }; 1444 1445 App.modules.Section.getDocumentGeometry = function() { 1446 return { 1447 'padding-left': parseInt($body.css('padding-left'), 10), 1448 'padding-right': parseInt($body.css('padding-right'), 10) 1449 }; 1450 }; 1451 1452 App.modules.Section.stretch = function($section) { 1453 var $bgs, xOffsetDiff, documentGeometry; 1454 1455 if(!$.isjQuery($section, true)) return; 1456 1457 $bgs = $section.find('.' + this.bgColorElementClass + ', .' + this.bgImageElementClass); 1458 1459 if(!$bgs.length) return; 1460 1461 xOffsetDiff = $section.offset().left; 1462 documentGeometry = this.getDocumentGeometry(); 1463 1464 if(xOffsetDiff > 0) { 1465 $bgs.css({ 1466 left: (xOffsetDiff - documentGeometry['padding-left']) / -1, 1467 right: (xOffsetDiff - documentGeometry['padding-right']) / -1 1468 }); 1469 } 1470 1471 $section.removeClass(this.loadingClass).trigger('stretched.almayer.Section', [$
1471section]); 1472 1473 return $section; 1474 }; 1475 1476 App.modules.Section.stretchContent = function($section) { 1477 var xOffsetDiff, documentGeometry; 1478 1479 if(!$.isjQuery($section) || !$section.length) return; 1480 1481 xOffsetDiff = $section.offset().left; 1482 documentGeometry = this.getDocumentGeometry(); 1483 1484 if(xOffsetDiff > 0) { 1485 $section.css({ 1486 'margin-left': (xOffsetDiff - documentGeometry['padding-left']) / -1, 1487 'margin-right': (xOffsetDiff - documentGeometry['padding-right']) / -1 1488 }); 1489 } 1490 1491 $section.removeClass(this.loadingClass).trigger('stretched.almayer.Section', [$section]); 1492 1493 return $section; 1494 }; 1495 1496 /* ---------------------------------------- 1497 End of Section Module 1498 ---------------------------------------- */ 1499 1500 /* ---------------------------------------- 1501 Nice Scroll updater 1502 ---------------------------------------- */ 1503 1504 App.helpers.updateGlobalNiceScroll = function() { 1505 $body.getNiceScroll().resize(); 1506 }; 1507 1508 /* ---------------------------------------- 1509 End of Nice Scroll updater 1510 ---------------------------------------- */ 1511 1512 /* ---------------------------------------- 1513 ID Randomizer 1514 ---------------------------------------- */ 1515 1516 App.helpers.getRandomId = function(idPart) { 1517 if(!('ids' in App._localCache)) App._localCache['ids'] = []; 1518 idPart = idPart || 'identifier'; 1519 1520 var id = idPart + '-' + +(new Date()); 1521 1522 if(App._localCache['ids'].indexOf(id) != -1) { 1523 id = App.helpers.getRandomId(idPart); 1524 } 1525 1526 App._localCache['ids'].push(id); 1527 1528 return id; 1529 }; 1530 1531 /* ---------------------------------------- 1532 End of ID Randomizer 1533 ---------------------------------------- */ 1534 1535 1536 /* ---------------------------------------- 1537 Colorizer 1538 ---------------------------------------- */ 1539 1540 App.helpers.Colorizer = {}; 1541 App.helpers.Colorizer.config = { 1542 cssPrefix: 'almayer-', 1543 classMap: { 1544 bgColorElement: 'colorizer-bg-color', 1545 bgImageElement: 'colorizer-bg-image', 1546 parallax: 'colorizer--parallax' 1547 }, 1548 afterInit: function() {} 1549 }; 1550 1551 Object.defineProperties(App.helpers.Colorizer, { 1552 bgColorElementClass: { 1553 get: function() { 1554 return this.config.cssPrefix + this.config.classMap.bgColorElement; 1555 } 1556 }, 1557 bgImageElementClass: { 1558 get: function() { 1559 return this.config.cssPrefix + this.config.classMap.bgImageElement; 1560 } 1561 }, 1562 parallaxClass: { 1563 get: function() { 1564 return this.config.cssPrefix + this.config.classMap.parallax; 1565 } 1566 } 1567 }); 1568 1569 /** 1570 * 1571 * @param {jQuery} $collection - collection of elements to colorize 1572 * @returns {jQuery} $collection 1573 */ 1574 App.helpers.Colorizer.init = function($collection, config) { 1575 var self = this; 1576 1577 if(!$.isjQuery($collection, true)) return $collection; 1578 1579 this.config = $.extend(true, {}, this.config, config); 1580 1581 $collection.each(function(index, element) { 1582 var $element = $(element); 1583 1584 if(!self.hasBGColorElement($element)) { 1585 self.appendBGColorElement($element); 1586 } 1587 1588 if(!self.hasBGImageElement($element) && $element.data('bg-image-src')) { 1589 self.appendBGImageElement($element); 1590 } 1591 }); 1592 1593 this.config.afterInit.call(this); 1594 1595 return $collection; 1596 }; 1597 1598 /** 1599 * 1600 * @param {jQuery} $element 1601 * @returns {Boolean} 1602 */ 1603 App.helpers.Colorizer.hasBGColorElement = function($element) { 1604 return $element.children('.' + this.bgColorElementClass).length; 1605 }; 1606 1607 /** 1608 * 1609 * @param {jQuery} $element 1610 * @returns {Boolean} 1611 */ 1612 App.helpers.Colorizer.hasBGImageElement = function($element) { 1613 return $element.children('.' + this.bgImageElementClass).length; 1614 }; 1615 1616 /** 1617 * 1618 * @param {jQuery} $element 1619 * @returns {jQuery} 1620 */ 1621 App.helpers.Colorizer.appendBGColorElement = function($element) { 1622 var self = this, 1623 $bgColorElement = $('<div></div>', { 1624 class: self.bgColorElementClass 1625 }); 1626
1627 return $element.prepend($bgColorElement); 1628 }; 1629 1630 /** 1631 * 1632 * @param {jQuery} $element 1633 * @returns {jQuery} 1634 */ 1635 App.helpers.Colorizer.appendBGImageElement = function($element) { 1636 var self = this, 1637 src = $element.data('bg-image-src'), 1638 $bgImageElement = $('<div></div>', { 1639 class: self.bgImageElementClass 1640 }); 1641 1642 $bgImageElement.css('background-image', 'url("'+src+'")'); 1643 $element.prepend($bgImageElement); 1644 1645 return $element; 1646 }; 1647 1648 /* ---------------------------------------- 1649 End of Colorizer 1650 ---------------------------------------- */ 1651 1652 1653 /* ---------------------------------------- 1654 Breadcrumb 1655 ---------------------------------------- */ 1656 1657 App.helpers.Breadcrumb = {}; 1658 App.helpers.Breadcrumb.$collection = $(); 1659 App.helpers.Breadcrumb.$w = $(window); 1660 1661 App.helpers.Breadcrumb.config = { 1662 until: 767, 1663 cssPrefix: 'almayer-', 1664 resizeTimeoutDelay: 10, 1665 classMap: { 1666 bgColorElement: 'colorizer-bg-color', 1667 bgImageElement: 'colorizer-bg-image' 1668 } 1669 }; 1670 1671 Object.defineProperties(App.helpers.Breadcrumb, { 1672 bgColorElementClass: { 1673 get: function() { 1674 return this.config.cssPrefix + this.config.classMap.bgColorElement; 1675 } 1676 }, 1677 bgImageElementClass: { 1678 get: function() { 1679 return this.config.cssPrefix + this.config.classMap.bgImageElement; 1680 } 1681 }, 1682 bgsSelectors: { 1683 get: function() { 1684 return '.' + this.bgColorElementClass + ', .' + this.bgImageElementClass; 1685 } 1686 } 1687 }); 1688 1689 App.helpers.Breadcrumb.init = function($breadcrumbs) { 1690 var self = this; 1691 1692 if(!$.isjQuery($breadcrumbs, true)) return; 1693 1694 this._bindEvents(); 1695 1696 $breadcrumbs.each(function(index, element) { 1697 var $element = $(element); 1698 1699 if(self.$collection.filter($element).length) return; 1700 1701 self.initCertainElement($element); 1702 }); 1703 }; 1704 1705 App.helpers.Breadcrumb._bindEvents = function() { 1706 var self = this; 1707 1708 if(!this._eventsBinded) { 1709 $body.on('spaceremoved.almayer.stickysection', function() { 1710 self.$collection.each(function(index, element){ 1711 self.stretch($(element)); 1712 }); 1713 }); 1714 1715 this.$w.on('resize', function() { 1716 if(self._resizeTimeOutId) clearTimeout(self._resizeTimeOutId); 1717 1718 self._resizeTimeOutId = setTimeout(function(){ 1719 self.$collection.each(function(index, element){ 1720 self.stretch($(element)); 1721 }); 1722 }, self.config.resizeTimeoutDelay); 1723 }); 1724 } 1725 }; 1726 1727 App.helpers.Breadcrumb.initCertainElement = function($breadcrumb) { 1728 this.$collection = this.$collection.add($breadcrumb); 1729 1730 this.stretch($breadcrumb); 1731 }; 1732 1733 App.helpers.Breadcrumb.stretch = function($breadcrumb) { 1734 var $prev = $breadcrumb.prev(), 1735 prevOH, 1736 $bgs, 1737 $stickedSections; 1738 1739 if($.isjQuery($prev, true)) { 1740 prevOH = $prev.outerHeight(); 1741 $bgs = $breadcrumb.find(this.bgsSelectors); 1742 $stickedSections = $('.almayer-header-section--sticked'); 1743 1744 if($bgs.length) { 1745 $bgs.css({ 1746 top: -prevOH 1747 }); 1748 } 1749 if($stickedSections.length) { 1750 $bgs.css({ 1751 top: $stickedSections.outerHeight() * -1 1752 }); 1753 } 1754 } 1755 1756 return $breadcrumb; 1757 }; 1758 1759 /* ---------------------------------------- 1760 End of Breadcrumb 1761 ---------------------------------------- */ 1762 1763 1764 1765 /* ---------------------------------------- 1766 End of Critical Error 1767 ---------------------------------------- */ 1768 1769 1770 /* ---------------------------------------- 1771 Dynamic background image 1772 ---------------------------------------- */ 1773 1774 App.helpers.dynamicBgImage = function(collection) { 1775 collection = $.isjQuery(collection) ? collection : $('[data-bg-image-src]'); 1776 if(!collection.length) return; 1777 1778 return collection.each(function(i, el){ 1779 var $this = $(el); 1780 if( !$this.data('bg-image-src') ) return; 1781 1782 $this.css('background-image', 'url("'+ $this.data('bg-image-src') +'")'); 1783 }); 1784 }, 1785 1786 /* ---------------------------------------- 1787 End of Dynamic background image 1788 ---------------------------------------- */ 1789 1790 1791 1792 /* ---------------------------------------- 1793 Owl Carousel helpers 1794 ---------------------------------------- */ 1795 1796 App.baseOwlSettings = { 1797 items: 1, 1798 margin: 30, 1799 nav: true, 1800 rtl: App.RTL, 1801 navText: App.RTL ? ['<i class="icon icon-chevron-right"></i>', '<i class="icon icon-chevron-left"></i>'] : ['<i class="icon icon-chevron-left"></i>', '<i class="icon icon-chevron-right"></i>'], 1802 dots: false, 1803 autoplayHoverPause: true, 1804 smartSpeed: App.ANIMATIONDURATION, 1805 fluidSpeed: App.ANIMATIONDURATION, 1806 autoplaySpeed: App.ANIMATIONDURATION, 1807 navSpeed: App.ANIMATIONDURATION, 1808 dotsSpeed: App.ANIMATIONDURATION, 1809 dragEndSpeed: App.ANIMATIONDURATION, 1810 onInitialized: function() { 1811 App.helpers.updateGlobalNiceScroll(); 1812 } 1813 }; 1814 1815 App.helpers.owlAdaptive = function(collection) { 1816
1817 collection = collection ? collection : $('.owl-carousel'); 1818 if(!collection.length) return; 1819 1820 1821 collection.each(function(i, el){ 1822 1823 var $this = $(el); 1824 1825 $this.on('initialized.owl.carousel', function(e){ 1826 1827 App.helpers.owlUpdateIsotopeParent($this); 1828 1829 }); 1830 1831 $this.on('resized.owl.carousel', function(e){ 1832 1833 App.helpers.owlContainerHeight($this, true); 1834 1835 }); 1836 1837 $this.on('changed.owl.carousel', function(e){ 1838 1839 App.helpers.owlContainerHeight($this); 1840 1841 }); 1842 1843 }); 1844 1845 }; 1846 1847 App.helpers.owlContainerHeight = function(owl, resized) { 1848 1849 if(owl.hasClass('owl-carousel--vadaptive')) return; 1850 1851 setTimeout(function(){ 1852 1853 var max = 0, 1854 items = owl.find('.owl-item'), 1855 activeItems = items.filter('.active').children(); 1856 1857 items.children().css('height', 'auto'); 1858 1859 activeItems.each(function(i, el){ 1860 1861 var $this = $(el), 1862 height = $this.outerHeight(); 1863 1864 if(height > max) max = height; 1865 1866 }); 1867 1868 owl.find('.owl-stage-outer').stop().animate({ 1869 height: max 1870 }, { 1871 duration: 150, 1872 complete: function() { 1873 if(!resized) return; 1874 App.helpers.owlUpdateIsotopeParent($(this)); 1875 } 1876 }); 1877 1878 }, 20); 1879 1880 }; 1881 1882 App.helpers.owlUpdateIsotopeParent = function($owl) { 1883 var $isotope = $owl.closest('.almayer-grid--isotope'); 1884 if($isotope.length) $isotope.isotope('layout'); 1885 }; 1886 1887 App.helpers.owlNav = function(owl) { 1888 1889 setTimeout(function(){ 1890 1891 var settings = owl.data('owl.carousel').settings; 1892 if(settings.autoplay || settings.loop) return; 1893 1894 var prev = owl.find('.owl-prev'), 1895 next = owl.find('.owl-next'); 1896 1897 if(owl.find('.owl-item').first().hasClass('active')) prev.addClass('almayer-disabled'); 1898 else prev.removeClass('almayer-disabled'); 1899 1900 if(owl.find('.owl-item').last().hasClass('active')) next.addClass('almayer-disabled'); 1901 else next.removeClass('almayer-disabled'); 1902 1903 }, 100); 1904 1905 }; 1906 1907 App.helpers.owlSettings = function(settings) { 1908 1909 return $.extend(true, {}, App.baseOwlSettings, settings); 1910 }; 1911 1912 App.helpers.owlSync = { 1913 1914 init: function() { 1915 1916 this.collection = $('.owl-carousel[data-sync]'); 1917 if(!this.collection.length) return; 1918 1919 this.prepare(); 1920 }, 1921 1922 prepare: function(){ 1923 1924 this.collection.each(function(i, el){ 1925 1926 var $this = $(el), 1927 sync = $($this.data('sync')); 1928 1929 sync.on('changed.owl.carousel', function(e){ 1930 1931 var index = e.item.index; 1932 1933 if(!sync.data('afterClicked')) $this.trigger('to.owl.carousel', [index, 350, true]); 1934 1935 sync.data('afterClicked', false); 1936 1937 }); 1938 1939 $this.on('prev.owl.carousel', function(){ 1940 1941 sync.trigger('prev.owl.carousel'); 1942 1943 }); 1944 1945 $this.on('next.owl.carousel', function(){ 1946 1947 sync.trigger('next.owl.carousel'); 1948 1949 }); 1950 1951 $this.on('click.owlSync', '.owl-item', function(e){ 1952 1953 e.preventDefault(); 1954 1955 var index = $(this).index(); 1956 1957 sync.data('afterClicked', true); 1958 1959 sync.trigger('to.owl.carousel', [index, 350, true]); 1960 1961 }); 1962 1963 }); 1964 1965 } 1966 1967 }; 1968 1969 /* ---------------------------------------- 1970 End of Owl Carousel helpers 1971 ---------------------------------------- */ 1972 1973 1974 /* ---------------------------------------- 1975 Touch hover emulator 1976 ---------------------------------------- */ 1977 1978 App.helpers.touchHoverEmulator = function($container, targetSelector, itemSelector) { 1979 if(!App.ISTOUCH || !$.isjQuery($container) || !$container.length) return; 1980 1981 var hoverClass = 'almayer-touch-hover', 1982 preventedClass = 'almayer-event-prevented'; 1983 1984 $container.on('click.touchHoverEmulator', targetSelector, function(event){ 1985 var $link = $(this), 1986 $items, 1987 $targets, 1988 $item = $link.closest(itemSelector); 1989 1990 if($link.get(0).tagName.toUpperCase() != 'A') return; 1991 1992 $items = $container.find(itemSelector); 1993 if($items.not($item).length) $items.not($item).removeClass(hoverClass); 1994 1995 $targets = $container.find(targetSelector); 1996 if($targets.not($link).length) $targets.not($link).removeClass(preventedClass); 1997 1998 if(!$link.hasClass(preventedClass)) { 1999 $link.addClass(preventedClass); 2000 if($item.length) $item.addClass(hoverClass); 2001 2002 event.preventDefault(); 2003 } 2004 }); 2005 }; 2006 2007 /* ---------------------------------------- 2008 End Touch hover emulator 2009 ---------------------------------------- */ 2010 2011 2012 /* ---------------------------------------- 2013 Revolution slider helpers 2014 ---------------------------------------- */ 2015 2016 App.helpers.revArrowsOutside = function() { 2017 if(window.almayerRevArrowsOutsideEvents) return; 2018 2019 $body.on('click.revArrowsOutside', '.almayer-rev-arrows-prev, .almayer-rev-arrows-next', function(event) { 2020 var $button = $(this), 2021 $nav = $button.closest('.almayer-rev-arrows-outside'), 2022 revApi; 2023 2024 2025 if(!$nav.length) return; 2026 2027 revApi = window[$nav.data('rev-api')]; 2028 2029 if(!revApi) return; 2030 2031 revApi[$button.hasClass('almayer-rev-arrows-prev') ? 'revprev' : 'revnext'](); 2032 2033 event.preventDefault(); 2034 }); 2035 2036 window.almayerRevArrowsOutsideEvents = true; 2037 }; 2038 2039 /* ---------------------------------------- 2040 End Revolution slider helpers 2041 ---------------------------------------- */ 2042 2043 /* ---------------------------------------- 2044 gridOwl 2045 ---------------------------------------- */ 2046 2047 App.helpers.gridOwl = { 2048 _commonLayoutConfig: { 2049 'columns-4': { 2050 responsive: { 2051 0: { 2052 items: 1 2053 }, 2054 768: { 2055 items: 2 2056 }, 2057 1200: { 2058 items: 4 2059 } 2060 } 2061 }, 2062 'columns-4-sidebar': { 2063 responsive: { 2064 0: { 2065 items: 1 2066 }, 2067 992: { 2068 items: 2 2069 }, 2070 1200: { 2071 items: 3 2072 } 2073 } 2074 }, 2075 'columns-3': { 2076 responsive: { 2077 0: { 2078 items: 1 2079 }, 2080 768: { 2081 items: 2 2082 }, 2083 1200: { 2084 items: 3 2085 } 2086 } 2087 }, 2088 'columns-3-sidebar': { 2089 responsive: { 2090 0: { 2091 items: 1 2092 }, 2093 992: { 2094 items: 2 2095 }, 2096 1200: { 2097 items: 3 2098 } 2099 } 2100 }, 2101 'columns-2': { 2102 responsive: { 2103 0: { 2104 items: 1 2105 }, 2106 768: { 2107 items: 2 2108 } 2109 } 2110 }, 2111 'columns-2-sidebar': { 2112 responsive: { 2113 0: { 2114 items: 1 2115 }, 2116 992: { 2117 items: 2 2118 } 2119 } 2120 } 2121 }, 2122 _$collection: $(), 2123 _individualConfigs: {} 2124 }; 2125 2126 /** 2127 * Initializes the gridOwl helper 2128 * @param {jQuery} $collection 2129 * 2130 * @returns {jQuery} 2131 */ 2132 App.helpers.gridOwl.init = function($collection) { 2133 var self = this; 2134 2135 $collection = $.isjQuery($collection) ? $collection : $('.almayer-grid.owl-carousel'); 2136 2137 $collection.each(function(index, element){ 2138 var $element = $(element); 2139 2140 if(self._$collection.filter($element).length) return; 2141 2142 self._$collection = self._$collection.add($element); 2143 }); 2144 2145 this.update(); 2146 2147 return $collection; 2148 }; 2149 2150 /** 2151 * Modifies config for the elements with parents that match specified selector. 2152 * @param {String} selector 2153 * @param {Object} config 2154 * 2155 * @returns {Object} 2156 */ 2157 App.helpers.gridOwl.extendConfigFor = function(selector, config) { 2158 this._individualConfigs[selector] = config; 2159 2160 return this; 2161 }; 2162 2163 /** 2164 * Adds new carousel to the collection 2165 * 2166 * @param {jQuery} $carousel
2167 * 2168 * @returns {Object} 2169 */ 2170 App.helpers.gridOwl.add = function($carousel) { 2171 if($.isjQuery($carousel) && !this._$collection.filter($carousel).length) { 2172 this._$collection = this._$collection.add($carousel); 2173 this.update(); 2174 } 2175 2176 return this; 2177 }; 2178 2179 /** 2180 * Initializes not initialized carousels. 2181 * 2182 * @returns {Object} 2183 */ 2184 App.helpers.gridOwl.update = function() { 2185 var self = this; 2186 2187 this._$collection.each(function(index, element){ 2188 var $element = $(element), 2189 config = {}, 2190 columnsCount, 2191 layoutConfigProp; 2192 2193 if($element.data('owl.carousel')) return; 2194 2195 // detect layout settings 2196 columnsCount = self._getColumnsCount($element); 2197 2198 if(columnsCount > 1) { 2199 // check if sidebar 2200 if($element.closest('.almayer-has-sidebar').length) { 2201 layoutConfigProp = 'columns-' + columnsCount + '-sidebar'; 2202 } 2203 else { 2204 layoutConfigProp = 'columns-' + columnsCount; 2205 } 2206 2207 $.extend(config, self._commonLayoutConfig[layoutConfigProp]); 2208 } 2209 2210 for(var selector in self._individualConfigs) { 2211 if($element.closest(selector).length) { 2212 $.extend(config, self._individualConfigs[selector]); 2213 2214 if($element.closest('.almayer-has-sidebar').length) { 2215 config.responsive = config.responsiveWithSidebar; 2216 } 2217 } 2218 } 2219 2220 2221 $element.owlCarousel(App.helpers.owlSettings(config)); 2222 }); 2223 2224 return this; 2225 }; 2226 2227 /** 2228 * Returns amount of columns in the specified element. 2229 * 2230 * @param {jQuery} $element 2231 * @returns {Number} 2232 */ 2233 App.helpers.gridOwl._getColumnsCount = function($element) { 2234 if($element.hasClass('almayer-grid--cols-4')) return 4; 2235 else if($element.hasClass('almayer-grid--cols-3')) return 3; 2236 else if($element.hasClass('almayer-grid--cols-2')) return 2; 2237 2238 return 1; 2239 }; 2240 2241 /* ---------------------------------------- 2242 End of gridOwl 2243 ---------------------------------------- */ 2244 2245 /* ---------------------------------------- 2246 Full Screen Area 2247 ---------------------------------------- */ 2248 2249 App.helpers.fullScreenArea = { 2250 init: function(config){ 2251 2252 var self = this; 2253 2254 this.collection = $('.almayer-fullscreen-area'); 2255 if(!this.collection.length) return; 2256 2257 this.config = config || {}; 2258 this.defPaddingTop = parseInt(this.collection.css('padding-top'), 10); 2259 this.defPaddingBottom = parseInt(this.collection.css('padding-bottom'), 10); 2260 2261 this.w = $(window); 2262 this.$body = $body; 2263 2264 this.run(); 2265 2266 this.w.on('resize.fullscreen', function() { 2267 self.run(); 2268 }); 2269 2270 return this.collection; 2271 2272 }, 2273 2274 reset: function(){ 2275 2276 if(!this.collection) return; 2277 2278 this.run(); 2279 2280 }, 2281 2282 updateDocumentState: function(){ 2283 2284 var self = this; 2285 2286 this.collection.css({ 2287 'padding-top': self.defPaddingTop, 2288 'padding-bottom': self.defPaddingBottom 2289 }); 2290 2291 this.cH = this.collection.outerHeight(); 2292 2293 this.eH = this.config.except && this.config.except.length ? this.getTotalHeightOfExceptedElements() : 0; 2294 this.documentPadding = parseInt(this.$body.css('padding-top'), 10) + parseInt(this.$body.css('padding-bottom'), 10); 2295 2296 this.wH = this.w.height(); 2297 2298 }, 2299 2300 getTotalHeightOfExceptedElements: function() { 2301 return this.config.except.toArray().reduce(function(accumulator, currentValue, index, array){ 2302 return accumulator + $(currentValue).outerHeight(); 2303 }, 0); 2304 }, 2305 2306 run: function(){ 2307 2308 var self = this; 2309 2310 this.updateDocumentState(); 2311 2312 if(this.timeoutId) clearTimeout(this.timeoutId); 2313 2314 this.timeoutId = setTimeout(function(){ 2315 2316 if(self.cH < self.wH){ 2317 2318 var diff = (self.wH - self.cH) / 2; 2319 2320 self.collection.css({
2321 'padding-top': diff + self.defPaddingTop - ((self.eH + self.documentPadding)/2), 2322 'padding-bottom': diff + self.defPaddingBottom - ((self.eH + self.documentPadding)/2) 2323 }); 2324 2325 } 2326 2327 self.collection.addClass('almayer-fullscreen-area--ready'); 2328 2329 }, 100); 2330 2331 } 2332 2333 }; 2334 2335 /* ---------------------------------------- 2336 End of Full Screen Area 2337 ---------------------------------------- */ 2338 2339 /* ---------------------------------------- 2340 owlSyncTabbed 2341 ---------------------------------------- */ 2342 2343 App.helpers.owlSyncTabbed = {}; 2344 App.helpers.owlSyncTabbed.init = function($collection) { 2345 var _self = this, 2346 $w = $(window); 2347 2348 if(!$.isjQuery($collection)) return; 2349 2350 $collection.on('click', '.owl-item', this.changeTab); 2351 $collection.on('translated.owl.carousel', function(event) { 2352 var $this = $(this), 2353 OWL = $this.data('owl.carousel'); 2354 2355 if($.isPlainObject(OWL.options.responsive)) { 2356 for(var screenSize in OWL.options.responsive) { 2357 if(OWL.options.responsive[screenSize]['items'] == 1 && $w.width() < 480) { 2358 $this.find('.owl-item.active').trigger('click'); 2359 } 2360 } 2361 } 2362 2363 }); 2364 2365 this.setCurrentSlideClass($collection); 2366 }; 2367 2368 App.helpers.owlSyncTabbed.changeTab = function(event) { 2369 var $this = $(this), 2370 index = $this.index(), 2371 $carousel = $this.closest('.owl-carousel[data-tabbed-sync]'), 2372 $tabbedContainer; 2373 2374 2375 if($carousel.length) { 2376 $tabbedContainer = $('#' + $carousel.data('tabbed-sync')); 2377 2378 if($tabbedContainer.length && $tabbedContainer.data('TabbedGrid')) { 2379 $tabbedContainer.data('TabbedGrid').show(index); 2380 $this.addClass('almayer-grid--tabbed-active').siblings().removeClass('almayer-grid--tabbed-active'); 2381 } 2382 } 2383 2384 event.preventDefault(); 2385 event.stopPropagation(); 2386 }; 2387 2388 App.helpers.owlSyncTabbed.setCurrentSlideClass = function($collection) { 2389 var self = this; 2390 2391 if(!$collection.length) return $(); 2392 2393 $collection.on('initialized.owl.carousel', function() { 2394 self.setCurrentSlideClassToCarousel($(this)); 2395 }); 2396 2397 return $collection.each(function(index, element) { 2398 self.setCurrentSlideClassToCarousel($(element)); 2399 }); 2400 }; 2401 2402 App.helpers.owlSyncTabbed.setCurrentSlideClassToCarousel = function($element) { 2403 var $tabbedContainer = $('#' + $element.data('tabbed-sync')), 2404 $items, 2405 $currentItem; 2406 2407 if($tabbedContainer.length) { 2408 $items = $element.find('.owl-item'); 2409 2410 if($items.length) { 2411 $tabbedContainer.on('item.shown.tabbedgrid', function(event, $container){ 2412 if($element.data('synced')) return; 2413 2414 $currentItem = $items.eq($container.data('TabbedGrid').getCurrentItemIndex()); 2415 if($currentItem.length) $currentItem.addClass('almayer-grid--tabbed-active'); 2416 2417 $element.data('synced', true); 2418 }); 2419 } 2420 } 2421 }; 2422 2423 /* ---------------------------------------- 2424 End of owlSyncTabbed 2425 ---------------------------------------- */ 2426 2427 /* ---------------------------------------- 2428 Google Maps 2429 ---------------------------------------- */ 2430 2431 App.modules.GoogleMaps = { 2432 config: { 2433 map_options: { 2434 zoom: 16, 2435 scrollwheel: false 2436 }, 2437 locations: [ 2438 { 2439 lat: 40.7707307, 2440 lon: -74.0210859, 2441 icon: 'images/marker.png', 2442 title: 'Main office' 2443 } 2444 ], 2445 generate_controls: false, 2446 controls_on_map: false, 2447 view_all: false 2448 2449 }, 2450 2451 init: function(config){ 2452 2453 var self = this; 2454 2455 this.collection = $('.almayer-gmap'); 2456 if(!this.collection.length) return; 2457 2458 this.MapPlaceCollection = []; 2459 2460 if(config) $.extend(this.config, config); 2461 2462 this.collection.each(function(i, el){ 2463 2464 var $this = $(el), 2465 options = {}; 2466 2467 if($this.data('locations')) options.locations = $this.data('locations'); 2468 if($this.data('height')) $this.css('height', $this.data('height')); 2469 2470 options.map_div = '#' + $this.attr('id'); 2471 2472 self.MapPlaceCollection.push(new Maplace($.extend({}, self.config, options)).Load()); 2473 2474 }); 2475 2476 this.bindEvents(); 2477 2478 }, 2479 2480 bindEvents: function(){ 2481 2482 var self = this; 2483 2484 $(window).on('resize.map', function(){ 2485 2486 if(self.mapTimeoutId) clearTimeout(self.mapTimeoutId); 2487 2488 self.mapTimeoutId = setTimeout(function(){ 2489 2490 self.MapPlaceCollection.forEach(function(elem, index, arr){ 2491 elem.Load(); 2492 }); 2493 2494 }, 100); 2495 2496 }); 2497 2498 } 2499 2500 } 2501 2502 /* ---------------------------------------- 2503 End of Google Maps 2504 ---------------------------------------- */ 2505 2506 $.extend({ 2507 isjQuery: function(element, elementExists) { 2508 if(element === undefined || element === null) return false;
2509 2510 if(elementExists === undefined) { 2511 return element instanceof jQuery; 2512 } 2513 else { 2514 return $.isjQuery(element) && element.length; 2515 } 2516 } 2517 }); 2518 2519 $.fn.extend({ 2520 jQueryImagesLoaded : function () { 2521 var $imgs = this.find('img[src!=""]'); 2522 2523 if (!$imgs.length) {return $.Deferred().resolve().promise();} 2524 2525 var dfds = []; 2526 2527 $imgs.each(function(){ 2528 var dfd = $.Deferred(); 2529 dfds.push(dfd); 2530 var img = new Image(); 2531 img.onload = function(){dfd.resolve();}; 2532 img.onerror = function(){dfd.resolve();}; 2533 img.src = this.src; 2534 }); 2535 2536 return $.when.apply($,dfds); 2537 } 2538 }); 2539 2540 $doc.on('beforeClose', function(event) { 2541 if($(event.target).hasClass('almayer-modal')) { 2542 event.stopImmediatePropagation(); 2543 } 2544 }); 2545 2546 $doc.ready(function() { 2547 App.afterDOMReady(); 2548 }); 2549 $(window).on('load', function() { 2550 2551 DOMDfd.done(function() { 2552 App.afterOuterResourcesLoaded(); 2553 }); 2554 }); 2555 2556 return App; 2557 2558})(window.jQuery); 2559 2560 2561 2562/*-----------------------------------------------------------------------------------*/ 2563/* Cookies 2564/*-----------------------------------------------------------------------------------*/ 2565 if($('#cookies').length){ 2566 $('#cookies button').on('click', function(){ 2567 $.cookie('cookies_enabled', '1', {expires: 7}); 2568 $('#cookies').fadeOut(); 2569 }); 2570 } 2571 2572 /* ================================================================= 2573 * SHARRRE 2574 * ================================================================= 2575 */ 2576 var sharrre_media = ""; 2577 var sharrre_descr = ""; 2578 if($('meta[itemprop="image"]').length) 2579 sharrre_media = $('meta[itemprop="image"]').attr('content'); 2580 if($('meta[name="description"]').length) 2581 sharrre_descr = $('meta[name="description"]').attr('content'); 2582 2583 if($('#twitter').length){ 2584 $('#twitter').sharrre({ 2585 share: { 2586 twitter: true 2587 }, 2588 template: '<a class="count" href="#">{total}</a><a class="share">Tweet</a>', 2589 enableHover: false, 2590 enableTracking: false, 2591 enableCounter: false, 2592 buttons: { twitter: {}}, 2593 click: function(api, options){ 2594 api.simulateClick(); 2595 api.openPopup('twitter'); 2596 } 2597 }); 2598 } 2599 if($('#facebook').length){ 2600 $('#facebook').sharrre({ 2601 share: { 2602 facebook: true 2603 }, 2604 template: '<a class="count" href="#">{total}</a><a class="share">Share</a>', 2605 enableHover: false, 2606 enableTracking: false, 2607 enableCounter: false, 2608 buttons: { facebook: {}}, 2609 click: function(api, options){ 2610 api.simulateClick(); 2611 api.openPopup('facebook'); 2612 } 2613 }); 2614 } 2615 if($('#pinterest').length){ 2616 $('#pinterest').sharrre({ 2617 share: { 2618 pinterest: true 2619 }, 2620 template: '<a class="count" href="#">{total}</a><a class="share">Pin it</a>', 2621 enableHover: false, 2622 enableTracking: true, 2623 enableCounter: false, 2624 buttons: { 2625 pinterest: { 2626 media: sharrre_media, 2627 description: sharrre_descr, 2628 layout: 'vertical' 2629 } 2630 }, 2631 click: function(api, options){ 2632 api.simulateClick(); 2633 api.openPopup('pinterest'); 2634 } 2635 }); 2636 } 2637 if($('#googleplus').length){ 2638 $('#googleplus').sharrre({ 2639 share: { 2640 googlePlus: true 2641 }, 2642 template: '<a class="count" href="#">{total}</a><a class="share">+1</a>', 2643 enableHover: false, 2644 enableTracking: true, 2645 enableCounter: false, 2646 buttons: { googlePlus: {}}, 2647 urlCurl: $('#googleplus').attr('data-curl'), 2648 click: function(api, options){ 2649 api.simulateClick(); 2650 api.openPopup('googlePlus'); 2651 } 2652 }); 2653 }
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.