// source --> https://www.dreamweaverpillow.com/wp-content/plugins/themefyre-builder/js/front-end.js?ver=0.0.3 // Ensure availability of the global themefyreBuilder object window.themefyreBuilder = window.themefyreBuilder || {}; ;(function($, _) { "use strict"; // ====================================================== // // General utility functions // // ====================================================== // HTML5 Video backgrounds are disabled on nearly all modile devices & browsers themefyreBuilder.isMobile = function() { if ( 'undefined' === typeof navigator || 'undefined' === typeof navigator.userAgent ) { return false; } return navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/); }; // Simple check to determine if we`re in RTL mode themefyreBuilder.isRtl = function() { return 'rt' === $('html').attr('dir'); }; // Convert provided value to bool format themefyreBuilder.getBool = function( input ) { return 'boolean' === typeof input ? input : 'true' === input; }; // Custom setTimeout method which allows pause/resume functionality themefyreBuilder.setTimeout = function( callback, delay ) { var timerId, start, remaining = delay; this.pause = function() { window.clearTimeout(timerId); remaining -= new Date() - start; }; this.resume = function() { start = new Date(); window.clearTimeout(timerId); timerId = window.setTimeout(callback, remaining); }; this.end = function() { window.clearTimeout(timerId); }; this.resume(); }; // ====================================================== // // Some mobile devices do not support fixed background images // // As a result all fixed background images are disabled on mobile devices // hopefully this can be removed in future versions of this plugin. // // ====================================================== $(document).ready( function() { if ( themefyreBuilder.isMobile() ) { $('body').addClass('builder-disabled-fixed-backgrounds'); } }); // ====================================================== // // Make sure the .JS class is applied to the body // // This line of script should be placed in the header file // of the theme immediately following the opening `body` tag. // // Example: // //
> // // // ====================================================== $(document).ready( function() { document.body.className = document.body.className.replace('no-js','js'); }); // ====================================================== // // Initially set up the page // // Can be called after content is loaded dynamically via AJAX // to set up any newly added content. // // ====================================================== // Invokes all functions for setting up the document themefyreBuilder.setupDocument = function() { themefyreBuilder.classifyFullWidthModules(); themefyreBuilder.addShortcodes(); themefyreBuilder.addSmoothScroll(); themefyreBuilder.addMasonry(); themefyreBuilder.addCarousels(); themefyreBuilder.addSliders(); themefyreBuilder.addHTML5VideoBackgrounds(); themefyreBuilder.addFitVids(); themefyreBuilder.addLightbox(); themefyreBuilder.addAnimatedEntrances(); themefyreBuilder.addParallaxScrolling(); }; // Called once upon page load $(document).ready( function() { themefyreBuilder.setupDocument(); // Once all images in the page have loaded we call our initialization // function once again just to be sure all of our parallax scrolling // and animated entrance modules were set up correctly. $('body').imagesLoaded( themefyreBuilder.setupDocument ); }); // ====================================================== // // Applies identification classes to each full width module // // ====================================================== // Applies identification classes to each full width module // in order to classify them by their order and visibility themefyreBuilder.classifyFullWidthModules = function() { $('.builder-container').each( function() { var $modules = $('.builder-full-width-element', $(this) ).removeClass('builder-full-width-element-first builder-full-width-element-last').removeAttr('data-element-index').filter(':visible'), total = $modules.length; $modules.each( function( index ) { // Add 1 to the index for simpification index++; // General index identification $(this).attr('data-element-index', index); // Identify the first visible full width module if ( 1 === index ) { $(this).addClass('builder-full-width-element-first'); } // Identify the last visible full width module if ( total === index ) { $(this).addClass('builder-full-width-element-last'); } }); }); }; // Needs to be called whenever the screen is resized to account for // variances in device visibility applied to full width modules $(document).ready( function() { $(window).resize( themefyreBuilder.classifyFullWidthModules ); }); // ====================================================== // // Initially set up all shortcode plugins // // ====================================================== // Instantiate all included jQuery shortcode plugins themefyreBuilder.addShortcodes = function() { $('.builder-toggle-group').themefyreBuilderToggleGroup(); $('.builder-tab-group').themefyreBuilderTabGroup(); $('.builder-promo-box').themefyreBuilderPromoBox(); $('.builder-google-map').themefyreBuilderGoogleMap(); $('.builder-full-width-slider').themefyreBuilderFullWidthSlider(); }; // ====================================================== // // Smooth Scroll Links // // ====================================================== themefyreBuilder.addSmoothScroll = function() { return $('.builder-container a[href*="#"]:not([href="#"]):not(.builder-disable-smooth-scroll)').each( function() { if ( location.pathname.replace(/^\//,'') !== this.pathname.replace(/^\//,'')|| location.hostname !== this.hostname) { return; } if ( ! $.data( this, 'smoothScroll' ) ) { $.data( this, 'smoothScroll', new themefyreBuilder.smoothScroll( this ) ); } }); }; themefyreBuilder.smoothScroll = function( element ) { $(element).click( function( event ) { var $target = $(element.hash); if ( $target.length ) { $('html,body').animate({ scrollTop: $target.offset().top-themefyreBuilder.scrollTopOffset+1, }, 1250, function() { window.location.hash = element.hash; }); return false; } }); }; // ====================================================== // // Masonry Galleries // // ====================================================== themefyreBuilder.addMasonry = function() { return $('.builder-masonry').each( function() { if ( ! $.data( this, 'builderMasonry' ) ) { $.data( this, 'builderMasonry', new themefyreBuilder.builderMasonry( this ) ); } }); }; themefyreBuilder.builderMasonry = function( element ) { $(element).imagesLoaded( function() { self.masonry = new Masonry( element, { isOriginLeft: ! themefyreBuilder.isRtl(), transitionDuration: 0, }); }); }; // ====================================================== // // Initially set up all Carousel elements // // ====================================================== // Instantiate all HTML5 Video Backgrounds themefyreBuilder.addCarousels = function() { return $('.builder-carousel').each( function() { if ( ! $.data( this, 'builderCarousel' ) ) { $.data( this, 'builderCarousel', new themefyreBuilder.builderCarousel( this ) ); } }); }; themefyreBuilder.builderCarousel = function( element ) { this.$element = $(element); this.element = element; this.init(); }; _.extend( themefyreBuilder.builderCarousel.prototype, { init: function() { var slidesToShow = this.$element.attr('data-carousel-columns') ? parseInt( this.$element.attr('data-carousel-columns') ) : 4, slidesToScroll = this.$element.attr('data-carousel-scroll-number') ? parseInt( this.$element.attr('data-carousel-scroll-number') ) : slidesToShow, interval = this.$element.attr('data-interval') ? parseInt( this.$element.attr('data-interval').replace(/[^0-9]/, '') ) : false, pauseOnHover = interval && 'true' === this.$element.attr('data-hoverpause'), pager = 'true' === this.$element.attr('data-carousel-pager'); var args = { slidesToShow: slidesToShow, slidesToScroll: slidesToScroll, arrows: false, dots: pager, infinite: true, rtl: themefyreBuilder.isRtl(), adaptiveHeight: true, }; // If auto play is enabled if ( interval ) { args.autoplay = true; args.autoplaySpeed = interval; args.pauseOnHover = pauseOnHover; } // Enable responsive mode switch ( slidesToShow ) { case 6: case 5: args.responsive = [ { breakpoint: 992, settings: { slidesToShow: 3, slidesToScroll: 3, } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } }, ]; break; case 4: case 3: args.responsive = [ { breakpoint: 992, settings: { slidesToShow: 2, slidesToScroll: 2, } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } }, ]; break; case 2: args.responsive = [ { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } }, ]; break; } // Activate Slick jQuery plugin this.$element.slick( args ); // Tell the CSS that the plugin has loaded this.$element.addClass('js-plugin-loaded'); } }); // ====================================================== // // Initially set up all Slider elements // // ====================================================== // Instantiate all HTML5 Video Backgrounds themefyreBuilder.addSliders = function() { return $('.builder-slider').each( function() { if ( ! $.data( this, 'builderSlider' ) ) { $.data( this, 'builderSlider', new themefyreBuilder.builderSlider( this ) ); } }); }; themefyreBuilder.builderSlider = function( element ) { this.$element = $(element); this.element = element; this.init(); }; _.extend( themefyreBuilder.builderSlider.prototype, { init: function() { var interval = this.$element.attr('data-interval') ? parseInt( this.$element.attr('data-interval').replace(/[^0-9]/, '') ) : false, pauseOnHover = interval && 'true' === this.$element.attr('data-hoverpause'), transition = this.$element.attr('data-transition') ? this.$element.attr('data-transition') : 'slide', arrows = -1 !== _.indexOf( ['both', 'direction'], this.$element.attr('data-controls') ), dots = -1 !== _.indexOf( ['both', 'pager'], this.$element.attr('data-controls') ); var args = { arrows: arrows, dots: dots, infinite: true, rtl: themefyreBuilder.isRtl(), adaptiveHeight: true, }; // If auto play is enabled if ( interval ) { args.autoplay = true; args.autoplaySpeed = interval; args.pauseOnHover = pauseOnHover; } // Enable fade mode if ( 'fade' === transition ) { args.fade = true; args.cssEase = 'linear'; } if ( true ) { args.prevArrow = ''; args.nextArrow = ''; } // Activate Slick jQuery plugin this.$element.slick( args ); // Tell the CSS that the plugin has loaded this.$element.addClass('js-plugin-loaded'); } }); // ====================================================== // // Initially set up all HTML5 Video Backgrounds // // ====================================================== // Instantiate all HTML5 Video Backgrounds themefyreBuilder.addHTML5VideoBackgrounds = function() { // Make sure HTML5 video backgrounds are enabled for the current device if ( themefyreBuilder.isMobile() ) { $('body').addClass('builder-html5-video-backgrounds-disabled'); $('.builder-html5-video-bg').remove(); return; } // Set up each video background return $('.builder-html5-video-bg').each( function() { if ( ! $.data( this, 'HTML5VideoBackground' ) ) { $.data( this, 'HTML5VideoBackground', new themefyreBuilder.HTML5VideoBackground( this ) ); } }); }; themefyreBuilder.HTML5VideoBackground = function( player ) { this.$player = $(player); this.player = player; this.$container = this.$player.parent(); this.init(); }; _.extend( themefyreBuilder.HTML5VideoBackground.prototype, { init: function() { if ( this.player.readyState >= this.player.HAVE_FUTURE_DATA ) { this.playerLoaded(); } else { this.$player.on( 'canplay', _.once( $.proxy(this.playerLoaded, this) ) ); } }, playerLoaded: function() { // Apply the ready class to thie video player this.$player.addClass('is-ready'); // Initially set the size of the player this.setWidth(); // Resize the player whenever the window is resized $(window).resize( $.proxy(this.setWidth, this) ); this.player.play(); }, setWidth: function() { // Remove any styles to ensure the natural proportions are retained this.$player.removeAttr('style'); // Set up some variables for determining the video size var boxWidth = this.$container.outerWidth(), boxHeight = this.$container.outerHeight(), playerWidth = this.$player.width(), playerHeight = this.$player.height(); // Calculate new height and width var initW = playerWidth; var initH = playerHeight; var ratio = initH / initW; playerWidth = boxWidth; playerHeight = boxWidth * ratio; if ( playerHeight < boxHeight ) { playerHeight = boxHeight; playerWidth = playerHeight / ratio; } this.$player.css({ width: playerWidth+'px', height: playerHeight+'px', marginLeft: -(playerWidth/2)+'px', marginTop: -(playerHeight/2)+'px', }); }, }); // ====================================================== // // Set Up embedded videos with FitVids // // ====================================================== themefyreBuilder.addFitVids = function() { $('.builder-container').fitVids(); }; // ====================================================== // // Set Up Lightboxes using Magnific Popup // // ====================================================== themefyreBuilder.lightboxInstances = 0; // Instantiate all elements utilizing lightbox functionality themefyreBuilder.addLightbox = function() { $('.builder-lightbox-image, .builder-lightbox-iframe, .builder-lightbox-gallery, [data-builder-lightbox-role="image"], [data-builder-lightbox-role="iframe"], [data-builder-lightbox-role="gallery"]').each( function() { if ( $.data( this, 'lightbox' ) ) { return; } $.data( this, 'lightbox', true ); themefyreBuilder.lightboxInstances++; var role; var $this = $(this); // Role provided via class if ( $this.hasClass('builder-lightbox-image') ) { role = 'image'; } if ( $this.hasClass('builder-lightbox-iframe') ) { role = 'iframe'; } if ( $this.hasClass('builder-lightbox-gallery') ) { role = 'gallery'; } // Role provided via HTML data attribute if ( $this.data('builder-lightbox-role') ) { role = $this.data('builder-lightbox-role'); } var args = { key: 'builder-lightbox-'+themefyreBuilder.lightboxInstances, midClick: true, closeBtnInside: true, fixedContentPos: false, removalDelay: 250, mainClass: 'mfp-zoom-in', callbacks: { open: function() { $.magnificPopup.instance.next = function() { var self = this; self.wrap.removeClass('mfp-image-loaded'); setTimeout( function() { $.magnificPopup.proto.next.call( self ); }, 250 ); }; $.magnificPopup.instance.prev = function() { var self = this; self.wrap.removeClass('mfp-image-loaded'); setTimeout( function() { $.magnificPopup.proto.prev.call( self ); }, 250 ); }; }, imageLoadComplete: function() { var self = this; setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 5); }, }, }; switch ( role ) { case 'image': $this.magnificPopup( _.extend( args, { type: 'image', closeOnContentClick: true, image: { titleSrc: 'data-builder-lightbox-caption', }, })); break; case 'iframe': $this.magnificPopup( _.extend( args, { type: 'iframe', })); break; case 'gallery': $this.magnificPopup( _.extend( args, { delegate: '[data-builder-lightbox-role="gallery-item"], .builder-lightbox-gallery-item', gallery: { enabled: true, tCounter: '%curr% / %total%', }, image: { titleSrc: 'data-builder-lightbox-caption', }, type: 'image', })); break; } }); }; // ====================================================== // // Set Up Animated Entrances using Waypoints // // ====================================================== $(document).on('animatedentrance', '[data-entrance]', function() { var $this = $(this), entrance = $this.attr('data-entrance'), delay = $this.attr('data-entrance-delay') ? parseInt( $this.attr('data-entrance-delay') ) : 0; if ( 'chained' === entrance ) { entrance = $this.closest('[data-entrance-trigger]').attr('data-entrance-trigger'); } // if ( themefyreBuilder.isMobile() ) { // delay = 0; // Disable delays on mobile devices // } setTimeout( function() { $this.imagesLoaded( function() { $this.addClass(entrance); }); }, delay+150 ); }); // Instantiate all elements utilizing animated entrances themefyreBuilder.addAnimatedEntrances = function() { $('[data-entrance]').not('[data-entrance="chained"]').each( function() { if ( $.data( this, 'animatedentrance' ) ) { return; } $.data( this, 'animatedentrance', true ); var $this = $(this); $this.waypoint( function() { $this.trigger('animatedentrance'); }, { offset: '100%' }); }); $('[data-entrance-trigger]').each( function() { if ( $.data( this, 'animatedentrancetrigger' ) ) { return; } $.data( this, 'animatedentrancetrigger', true ); var $this = $(this); $this.waypoint( function() { $('[data-entrance="chained"]', $this).trigger('animatedentrance'); }, { offset: '100%' }); }); }; // ====================================================== // // Set Up Parallax Scrolling // // ====================================================== // Refresh & update our parallax elements when page is scrolled/resized $(document).ready( function() { $(window).resize( themefyreBuilder.addParallaxScrolling ); $(window).resize( themefyreBuilder.scrollParallaxElements ); $(window).scroll( themefyreBuilder.scrollParallaxElements ); }); // Some variables specific to parallax scrolling that we will use later themefyreBuilder.parallaxElements = []; themefyreBuilder.lastScrollY = 0; themefyreBuilder.loadingPaintParallaxElements = false; // Instantiate all elements utilizing parallax scrolling // // Indexes each element that has parallax scrolling enabled themefyreBuilder.addParallaxScrolling = function() { themefyreBuilder.parallaxElements = []; // Do not continue if we`re on a `mobile` device if ( themefyreBuilder.isMobile() ) { return; } $('.builder-parallax-viewport [data-parallax]').each( function() { var $this = $(this), $viewport = $this.closest('.builder-parallax-viewport'); var config = { $element: $this, height: $viewport.outerHeight(), offsetTop: $viewport.offset().top, offsetBottom: $viewport.outerHeight() + $viewport.offset().top, mode: $this.data('parallax'), }; // Account for theme defined scrolltop offset if ( config.offsetTop > themefyreBuilder.scrollTopOffset ) { config.offsetTop -= themefyreBuilder.scrollTopOffset; } // Account for the height of the admin area when applicable if ( $('body').hasClass('admin-bar') && document.getElementById('wpadminbar') ) { config.offsetTop -= $('#wpadminbar').outerHeight(); } themefyreBuilder.parallaxElements.push( config ); // Repaint all parallax elements upon reset themefyreBuilder.paintParallaxElements(); }); }; // Indexes each element that has parallax scrolling enabled themefyreBuilder.scrollParallaxElements = function() { if ( ! themefyreBuilder.loadingPaintParallaxElements ) { requestAnimationFrame( themefyreBuilder.paintParallaxElements ); themefyreBuilder.lastScrollY = window.pageYOffset; themefyreBuilder.loadingPaintParallaxElements = true; } }; // Used to reposition/restyle all parallax enable elements themefyreBuilder.paintParallaxElements = function() { _.each( themefyreBuilder.parallaxElements, function( element ) { if ( themefyreBuilder.lastScrollY > element.offsetTop && themefyreBuilder.lastScrollY < element.offsetBottom ) { var translate = (themefyreBuilder.lastScrollY-element.offsetTop)/3, fade = 1-(((themefyreBuilder.lastScrollY-element.offsetTop)/element.height)*2), scale = 1-(((themefyreBuilder.lastScrollY-element.offsetTop)/element.height)/3); switch ( element.mode ) { case 'translate': element.$element.css('transform', 'translateY('+translate+'px)'); break; case 'fade': element.$element.css('opacity', fade); break; case 'scale': element.$element.css('transform', 'scale('+scale+')'); break; case 'translate-fade': element.$element.css({ transform: 'translateY('+translate+'px)', opacity: fade, }); break; case 'fade-scale': element.$element.css({ transform: 'scale('+scale+')', opacity: fade, }); break; case 'translate-scale': element.$element.css({ transform: 'translateY('+translate+'px) scale('+scale+')', }); break; case 'translate-fade-scale': element.$element.css({ transform: 'translateY('+translate+'px) scale('+scale+')', opacity: fade, }); break; } } else { switch ( element.mode ) { case 'translate': case 'scale': case 'translate-scale': element.$element.css('transform', 'none'); break; case 'fade': element.$element.css('opacity', 1); break; case 'translate-fade': case 'fade-scale': case 'translate-fade-scale': element.$element.css({ transform: 'none', opacity: 1, }); break; } } }); themefyreBuilder.loadingPaintParallaxElements = false; }; // ====================================================== // // `Super Links` will extend their click event to the first child anchor found // // ====================================================== $(document).on('click', '.builder-superlink', function(event) { // Make sure we`re not clicking on an actual link, or the child of one if ( 'a' === event.target.nodeName.toLowerCase() || $(event.target).parents('a').length ) { return; } // Make sure there is a link to `click` var $links = $('a', $(this)); if ( ! $links.length ) { return; } // [0] gets the JavaScript object to make use of the native // click method, which simulates an authentic click event. $links.first()[0].click(); }); // ====================================================== // // Toogle Group // // ====================================================== $.fn.themefyreBuilderToggleGroup = function( options ) { return this.each( function() { if ( ! $.data( this, 'toggleGroup' ) ) { var defaults = { firstOpen: themefyreBuilder.getBool( this.getAttribute('data-first-open') ), allowMulti: themefyreBuilder.getBool( this.getAttribute('data-allow-multi') ), }; var args = _.extend( defaults, options ); $.data( this, 'toggleGroup', new themefyreBuilder.toggleGroup( this, args ) ); } }); }; themefyreBuilder.toggleGroup = function( element, args ) { this.element = element; this.$element = $(element); this.config = args; this.init(); }; _.extend( themefyreBuilder.toggleGroup.prototype, { init: function() { this.$toggles = $('.builder-toggle', this.$element); // Attach all relevant events this.attachEvents(); // Check if first toggle is open on load if ( this.config.firstOpen ) { this.openToggle( this.$toggles.first() ); } }, attachEvents: function() { var self = this; if ( $('.builder-toggle-group-filter-list', self.$element).length ) { $('.builder-toggle-group-filter-list', self.$element).on( 'click', '[data-filter]', function(event) { event.preventDefault(); var $this = $(this), filter = $this.attr('data-filter'); if ( ! $this.parent().hasClass('is-active') ) { $this.parent().addClass('is-active').siblings().removeClass('is-active'); self.filterToggles( filter ); } }); } self.$element.on( 'click', '.builder-toggle-handle', function() { var $toggle = $(this).closest('.builder-toggle'); // Make sure the toggle is active if ( $toggle.hasClass('is-disabled') ) { return; } // Determine what to do if ( $toggle.hasClass('is-open') ) { self.closeToggle( $toggle ); } else { self.openToggle( $toggle ); } }); }, openToggle: function( $toggle ) { $toggle.addClass('is-open'); var $content = $toggle.children('.builder-toggle-content'); $content.css('height', $content.children('div').outerHeight() ); if ( ! this.config.allowMulti ) { this.closeToggle( $toggle.siblings() ); } }, closeToggle: function( $toggle ) { $toggle.removeClass('is-open').children('.builder-toggle-content').removeAttr('style'); }, filterToggles: function( filter ) { var self = this; // Close all toggles self.closeToggle( self.$toggles ); // Filter the toggles setTimeout( function() { self.$toggles.each( function() { var $toggle = $(this), tags = $toggle.data('tags'), visible = '*' === filter; if ( ! visible && tags ) { _.each( tags.split(','), function(tag) { if ( filter === tag ) { visible = true; } }); } if ( visible ) { $toggle.removeClass('is-disabled'); $('.builder-toggle-title a', $toggle).removeAttr('aria-disabled'); } else { $toggle.addClass('is-disabled'); $('.builder-toggle-title a', $toggle).attr('aria-disabled', ''); } }); }, 250 ); }, }); // ====================================================== // // Tab Group // // ====================================================== $.fn.themefyreBuilderTabGroup = function() { return this.each( function() { if ( ! $.data( this, 'tabGroup' ) ) { $.data( this, 'tabGroup', new themefyreBuilder.tabGroup( this ) ); } }); }; themefyreBuilder.tabGroup = function( element ) { this.element = element; this.$element = $(element); this.$tabs = $('.builder-tab-group-tab', this.$element); this.$panes = $('.builder-tab-group-pane', this.$element); this.init(); }; _.extend( themefyreBuilder.tabGroup.prototype, { init: function() { var self = this; this.$tabs.on( 'click', 'a', function(event) { event.preventDefault(); var $tab = $(this).closest('.builder-tab-group-tab'), index = $tab.index(); if ( ! $tab.hasClass('is-active') ) { self.changeTab( index ); } }); this.$panes.on( 'click', '.builder-tab-group-pane-title', function() { var $pane = $(this).closest('.builder-tab-group-pane'), index = $pane.index(); if ( ! $pane.hasClass('is-active') ) { self.changeTab( index ); } }); }, changeTab: function( index ) { this.$tabs.removeClass('is-active').eq(index).addClass('is-active'); this.$panes.removeClass('is-active').eq(index).addClass('is-active'); }, }); // ====================================================== // // Promo Boxes // // ====================================================== $.fn.themefyreBuilderPromoBox = function() { return this.each( function() { if ( ! $.data( this, 'promoBox' ) ) { $.data( this, 'promoBox', new themefyreBuilder.promoBox( this ) ); } }); }; themefyreBuilder.promoBox = function( element ) { this.element = element; this.$element = $(element); this.$content = $( '.builder-promo-box-content', $(element) ); this.init(); }; _.extend( themefyreBuilder.promoBox.prototype, { init: function() { // When the content changes size we need to recenter it this.$content.resize( $.proxy( this.center, this ) ); this.center(); // When the promo box changes size we need to scale the content this.$element.resize( $.proxy( this.scale, this ) ); this.scale(); // Set the content opacity to 1 this.$content.css('opacity', '1'); }, center: function() { this.$content.css({ marginLeft: -(this.$content.outerWidth()/2), marginTop: -(this.$content.outerHeight()/2), }); }, scale: function() { var currentWidth = this.$element.outerWidth(), contentWidth = this.$content.outerWidth(); // Scaler has enough room, we`re good if ( currentWidth >= contentWidth ) { this.$content.css('transform', 'none'); } else { this.$content.css('transform', 'scale('+( currentWidth / contentWidth )+')'); } }, }); // ====================================================== // // Google Maps Integration // // ====================================================== $.fn.themefyreBuilderGoogleMap = function() { return this.each( function() { if ( ! $.data( this, 'googleMap' ) ) { $.data( this, 'googleMap', new themefyreBuilder.googleMap( this ) ); } }); }; themefyreBuilder.googleMap = function( element ) { this.element = element; this.$element = $(element); this.init(); }; _.extend( themefyreBuilder.googleMap.prototype, { init: function() { var self = this; // Stor the Google API Geocoder this.geocoder = new google.maps.Geocoder(); // Store all of the map marker placeholders this.$markers = $('.builder-google-map-marker', this.$element); this.markerCount = this.$markers.length; // Will hold the configuration for each marker this.mapID = this.$element.attr('id'); this.$mapViewport = $('#'+this.mapID+'-viewport'); // Will hold the configuration for each marker this.markersConfig = []; // Will contain the markers and their informational windows this.markers = []; this.markerWindows = []; // Prepare the provided markers for the map this.prepareMarkers(); }, prepareMarkers: function() { // Used to check when we`ve iterated through each marker var self = this, numMarkers = this.markerCount, $marker = []; // Iterate through each marker and get the lat/lng coordinates // then add the marker to the map this.$markers.each( function( index ) { $marker.push( $(this) ); // Convert the address to usable coordinates, if possible self.geocoder.geocode( {'address': $marker[index].attr('data-address')}, function(results, status) { // As long as the address is valid, we add the marker to our configuration if ( status === google.maps.GeocoderStatus.OK ) { self.markersConfig.push({ content: $marker[index].html(), maxWidth: $marker[index].attr('data-max-width'), visibility: $marker[index].attr('data-visibility'), coordinates: [results[0].geometry.location.lat(), results[0].geometry.location.lng()] }); } // Workaround to wait for all addresses to be converted if ( ! --numMarkers && self.markersConfig.length ) { self.initMap(); } }); }); }, initMap: function() { var self = this, map, styledMap, options, styleOptions; // Basic options options = { scrollwheel: false, disableDefaultUI: true, center: this.getCenter(), zoom: parseInt( this.$mapViewport.attr('data-zoom-level') ), draggable: 'true' === this.$mapViewport.attr('data-draggable'), zoomControl: 'true' === this.$mapViewport.attr('data-zoom-control'), }; // Create the map with custom styles if ( this.$mapViewport.attr('data-hue') && this.$mapViewport.attr('data-water-color') ) { styleOptions = [ { stylers: [ { hue: this.$mapViewport.attr('data-hue') }, { gamma: 0.5 }, { weight: 0.5 }, ] }, { featureType: 'water', stylers: [ { color: this.$mapViewport.attr('data-water-color') } ] } ]; // Create the map with custom styles options.mapTypeId = this.mapID; map = new google.maps.Map( document.getElementById(this.mapID+'-viewport'), options ); styledMap = new google.maps.StyledMapType( styleOptions, { name: this.mapID } ); map.mapTypes.set( this.mapID, styledMap ); } // Create the map with default styles else { map = new google.maps.Map( document.getElementById(this.mapID+'-viewport'), options ); } // This is where we add all of the markers _.each( this.markersConfig, function(value, index) { // Initially create the marker self.markers[index] = new google.maps.Marker({ position: new google.maps.LatLng(value.coordinates[0], value.coordinates[1]), map: map, }); // Check if the marker window has been enabled if ( 'hidden' !== value.visibility && value.content ) { // Create the marker window self.markerWindows[index] = new google.maps.InfoWindow({ content: value.content, maxWidth: value.maxWidth, }); // Toggle marker window on marker click google.maps.event.addListener( self.markers[index], 'click', function() { self.markerWindows[index].open( map, self.markers[index] ); }); // If marker is visible on map load if ( 'load' === value.visibility ) { self.markerWindows[index].open( map, self.markers[index] ); } } }); }, getCenter: function() { var centerLat, centerLng, allLats = [], allLngs = []; // Only 1 marker, use this for center if ( 1 === this.markersConfig.length ) { centerLat = this.markersConfig[0].coordinates[0]; centerLng = this.markersConfig[0].coordinates[1]; } // Multiple markers, calculate the center else { _.each( this.markersConfig, function(value) { allLats.push(value.coordinates[0]); allLngs.push(value.coordinates[1]); }); centerLat = (Math.max.apply(null, allLats) + Math.min.apply(null, allLats)) /2; centerLng = (Math.max.apply(null, allLngs) + Math.min.apply(null, allLngs)) /2; } return new google.maps.LatLng(centerLat, centerLng); }, }); // ====================================================== // // Full Width Sliders // // ====================================================== $.fn.themefyreBuilderFullWidthSlider = function() { return this.each( function() { if ( ! $.data( this, 'slider' ) ) { $.data( this, 'slider', new themefyreBuilder.fullWidthSlider( this ) ); } }); }; themefyreBuilder.fullWidthSlider = function( element ) { this.element = element; this.$element = $(element); this.init(); }; _.extend( themefyreBuilder.fullWidthSlider.prototype, { init: function() { // The interval between automatic slide transitions this.interval = this.$element.attr('data-interval') ? parseInt( this.$element.attr('data-interval').replace(/[^0-9]/, '') ) : false; this.hoverPause = ( this.interval ) && 'true' === this.$element.attr('data-hoverpause'); this.mouseOver = false; // Which controls (if any) have been enabled this.directionControl = -1 !== _.indexOf( ['both', 'direction'], this.$element.attr('data-controls') ); this.pagerControl = -1 !== _.indexOf( ['both', 'pager'], this.$element.attr('data-controls') ); // Will store the timer when auto is enabled this.timer = null; // Will store the timer for displaying the laoder this.showLoaderTimer = null; // Will be true when slider is animating this.animating = false; // The slides this.$slides = $('.builder-slider-slide', this.$element); this.numSlides = this.$slides.length; // 0 based index this.activeIndex = 0; // Append the direction control HTML when enabled if ( this.directionControl ) { this.$element.append( this.getDirectionHTML() ); } // Append the pager control HTML when enabled if ( this.pagerControl ) { var $pager = $(this.getPagerHTML()); $pager.children().first().addClass('is-active'); this.$element.append( $pager ); } // If auto is enabled start the timer if ( this.interval ) { this.setTimer(); } // Attach all user events this.attachEvents(); // Append the loader to the slider element this.$element.append( this.getLoaderHTML() ); // Sanitize the slides this.prepareSlides(); // Tell the CSS that the slider is ready this.$element.addClass('js-plugin-loaded'); }, attachEvents: function() { var self = this; // Pause interval when slider is moused over if ( this.hoverPause ) { this.$element.on({ mouseenter: $.proxy( this.mouseEnter, this ), mouseleave: $.proxy( this.mouseLeave, this ), }); } // Next/Previous slide buttons $('.builder-slider-next-slide', this.$element).on( 'click', $.proxy( this.next, this ) ); $('.builder-slider-prev-slide', this.$element).on( 'click', $.proxy( this.prev, this ) ); // Pager buttons $('.builder-slider-pager-nav button', this.$element).on( 'click', function() { self.changeSlide( $(this).index() ); }); }, prepareSlides: function() { var self = this, $firstSlide = this.$slides.eq(0); this.$slides.each( function() { var $slide = $(this); // Remove the HTML5 video background if it not supported if ( $slide.is('.has-video-bg') && themefyreBuilder.isMobile() ) { $slide.removeClass('has-video-bg'); $('.builder-html5-video-bg', $slide).remove(); } }); // Reveal the first slide & play the HTML5 video background if one is present $firstSlide.addClass('is-active is-visible'); if ( $firstSlide.is('.has-video-bg') ) { var firstSlidePlayer = $('.builder-html5-video-bg', $firstSlide)[0]; if ( firstSlidePlayer.readyState >= firstSlidePlayer.HAVE_FUTURE_DATA ) { firstSlidePlayer.play(); } else { self.showLoader(); $(firstSlidePlayer).on( 'canplay', _.once( function() { firstSlidePlayer.play(); self.hideLoader(); })); } } // Reset parallax scrolling for all elements found in the slider this.refreshParallaxElements( $firstSlide ); }, setTimer: function() { var self = this; this.clearTimer(); this.timer = setTimeout( function() { if ( ! self.mouseOver ) { self.next(); } }, this.interval ); }, clearTimer: function() { clearTimeout( this.timer ); }, mouseEnter: function() { this.mouseOver = true; this.clearTimer(); }, mouseLeave: function() { this.mouseOver = false; if ( ! this.animating ) { this.setTimer(); } }, getLoaderHTML: function() { return ' '; }, showLoader: function() { this.$element.addClass('is-loading'); }, hideLoader: function() { this.$element.removeClass('is-loading'); }, getDirectionHTML: function() { var HTML = [ '', '', ]; return HTML.join(''); }, getPagerHTML: function() { var HTML = [ ' '); return HTML.join(''); }, updateControlsHTML: function() { if ( this.pagerControl ) { var $pager = $('.builder-slider-pager-nav', this.$element); $pager.children().removeClass('is-active').eq( this.activeIndex ).addClass('is-active'); } }, next: function() { this.changeSlide( (this.activeIndex+1) === this.numSlides ? 0 : this.activeIndex+1 ); }, prev: function() { this.changeSlide( this.activeIndex === 0 ? this.numSlides-1 : this.activeIndex-1 ); }, refreshParallaxElements: function( $currentSlide ) { $('[data-parallax]', this.$slides.not($currentSlide) ).each( function() { var $this = $(this), parallaxMode = $this.attr('data-parallax'); $this.attr('data-parallax-placeholder', parallaxMode); $this.removeAttr('data-parallax'); }); $('[data-parallax-placeholder]', $currentSlide ).each( function() { var $this = $(this), parallaxMode = $this.attr('data-parallax-placeholder'); $this.attr('data-parallax', parallaxMode); $this.removeAttr('data-parallax-placeholder'); }); themefyreBuilder.addParallaxScrolling(); }, changeSlide: function( index ) { if ( this.animating || index === this.activeIndex ) { return; } // If auto is enabled clear the timer if ( this.interval ) { this.clearTimer(); } // Set the animating state to true this.animating = true; var self = this, $nextSlide = this.$slides.eq(index); // Activate the show loader timer this.showLoaderTimer = setTimeout( $.proxy(this.showLoader, this), 50 ); // The upcoming slide has a video BG or a parallax video bg // This means we need to wait for it to load completely to change to it if ( $nextSlide.is('.has-video-bg') ) { var nextSlidePlayer = $('.builder-html5-video-bg', $nextSlide)[0]; if ( nextSlidePlayer.readyState >= nextSlidePlayer.HAVE_FUTURE_DATA ) { this.doChangeSlide(index); } else { $(nextSlidePlayer).on( 'canplay', _.once( function() { self.doChangeSlide(index); })); } } // The upcoming slide has an image BG or a parallax image bg // This means we need to wait for the BG image to load else if ( $nextSlide.is('.has-image-bg') ) { var $nextSlideBGElement = $nextSlide.is('.has-parallax-image-bg') ? $('.builder-parallax-bg', $nextSlide) : $nextSlide, nextSlideImageURL = $nextSlideBGElement.css('background-image').match(/\((.*?)\)/)[1].replace(/('|")/g,''), nextSlideImage = new Image(); nextSlideImage.src = nextSlideImageURL; if (nextSlideImage.complete) { self.doChangeSlide(index); } else { nextSlideImage.onload = function() { self.doChangeSlide(index); } } } // No Video or image background, ready to change slides now else { self.doChangeSlide(index); } }, doChangeSlide: function( index ) { var self = this, $currentSlide = this.$slides.eq(this.activeIndex), $nextSlide = this.$slides.eq(index); // Reset parallax scrolling for all elements found in the slider self.refreshParallaxElements( $nextSlide ); // Change the active index self.activeIndex = index; // Update the HTML for all controls self.updateControlsHTML(); // Prevent the loader from being revealed if it hasn`t yet // This generally happens when the image is already loaded clearTimeout( this.showLoaderTimer ); self.hideLoader(); // If the current slide has a video background, pause it after a delay if ( $currentSlide.is('.has-video-bg') ) { setTimeout( function() { var currentSlidePlayer = $('.builder-html5-video-bg', $currentSlide)[0]; currentSlidePlayer.pause(); }, 500); } // If the next slide has a video background, restart & play it if ( $nextSlide.is('.has-video-bg') ) { var nextSlidePlayer = $('.builder-html5-video-bg', $nextSlide)[0]; nextSlidePlayer.currentTime = 0; nextSlidePlayer.play(); } // Set the new slide to active and apply the animating class to the new slide $currentSlide.removeClass('is-active').addClass('is-hiding'); $nextSlide.addClass('is-active is-animated is-visible'); setTimeout( function() { // Hide the formerly active slide $currentSlide.removeClass('is-visible is-hiding'); // Remove the animation class $nextSlide.removeClass('is-animated'); // If auto is enabled reset the timer if ( self.interval ) { self.setTimer(); } // We`re now done with the transition self.animating = false; }, 500); }, }); }(jQuery, _)); // ====================================================== // // requestAnimationFrame polyfill // // ====================================================== // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating // // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel // // MIT license ;(function() { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x ) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if ( ! window.requestAnimationFrame ) { window.requestAnimationFrame = function(callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max( 0, 16 - (currTime - lastTime) ); var id = window.setTimeout( function() { callback(currTime + timeToCall ); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } if ( ! window.cancelAnimationFrame ) { window.cancelAnimationFrame = function( id ) { clearTimeout( id ); }; } }()); // ====================================================== // // 3rd Party jQuery Plugins // // ====================================================== /* * jQuery resize event - v1.1 - 3/14/2010 * http://benalman.com/projects/jquery-resize-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this); // Magnific Popup v1.0.0 by Dmitry Semenov // http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+imagezoom+fastclick (function(a){typeof define=="function"&&define.amd?define(["jquery"],a):typeof exports=="object"?a(require("jquery")):a(window.jQuery||window.Zepto)})(function(a){var b="Close",c="BeforeClose",d="AfterClose",e="BeforeAppend",f="MarkupParse",g="Open",h="Change",i="mfp",j="."+i,k="mfp-ready",l="mfp-removing",m="mfp-prevent-close",n,o=function(){},p=!!window.jQuery,q,r=a(window),s,t,u,v,w=function(a,b){n.ev.on(i+a+j,b)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(b,c){n.ev.triggerHandler(i+b,c),n.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),n.st.callbacks[b]&&n.st.callbacks[b].apply(n,a.isArray(c)?c:[c]))},z=function(b){if(b!==v||!n.currTemplate.closeBtn)n.currTemplate.closeBtn=a(n.st.closeMarkup.replace("%title%",n.st.tClose)),v=b;return n.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(n=new o,n.init(),a.magnificPopup.instance=n)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(a.transition!==undefined)return!0;while(b.length)if(b.pop()+"Transition"in a)return!0;return!1};o.prototype={constructor:o,init:function(){var b=navigator.appVersion;n.isIE7=b.indexOf("MSIE 7.")!==-1,n.isIE8=b.indexOf("MSIE 8.")!==-1,n.isLowIE=n.isIE7||n.isIE8,n.isAndroid=/android/gi.test(b),n.isIOS=/iphone|ipad|ipod/gi.test(b),n.supportsTransition=B(),n.probablyMobile=n.isAndroid||n.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),s=a(document),n.popupsCache={}},open:function(b){var c;if(b.isObj===!1){n.items=b.items.toArray(),n.index=0;var d=b.items,e;for(c=0;cx
'; head.appendChild(div.childNodes[1]); } if ( options ) { $.extend( settings, options ); } return this.each(function(){ var selectors = [ 'iframe[src*="player.vimeo.com"]', 'iframe[src*="youtube.com"]', 'iframe[src*="youtube-nocookie.com"]', 'iframe[src*="kickstarter.com"][src*="video.html"]', 'object', 'embed' ]; if (settings.customSelector) { selectors.push(settings.customSelector); } var ignoreList = '.fitvidsignore'; if(settings.ignore) { ignoreList = ignoreList + ', ' + settings.ignore; } var $allVideos = $(this).find(selectors.join(',')); $allVideos = $allVideos.not('object object'); // SwfObj conflict patch $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. $allVideos.each(function(count){ var $this = $(this); if($this.parents(ignoreList).length > 0) { return; // Disable FitVids on this video. } if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) { $this.attr('height', 9); $this.attr('width', 16); } var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), aspectRatio = height / width; if(!$this.attr('id')){ var videoID = 'fitvid' + count; $this.attr('id', videoID); } $this.wrap('').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); $this.removeAttr('height').removeAttr('width'); }); }); }; // Works with either jQuery or Zepto })( window.jQuery || window.Zepto ); // source --> https://www.dreamweaverpillow.com/wp-content/plugins/woocommerce/assets/js/js-cookie/js.cookie.min.js?ver=2.1.4 /*! * JavaScript Cookie v2.1.4 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ !function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e