//Weekend to Remember function FL_WTR_mapsInit(element) { const locations = []; const infowindow = new google.maps.InfoWindow({}); let latlng = new google.maps.LatLng(39.099727, -94.578567); let mapOptions = { zoom: 4, center: latlng, panControl: true, panControlOptions: { position: google.maps.ControlPosition.LEFT_TOP }, mapTypeControl: false, scaleControl: false, streetViewControl: true, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE, position: google.maps.ControlPosition.LEFT_BOTTOM }, overviewMapControl: false, rotateControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; let map = new google.maps.Map(element, mapOptions); addMarker(); function addMarker() { //query Events API let today = new Date(); let addDay = 0; today.setDate(today.getDate() + addDay); let enddate = new Date(); let dd = today.getDate(); let mm = today.getMonth() + 1; //January is 0! let startyyyy = today.getFullYear(); let endYear = today.getFullYear() + 1; if (dd < 10) { dd = '0' + dd; } if (mm < 10) { mm = '0' + mm; } today = startyyyy + '-' + mm + '-' + dd; enddate = endYear + '-' + mm + '-' + dd; let parameterList = 'eventType=wtr'; let apiAccessor = new FamilyLife.api(); let firstEventDate; apiAccessor.getEventsByDateRange(today, enddate, parameterList, function (error, results) { let setCounter = true; for (let i = 0; i < results.length; i++) { // obtain the attribues of each marker let lat = parseFloat(results[i].latitude); let lng = parseFloat(results[i].longitude); let title = results[i].title; let startDate = results[i].startDate.substring(0, 10); let endDate = results[i].endDate.substring(0, 10); let price = results[i].price; let url = results[i].url; let isGetaway = results[i].isGetaway; let eventId = results[i].eventId; //per Jordan Thomas - display sold out msg for Napa Feb 2017 event let soldOutMsg = ""; if (eventId == "WTR17APC1") { soldOutMsg = "SOLD OUT"; } if (localStorage.getItem("utm_campaign") != null) { url = url + '?utm_campaign=' + localStorage.getItem("utm_campaign"); if (localStorage.getItem("utm_medium") != null) { url = url + '&utm_medium=' + localStorage.getItem("utm_medium"); } if (localStorage.getItem("utm_source") != null) { url = url + '&utm_source=' + localStorage.getItem("utm_source"); } if (localStorage.getItem("utm_content") != null) { url = url + '&utm_content=' + localStorage.getItem("utm_content"); } } let myLatlng = new google.maps.LatLng(lat, lng); let groupName = getUrlVars()["groupName"]; let contentString = ""; contentString += "
"; contentString += "

"; contentString += "" + title + "
"; if (soldOutMsg != "") { contentString += soldOutMsg + "
"; } contentString += "Start Date:   " + startDate + "
"; contentString += "End Date:   " + endDate + "
"; contentString += "Price:  $" + price + "/person
"; if (groupName == null) { contentString += "Register"; } else { contentString += "Register"; } contentString += "

"; contentString += "
"; let marker; if (isGetaway.toLowerCase() == "true") { marker = new google.maps.Marker({ position: myLatlng, map: map, title: title, //icon: "/_images/blueumbrella.png" }); } else { marker = new google.maps.Marker({ position: myLatlng, map: map, title: title, }); } for (let j = 0; j < locations.length; j++) { if (marker.title == locations[j].title) { contentString = locations[j]['infowindow'] + '
' + contentString; } } marker['infowindow'] = contentString; locations[i] = marker; google.maps.event.addListener(locations[i], 'click', function () { infowindow.setContent(this['infowindow']); infowindow.open(map, this); }); } }); } return map; } jQuery(document).ready(function ($) { function isMobileWidth() { if ($(document).width() <= 768) { return true; } } $('.toggle-mobile-menu').on('click', function () { $(this).toggleClass('mobile-menu-open'); let mainNav = $('#main-navigation-mobile'); mainNav.slideToggle(500, function () { mainNav.toggleClass('open-menu'); }); }); function showScrollToTop() { if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200) { $('#to-top').addClass('show'); } if ((window.innerHeight + window.scrollY) <= document.body.offsetHeight / 2) { $('#to-top').removeClass('show'); } } if (!isMobileWidth()) { if ($('.single-wpfc_sermon, .tax-wpfc_sermon, .single-fl_today, .header-sticky-on-mobile').length === 0) { let lastpos = 0; document.addEventListener('scroll', function () { let pos = document.documentElement.scrollTop || document.body.scrollTop; let windowHeight = document.documentElement.clientHeight || window.innerHeight; let sHeight = document.documentElement.scrollHeight; let top = document.getElementById('main-header'); let body = document.getElementsByTagName('body')[0]; if (pos > top.clientHeight && (pos >= sHeight - windowHeight - 100 || lastpos <= pos)) { //top.classList.remove('sticky-active'); //body.classList.remove('sticky-header'); top.style.top = (-top.clientHeight) + 'px'; } else { if (pos !== 0) { top.classList.add('sticky-active'); body.classList.add('sticky-header'); top.style.top = '0'; } } lastpos = pos; if (pos === 0) { top.classList.remove('sticky-active'); body.classList.remove('sticky-header'); } //Scroll to top showScrollToTop(); }, true); } } if ($('body').hasClass('header-sticky-on-mobile') || $('.single-weekend-to-remember').length > 0) { document.addEventListener('scroll', function () { showScrollToTop(); }, true); } if (isMobileWidth()) { $('li.menu-item-has-children').on('click', function (e) { $(this).toggleClass('open-submenu'); }); } $.expr[':'].parents = function (a, i, m) { return $(a).parents(m[3]).length < 1; }; let selectBoxes = $('select').filter(':parents(.disable-select2)'); if (selectBoxes.length) { if($('body').hasClass('rtl')) { // For arabic. selectBoxes.select2({ minimumResultsForSearch: -1, dir: "rtl" }); } else { // non-RTL languages selectBoxes.select2({ minimumResultsForSearch: -1 }); } } let owl = $(".owl-carousel"); if (owl.length) { let owlNav = parseInt(owl.data('nav')); let owlItems = parseInt(owl.data('items')); if (isNaN(owlItems)) { owlItems = 0; } if (isNaN(owlNav)) { owlNav = 0; } owl.owlCarousel({ loop: false, margin: 0, navRewind: true, responsive: { 0: { items: 1, nav: true, dots: true }, 1000: { items: owlItems !== 0 ? owlItems : 1, nav: owlNav !== 0 ? owlNav : true, dots: true } } }) } //WTR Map Click to Activate let onInteractMap = jQuery('.wtr-on-interact-map'); let originalCanvas = jQuery('#map-canvas'); onInteractMap.on('click', function () { if (typeof google === 'object' && typeof google.maps === 'object') { let parent = onInteractMap.parent('.inner'); if (!parent.length) { parent = onInteractMap.parent('.map-widget-wrap'); } if (parent.length) { parent.addClass('interactive-clicked-map'); FL_WTR_mapsInit(parent[0]) } } }); if ((originalCanvas.length > 0) && onInteractMap.length === 0) { FL_WTR_mapsInit(originalCanvas[0]); } //Add span tag to checkboxes for styling $('input[type="checkbox"]').each(function () { if(!$(this).hasClass("ui-styled-toggle")){ //check if checkbox is not a UI Toggle Box //check if for relationship exists let id = $(this).attr('id'); if (typeof id !== typeof undefined && id !== false && $('label[for="' + id + '"]').length > 0) { $('label[for="' + id + '"]').prepend(''); $(this).addClass('restyled'); } } }); //Added for Spanish site if ($('body').hasClass('es_ES') || $('body').hasClass('collapse-elementor-accordions')) { setTimeout(function () { if ($('.elementor-widget-accordion').length > 0) { $('.elementor-widget-accordion').each(function () { $(this).find('.elementor-tab-title:first').removeClass('elementor-active'); $(this).find('.elementor-tab-content:first').css('display', 'none'); }); } }, 100); } $('.below-content-social-links a').on('click', function () { let network = $(this).attr('class'); let link = $(this).attr('href'); ga('send', 'social', network, 'share', link); }); //Add audio custom script for play one at a time. $('audio').bind('play', function () { let activated = this; $('audio').each(function () { if (this != activated) this.pause(); }); }); $('.toggle-rebrand-menu').on('click', function (e) { e.preventDefault(); $(window).scrollTop(0); $('#rebrand-menu').toggleClass('open'); }); // CLOSE HAMBURGER MENU ON CLICK // $('.close-menu').on('click', function (e) { $('#rebrand-menu').toggleClass('open'); }); $('.dropdown-subscribe-form').find('.ginput_container_email input').on('click', function () { let height = $(this).parents('form').height(); $(this).parents('.gform_wrapper').addClass('open'); }); $('.tab-titles li').on('click', function (e) { e.preventDefault(); //Remove active $('.tab-titles li').removeClass('active'); $('.tab-content li').removeClass('active'); $(this).addClass('active'); let tab = $(this).data('tab'); $('.tab-content li[data-tab="' + tab + '"]').addClass('active'); }); function fancyTimeFormat(duration) { // Hours, minutes and seconds let hrs = ~~(duration / 3600); let mins = ~~((duration % 3600) / 60); let secs = ~~duration % 60; // Output like "1:01" or "4:03:59" or "123:03:59" let ret = ""; if (hrs > 0) { ret += "" + hrs + ":" + (mins < 10 ? "0" : ""); } ret += "" + mins + ":" + (secs < 10 ? "0" : ""); ret += "" + secs; return ret; } $('body').on('click', '.rebrand-podcast-player-buttons .play', function (e) { e.preventDefault(); let duration = '00:00'; let clickedButton = $(this); let player = clickedButton.parents('.rebrand-podcast-player'); let progressBar = player.find('.rebrand-podcast-player-progress-bar'); duration = player.find('.time').last(); let currentDuration = player.find('.time').first(); player.find('audio').on('timeupdate', function () { progressBar.val((this.currentTime / this.duration) * 100); currentDuration.html(fancyTimeFormat(this.currentTime)); if (this.currentTime === 0 || this.currentTime === this.duration) { clickedButton.removeClass('playing'); } }); if (clickedButton.hasClass('playing')) { player.find('audio')[0].pause(); clickedButton.removeClass('playing') } else { player.find('audio')[0].play(); clickedButton.addClass('playing'); } duration.html(fancyTimeFormat(player.find('audio')[0].duration)); }); $('.rebrand-podcast-player-progress-bar').on('input', function (e) { let player = $(this).parents('.rebrand-podcast-player'); player.find('audio')[0].currentTime = player.find('audio')[0].duration * ($(this).val() / 100); player.find('audio').on('timeupdate', function () { //progressBar.attr('value', (this.currentTime / this.duration)*100); }); }); function fancyTimeFormat(duration) { // Hours, minutes and seconds let hrs = ~~(duration / 3600); let mins = ~~((duration % 3600) / 60); let secs = ~~duration % 60; // Output like "1:01" or "4:03:59" or "123:03:59" let ret = ""; if (hrs > 0) { ret += "" + hrs + ":" + (mins < 10 ? "0" : ""); } ret += "" + mins + ":" + (secs < 10 ? "0" : ""); ret += "" + secs; return ret; } $('.elementor-podcast-widget-play').on('click', function (e) { e.preventDefault(); let duration = '00:00'; let player = $(this).parents('.podcast-post-widget').find('.podcast-post-widget-player'); let progressBar = $(this).parents('.podcast-post-widget').find('.podcast-widget-seekbar'); duration = $(this).parents('.podcast-post-widget').find('.play-bar-duration'); player.on('timeupdate', function () { progressBar.attr('value', this.currentTime / this.duration); //console.log(this.duration); }); let buttonBar = $(this).parents('.podcast-play-bar'); if (buttonBar.hasClass('playing')) { player[0].pause(); buttonBar.removeClass('playing') } else { player[0].play(); buttonBar.addClass('playing'); } duration.html(fancyTimeFormat(player[0].duration)); }); $('.rebrand-subscribe').on('click', function (e) { let clickedButton = $(this).find('a'); let subscribeButtonIcons = ''; let the_subscribe_buttons_array = ''; if($(this).hasClass('rebrand-subscribe-single')){ if((FAMILYLIFE_THEME.subscribe_buttons_single != null) && (FAMILYLIFE_THEME.subscribe_buttons_single.length != 0)){ the_subscribe_buttons_array = FAMILYLIFE_THEME.subscribe_buttons_single; } else if((FAMILYLIFE_THEME.subscribe_buttons_parent_service_type != null) && (FAMILYLIFE_THEME.subscribe_buttons_parent_service_type.length != 0)){ the_subscribe_buttons_array = FAMILYLIFE_THEME.subscribe_buttons_parent_service_type; } else{ the_subscribe_buttons_array = FAMILYLIFE_THEME.subscribe_buttons_general; } } else if($(this).hasClass('rebrand-subscribe-wpfc-service-type') && (FAMILYLIFE_THEME.subscribe_buttons_service_type != null) && (FAMILYLIFE_THEME.subscribe_buttons_service_type.length != 0)){ the_subscribe_buttons_array = FAMILYLIFE_THEME.subscribe_buttons_service_type; } else{ the_subscribe_buttons_array = FAMILYLIFE_THEME.subscribe_buttons_general; } if(the_subscribe_buttons_array != ''){ $.each(the_subscribe_buttons_array, function (index, element) { subscribeButtonIcons += '' + element.name + ''; }); } /*console.log(clickedButton);*/ /*console.log(subscribeButtonIcons);*/ let subscribeButtons = '
' + subscribeButtonIcons + '
'; if (clickedButton.find('.rebrand-floating-subscribe').length > 0) { //Floating subscribe already exists if (clickedButton.find('.rebrand-floating-subscribe').is(':visible')) { clickedButton.find('.rebrand-floating-subscribe').hide(); } else { clickedButton.find('.rebrand-floating-subscribe').show(); } } else { $(subscribeButtons).appendTo(clickedButton); } }); $('.rebrand-like').on('click', function () { //Save likes to cookie //Send AJAX to site to record likes }); // Homepage play video from toggle switch $('.video-toggle .elementor-tab-title').on('click', function () { if (!($(this).hasClass("playedVideo"))) { let parent = $(this).parents(".video-section"); let video = $(parent).find("video.elementor-video"); let videoOverlay = $(parent).find(".elementor-custom-embed-image-overlay"); $(videoOverlay).hide(); $(video).get(0).play(); $(this).addClass("playedVideo"); } }); // Masonry function $.fn.masonryGrid = function (options) { // Get options var settings = $.extend({ columns: 3, breakpoint: 767 }, options); var $this = $(this), currentColumn = 1, i = 1, itemCount = 1, isDesktop = true; // Add class to already existent items $this.addClass('masonry-grid-origin'); $this.children().addClass('masonry-grid-item'); function createMasonry() { currentColumn = 1; // Add columns for (columnCount = 1; columnCount <= settings.columns; columnCount++) { $this.each(function () { $(this).append('
'); }); } // Add basic styles to columns $this.each(function () { $(this).css('display', 'flex').find('.masonry-grid-column').css('width', '100%'); }); $this.each(function () { var currentGrid = $(this); currentGrid.find('.masonry-grid-item').each(function () { // Reset current column if (currentColumn > settings.columns) currentColumn = 1; // Add ident to element and put it in a column $(this).attr('id', 'masonry_grid_item_' + itemCount) .appendTo(currentGrid.find('.masonry-grid-column-' + currentColumn)); // Increase current column and item count currentColumn++; itemCount++; }); }); } function destroyMasonry() { // Put items back in first level of origin container $this.each(function () { while (i < itemCount) { // Append item to parent container $(this).find('#masonry_grid_item_' + i).appendTo($this); i++; } // Remove columns $(this).find('.masonry-grid-column').remove(); // Remove basic styles $(this).css('display', 'block').find('.masonry-grid-column').css('width', 'auto'); }); } // Call functions if ($(window).width() > settings.breakpoint) { isDesktop = true; createMasonry(); } else if ($(window).width() <= settings.breakpoint) { isDesktop = false; destroyMasonry(); } $(window).on('resize', function () { if ($(window).width() > settings.breakpoint && isDesktop == false) { isDesktop = true; createMasonry(); } else if ($(window).width() <= settings.breakpoint && isDesktop == true) { isDesktop = false; destroyMasonry(); } }); } // Masonry layour for posts&podcasts category archive, Search results page $(function () { $('.grid-archive-masonry').masonryGrid({ 'columns': 3 }); }); // Slick slider function function sgsBriefSlick() { $('.sgs-brief').slick({ arrows: false, infinite: false, slidesToShow: 4, dots: false, adaptiveHeight: true, responsive: [ { breakpoint: 770, settings: { infinite: true, arrows: true, slidesToShow: 2, slidesToScroll: 2 } } ] }); } function destroysgsBriefSlick() { if ($('.sgs-brief').hasClass('slick-initialized')) { $('.sgs-brief').slick('destroy'); } } sgsBriefSlick(); // Small Group Studies Filters and Actions // TOPIC FILTER $(".sgs-topics span").on('click', function () { let that = $(this); let topic = that.data('topic'); let ajaxUrl = $(".sgs-filters").data('url'); if (!$(".sgs-topics").hasClass('loading-topics')) { $(".sgs-topics").addClass('loading-topics'); $(".sgs-filter-criterias input").prop('checked', false); $(".show-filter-critarias").addClass('loading-topics').removeClass('has-filters-activated'); $(".sgs-loading-icon").slideDown(300); $.ajax({ url: ajaxUrl, type: 'post', data: { topic: topic, action: 'filter_small_group_studies' }, error: function (response) { console.log(response); $(".sgs-loading-icon").slideUp(300); $(".sgs-topics").removeClass('loading-topics'); $(".show-filter-critarias").removeClass('loading-topics'); }, success: function (response) { $('.sgs-main-wrapper').html(response); $(".sgs-loading-icon").slideUp(300); $(".sgs-topics span").removeClass('active-topic-filter'); that.addClass('active-topic-filter'); $(".sgs-topics").removeClass('loading-topics'); $(".show-filter-critarias").removeClass('loading-topics'); //reset brief slick slider destroysgsBriefSlick(); sgsBriefSlick(); } }); } else { console.log('still loading'); } }); // MAIN FILTER // $(".sgs-filter-button").on('click', function () { if($(this).hasClass('sgs-filter-button-small-group-studies')){ var ajax_action_name = 'filter_small_group_studies'; }else if($(this).hasClass('sgs-filter-button-wtr-reviews')){ var ajax_action_name = 'filter_wtr_reviews'; } let that = $(this); let number_of_active_filters = 0; let ajaxUrl = $(".sgs-filters").data('url'); //Small Group Studies Filter let audience_filter = ''; $(".audience-filter input").each(function () { if ($(this).is(":checked")) { audience_filter = $(this).data('audience'); number_of_active_filters++; } }); let materialType_filter = ''; $(".materialType-filter input").each(function () { if ($(this).is(":checked")) { materialType_filter = $(this).data('material'); number_of_active_filters++; } }); let sgs_price_filter = ''; $(".sgs-price-filter input").each(function () { if ($(this).is(":checked")) { sgs_price_filter = $(this).data('price'); number_of_active_filters++; } }); //WTR Reviews Topic Filter let wtr_topics_filter = ''; let wtr_topics_list = []; $(".wtrReviewTopics-filter input").each(function () { if ($(this).is(":checked")) { wtr_topics_filter = $(this).data('wtr-review-topic'); wtr_topics_list.push(wtr_topics_filter); number_of_active_filters++; } }); if (number_of_active_filters > 0) { $('.show-filter-critarias').addClass('has-filters-activated'); $('.nr-of-active-filters').html(number_of_active_filters); } $('.sgs-filter-criterias-popup').hide().removeClass('filter-popup-active'); $(".show-filter-critarias").addClass('loading-topics'); $(".sgs-loading-icon").slideDown(300); //Topic filter interaction $(".sgs-topics").addClass('loading-topics'); $.ajax({ url: ajaxUrl, type: 'post', data: { audience_filter: audience_filter, materialType_filter: materialType_filter, sgs_price_filter: sgs_price_filter, wtr_topics_list: wtr_topics_list, action: ajax_action_name }, error: function (response) { console.log(response); $(".sgs-loading-icon").slideUp(300); $(".sgs-topics").removeClass('loading-topics'); $(".show-filter-critarias").removeClass('loading-topics'); }, success: function (response) { $('.sgs-main-wrapper').html(response); $(".sgs-loading-icon").slideUp(300); $(".show-filter-critarias").removeClass('loading-topics'); //Topic filter interaction $(".sgs-topics span").removeClass('active-topic-filter'); $(".all-topics").addClass('active-topic-filter'); $(".sgs-topics").removeClass('loading-topics'); //reset brief slick slider destroysgsBriefSlick(); sgsBriefSlick(); } }); }); // FILTER MISCELLANEOUS // $(".sgs-filter-clear-all").on('click', function () { $(".sgs-filter-criterias input").prop('checked', false); $(".show-filter-critarias").removeClass('has-filters-activated'); }); // MAIN FILTER POPUP // $(".show-filter-critarias").on('click', function () { if (!$(this).hasClass('loading-topics')) { $(this).parents('.sgs-filters').find('.sgs-filter-criterias-popup').fadeIn(100).addClass('filter-popup-active'); } }); $(".hide-filter-critarias").on('click', function () { $('.sgs-filter-criterias-popup').hide().removeClass('filter-popup-active'); }); // SGS TOGGLES // $(".sgs-main-wrapper").on('click', '.sgs-toggle-title', function () { if (!$(this).hasClass('opened-tab')) { $('.sgs-toggle-body').slideUp(); $(".sgs-toggle-title").removeClass('opened-tab'); $(this).parents('.sgs-toggle').find('.sgs-toggle-body').slideDown(); $(this).addClass('opened-tab'); } else { $(this).parents('.sgs-toggle').find('.sgs-toggle-body').slideUp(); $(this).removeClass('opened-tab'); } }); $(".sgs-main-wrapper").on('mouseenter', '.sgs-featured-image', function () { $(this).find('.sgs-primary-img').toggle(); $(this).find('.sgs-secondary-img').toggle(); }); $(".sgs-main-wrapper").on('mouseleave', '.sgs-featured-image', function () { $(this).find('.sgs-primary-img').toggle(); $(this).find('.sgs-secondary-img').toggle(); }); // SGS PREVIEW POPUP // $(".sgs-main-wrapper").on('click', '.preview-sgs', function () { $(this).parents('.sgs-single-buttons').find('.sgs-preview-video-popup').fadeIn().addClass('preview-active'); let play_current_sgs_preview_video = $(this).parents('.sgs-single-buttons').find('video'); $(play_current_sgs_preview_video).get(0).play(); }); $(".sgs-main-wrapper").on('click', '.close-sgs-video-popup', function () { $(this).parents('.sgs-single-buttons').find('.sgs-preview-video-popup').hide().removeClass('preview-active'); let pause_current_sgs_preview_video = $(this).parents('.sgs-preview-video-inner').find('video'); $(pause_current_sgs_preview_video).get(0).pause(); $(pause_current_sgs_preview_video).get(0).currentTime = 0; }); // SGS COMPARE FUNCTION // let compare_limit = 3; $('.compare-input').on('change', function (evt) { let currently_selected_to_compare = $('.compare-input:checked').length; $(".dynamic-selcted span").html(currently_selected_to_compare); if (currently_selected_to_compare > 0) { $(".compare-button-sgs").show(); } else { $(".compare-button-sgs").hide(); } if (currently_selected_to_compare >= compare_limit) { this.checked = false; $(".dynamic-selcted span").html(currently_selected_to_compare - 1); } }); $(".compare-button-sgs").on('click', function () { let active_checkboxes = new Array(); $(".compare-input").each(function () { if ($(this).is(":checked")) { let current_checkbox_value = $(this).data('compare'); active_checkboxes.push(current_checkbox_value); } }); $('.compare-item').hide(); $(active_checkboxes).each(function () { if (this == 'art-of-marriage') { $('.sgs1-c').show(); } if (this == 'art-of-marriage-connect') { $('.sgs2-c').show(); } if (this == 'llymi') { $('.sgs3-c').show(); } if (this == 'vertical-marriage') { $('.sgs4-c').show(); } if (this == 'couple-studies') { $('.sgs5-c').show(); } if (this == 'art-of-parenting') { $('.sgs6-c').show(); } if (this == 'stepping-up') { $('.sgs7-c').show(); } if (this == 'the-smart-stepfamily') { $('.sgs8-c').show(); } if (this == 'no-perfect-parent') { $('.sgs9-c').show(); } if (this == 'art-of-marriage-2-0') { $('.sgs10-c').show(); } }); }); $(".sgs-clear-all-compare").on('click', function () { $(".sgs-compare-controls input").prop('checked', false); $(".dynamic-selcted span").html("0"); $('.compare-button-sgs').hide(); }); $(".compare-button-sgs").on('click', function () { $('.sgs-compare-controls').hide(); $('.sgs-compare-results, .back-to-compare-sgs').show(); }); $(".back-to-compare-sgs").on('click', function () { $('.sgs-compare-controls').show(); $('.sgs-compare-results, .back-to-compare-sgs').hide(); }); // SGS POPUP // $(".show-compare-table").on('click', function () { $('.sgs-compare-popup').fadeIn(100).addClass('compare-popup-active'); }); $(".hide-compare").on('click', function () { $('.sgs-compare-popup').hide().removeClass('compare-popup-active'); }); // SGS SLIDERS // $('.sgs-testimonials').slick({ arrows: true, infinite: true, dots: true, adaptiveHeight: true, responsive: [ { breakpoint: 1000, settings: { arrows: false, } } ] }); // ANCHOR TO HELP // $(".sgs-main-wrapper").on('click', '.jump-to-more-info', function () { $([document.documentElement, document.body]).animate({ scrollTop: $("#we-can-help").offset().top }, 700); }); // STICKY FILTERS // $(document).scroll(function () { if($(".sgs-filters").length){ var top_of_screen = $(window).scrollTop(); var top_of_filter_box = $(".sgs-filters").offset().top; const filter_box = $(".sgs-filters"); if(!filter_box.hasClass('filters-not-sticky')){ if ((top_of_screen > top_of_filter_box) && !($(filter_box).hasClass('is-sticky-filter'))) { $(filter_box).addClass('is-sticky-filter'); } if ((top_of_screen < 550) && ($(filter_box).hasClass('is-sticky-filter'))) { $(filter_box).removeClass("is-sticky-filter"); } } } }); // SECONDARY NAVIGATION TOGGLE // $(".secondary-navigation-container__heading").on('click', function () { $(this).parents('.secondary-navigation-container').find('.menu').slideToggle(); }); // Hide a popup $('.hide-popup').click(function(){ $(this).parents('.popup').find('.popup-container').removeClass('active'); }); // Taxonomy Posts Carousel - used with shortcode [taxonomy-post-carousel] // $('.tax-posts-carousel-menu').on('click', function(){ let postSlide = $(this).parents('.taxonomy-post-carousel').find('.posts'); if(!$(this).hasClass('active')){ let currentTaxSlug = $(this).data('taxslug'); $('.tax-posts-carousel-menu').removeClass('active'); $(postSlide).hide().removeClass('posts__active'); $(this).addClass('active'); $(postSlide).each(function(i, currentPostSlide) { if(currentTaxSlug == $(currentPostSlide).data('taxslug')){ $(currentPostSlide).fadeIn(500).css( "display", "grid" ); } }); } }); // Copy to Clipboard Function // function copyToClipboard(targetToCopy, sucessAlert) { //targetToCopy needs to be an input targetToCopy.select(); targetToCopy.setSelectionRange(0, 99999); navigator.clipboard.writeText(targetToCopy.value); if(sucessAlert.length){ const initialButtonText = sucessAlert.text(); sucessAlert.text('Copied'); setTimeout(function(){ sucessAlert.text(initialButtonText); }, 1000); } } //Equip Share Resource copyToClipboard $(".copyToClipboard").click(function(){ let linkToCopy = $(this).parents('.equip-popup-wrapper__share-resource').find('.linkToCopy'); copyToClipboard(linkToCopy[0], $(this)); }); //Toggle User Profile Box // $('.user-info-box-button').on('click', function(e) { $('.user-info-box-dropdown').toggleClass('active'); }); $(document).scroll(function () { if($(".user-info-box-dropdown").length && $('.user-info-box-dropdown').hasClass('active')){ $('.user-info-box-dropdown').removeClass('active'); } }); // CATEGORY PAGES FILTERS // $("#category-resourcetype-filter").on('select2:select', function (e) { let data = e.params.data.id; const currentUrl = window.location.href; const newUrl = new URL(currentUrl.replace(/page\/[0-9]+\//i, '')); newUrl.searchParams.set('resource_type', data); window.location.href = newUrl.href; }); $("#category-sort-filter").on('select2:select', function (e) { let data = e.params.data.id; const url = new URL(window.location.href); url.searchParams.set('order', data); window.location.href = url.href; }); // HORIZONTAL MASONRY INIT // if ( $.isFunction($.fn.masonry) ) { $('.horizontal-masonry-container').masonry({ percentPosition: true, columnWidth: '.horizontal-masonry-grid-sizer', gutter: '.horizontal-masonry-gutter-sizer', itemSelector: '.grid-item-post-archive', horizontalOrder: true, }); } }); // Document ready jQuery(window).on('load', function(){ var $ = jQuery; // HORIZONTAL MASONRY SET LAYOUT - AFTER IMAGES ARE LOADED // function showHorizontalMasonry() { if ( $.isFunction($.fn.masonry) && $('.horizontal-masonry-container').length > 0) { $('.horizontal-masonry-container').masonry('layout'); setTimeout(function(){ $('.masonry-loading-icon').hide(); $('.horizontal-masonry-container').css({opacity: 0, visibility: "visible"}).animate({opacity: 1}, 500); }, 500); } } showHorizontalMasonry(); }); // Window on load; jQuery(document).ready(function ($) { // Redirect search form for term cruise $("form.search-form").on('submit', function (event) { let searched_term = $(this).find("input.search-field").val().toLowerCase(); if (searched_term == 'cruise' || searched_term == 'love like you mean it' || searched_term == 'love like you mean it couples cruise' || searched_term == 'marriage cruise' || searched_term == 'love like you mean it marriage cruise') { event.preventDefault(); window.location.href = "https://www.familylife.com/cruise"; } }); });; !function(e){var a=[],t=!1,i=!1;window.is_fb_loggedin=!1,window.is_google_loggedin=!1;var n=window.location.hash.substring(1),o=new RegExp("^[\\w\\-]+$").test(n),l=function(a){a.css("width","100%"),0!=a.closest(".elementor-section").length&&a.css("height"," "),0!=a.closest(".e-con").length&&a.css("height","100%"),max=-1,a.find("img").each(function(){max"):e.wrap("")}),e.hasClass("uael-gf-ajax-yes")?jQuery(document).on("gform_confirmation_loaded",function(e,a){i.hide(),n.hide()}):t.length>0?(i.hide(),n.hide()):(i.show(),n.show()),"undefined"!=typeof gform&&gform.addAction("gform_input_change",function(a){e.find(".gfield_radio .gchoice_button").length&&!e.hasClass("uael-gf-check-default-yes")&&"radio"==e.find(a).attr("type")&&(e.find(a).parent().hasClass("uael-radio-active")?e.find(a).parent().removeClass("uael-radio-active"):(e.find(".gchoice_button").removeClass("uael-radio-active"),e.find(a).parent().addClass("uael-radio-active")))},10,3)}},r=function(e,a){void 0!==e&&(e.find("select").wrap("
"),t(e),a(document).on("cf.add",function(){t(e)}));function t(e){e.find("input:radio").each(function(){var e=a(this);e.next().hasClass("uael-caf-radio-custom")||e.after("")})}},d=function(e,a){if(void 0!==e){var t=e.find("select:not([multiple])"),i=e.find("span.ajax-loader");t.wrap(""),i.wrap("
");var n=document.querySelector(".wpcf7");null!==n&&n.addEventListener("wpcf7submit",function(a){e.find(".wpcf7-not-valid-tip").wrap("")},!1)}},c=function(){var a=e(this).data("id"),t=e(this).find(".uael-fancy-text-node"),i=t.data("animation"),n=t.data("strings"),o=".elementor-element-"+a,l=t.data("type-speed"),s=t.data("back-speed"),r=t.data("start-delay"),d=t.data("back-delay"),c=t.data("loop"),u=t.data("show_cursor"),f=t.data("cursor-char"),p=t.data("speed"),m=t.data("pause"),g=t.data("mousepause");"type"==i?e(o+" .uael-typed-main").typed({strings:n,typeSpeed:l,startDelay:r,backSpeed:s,backDelay:d,loop:c,showCursor:u,cursorChar:f}):"slide"==i?(e(o+" .uael-fancy-text-slide").css("opacity","1"),e(o+" .uael-slide-main").vTicker("init",{strings:n,speed:p,pause:m,mousePause:g})):UAELEffects._animateHeadline(e(o).find(".uael-slide-main_ul"),t)},u=function(e,n){if(void 0!==e){var o,l,s=e.data("id"),r=e.find(".uael-hotspot-container"),d=r.data("side"),c=r.data("hotspottrigger"),u=r.data("arrow"),f=r.data("distance"),p=r.data("delay"),m=r.data("animation"),g=r.data("animduration"),h="uael-tooltip-wrap-"+s+" uael-hotspot-tooltip",v=r.data("zindex"),w=r.data("autoplay"),_=r.data("repeat"),y=r.data("overlay"),k=r.data("length"),b=r.data("tourinterval"),C=r.data("autoaction"),x=!1,E=r.data("hotspotviewport"),L=r.data("tooltip-maxwidth"),A=r.data("tooltip-minwidth");if(passtrigger="custom"==c?"click":c,clearInterval(a[s]),l=c,n(".uael-hotspot-main-"+s).tooltipster({theme:["tooltipster-noir","tooltipster-noir-customized"],minWidth:A,maxWidth:L,side:d,trigger:l,arrow:u,distance:f,delay:p,animation:m,uaelclass:h,zIndex:v,interactive:!0,animationDuration:g}),"custom"==c){var F=e.find(".uael-hotspot-overlay");W()}else clearInterval(a[s])}function T(){"yes"!=_&&(n(".uael-prev-"+s+'[data-tooltipid="1"]').addClass("inactive"),n(".uael-next-"+s+'[data-tooltipid="'+k+'"]').addClass("inactive"))}function I(){a[s]=setInterval(function(){var i=n(".uael-hotspot-main-"+s+".open");if(o=i.data("uaeltour"),!t)if(i.trigger("click"),"yes"==_)if(elementorFrontend.isEditMode())oi);else{var l=n(".uael-hotspot-main-"+s+".open");l.tooltipster("close"),l.removeClass("open"),clearInterval(a[s]),W(),n(F).show()}x=!1}o==k?o=1:o+=1,n(".uael-hotspot-main-"+s+'[data-uaeltour="'+o+'"]').trigger("click"),n(window).on("scroll",function(){x||(x=!0,window.requestAnimationFrame?window.requestAnimationFrame(l):setTimeout(l,300))})}else"no"==_&&(o',nextSelector:"#uael-timeline-"+y+" a.next",contentSelector:".elementor-element-"+y+" .uael-timeline-main",callback:function(){window.addEventListener("load",k),window.addEventListener("resize",k),window.addEventListener("scroll",k)}})})}function k(){if((i=e.find(".uael-timeline-main")).length<1)return!1;var h=a(document);if(c=r.first().position(),u=r.last().position(),d=e.find(".uael-timeline-field").last(),s.css("top",c.top),m=d.height(),g=d.offset().top-t.offset().top,e.hasClass("uael-timeline-arrow-center"))s.css("bottom",u.top),p=g-c.top,f=p+u.top;else if(e.hasClass("uael-timeline-arrow-top")){var v=m-u.top;s.css("bottom",v),f=g}else if(e.hasClass("uael-timeline-arrow-bottom")){var _=m-u.top;s.css("bottom",_),p=g-c.top,f=p+u.top}w=f+20;var y,k,b,C,x=document.documentElement.clientHeight/2,E=(b=t.offset().top)+c.top-h.scrollTop();E=E<0?Math.abs(E):-Math.abs(E),b=w&&l.height(w):E+xE?(l.height(x-Math.abs(E)),0):l.height(x+E):E+x>=w&&l.height(w),o=e.find(".uael-timeline-marker"),n=e.find(".animate-border");for(var L=0;L"),i=a(this),n=i.data("url"),o=i.closest(".uael-video__gallery-item").find(".uael-vg__overlay"),l=i.closest(".uael-video__gallery-iframe");t.attr("src",n),t.attr("frameborder","0"),t.attr("allowfullscreen","1"),t.attr("allow","autoplay;encrypted-media;"),l.html(t),l.attr("style","background:#000;"),o.hide()}),"carousel"==i){var d=t.data("vg_slider");t.find(".uael-video__gallery-iframe").imagesLoaded({background:!0})&&t.slick(d)}if(a("html").on("click",function(){r.removeClass("show-list")}),e.on("click",".uael-filters-dropdown-button",function(e){e.stopPropagation(),r.addClass("show-list")}),t.hasClass("uael-video-gallery-filter")){var c=e.find(".uael-video__gallery-filters"),u="*";if(""!==n&&o){var f=c.find("[data-filter='."+n.toLowerCase()+"']");f.length>0&&(u="."+n.toLowerCase(),f.siblings().removeClass("uael-filter__current"),f.addClass("uael-filter__current"))}if(c.length>0)""!==(m=c.data("default"))&&(u=m,def_cat_sel=c.find('[data-filter="'+m+'"]'),def_cat_sel.length>0&&(def_cat_sel.siblings().removeClass("uael-filter__current"),def_cat_sel.addClass("uael-filter__current")),-1===s.indexOf(u.replace(/\./g,""))&&(u="*"));var p={};if(t.imagesLoaded({background:".item"},function(e){p=t.isotope({filter:u,layoutMode:"masonry",itemSelector:".uael-video__gallery-item"}),t.find(".uael-video__gallery-item").resize(function(){p.isotope("layout")})}),e.find(".uael-video__gallery-filter").on("click",function(){a(this).siblings().removeClass("uael-filter__current"),a(this).addClass("uael-filter__current");var i=a(this).data("filter");if("*"===i?e.find(".uael-video-gallery-wrap").data("filter-default"):i.replace(".filter-",""),e.find(".uael-video__gallery-filters").data("default"))e.find(".uael-video__gallery-filters").data("default").length;else e.find(".uael-video-gallery-wrap").data("filter-default").length;var n=e.find(".uael-filter__current").text(),o=e.find(".uael-filters-dropdown-list .uael-filter__current").text(),l=window.location.hash.replace("#",""),s=n.replace(o,""),r=n.replace(s,"");(!l&&window.screen.availWidth>768||l)&&(r=n.replace(o,"")),l&&window.screen.availWidth<768&&(r=n.replace(s,"")),e.find(".uael-filters-dropdown-button").text(r),t.isotope({filter:i})}),e.find(".uael-video__gallery-filters").data("default"))(m=e.find(".uael-video__gallery-filters").data("default")).length;else{var m;(m=e.find(".uael-video-gallery-wrap").data("filter-default")).length}var g=e.find(".uael-filter__current").first().text();e.find(".uael-filters-dropdown-button").text(g)}}}},w=function(e,a){if(void 0!==e){var t,l=e.find(".uael-img-justified-wrap"),s=l.data("rowheight"),r=l.data("lastrow"),d=e.find(".uael-filters-dropdown-list"),c=e.find(".uael-image-lightbox-wrap"),u=[],f="uael-fancybox-gallery-"+e.data("id"),p=c.data("lightbox-gallery-loop");t=e.find(".uael-masonry-filters").data("default")?e.find(".uael-masonry-filters").data("default"):e.find(".uael-img-gallery-wrap").data("filter-default"),c.length>0&&(u=JSON.parse(c.attr("data-lightbox_actions")));var m=function(a){e.find(a+' [data-fancybox="uael-gallery"]').fancybox({buttons:u,animationEffect:"fade",baseClass:f,loop:p})};void 0!==t&&m(""===t||"All"===t?".uael-grid-item":".uael-grid-item."+t.substr(1)),e.on("click",".uael-masonry-filter",function(){var e=a(this).attr("data-filter");m("*"===e?".uael-grid-item":".uael-grid-item."+e.substr(1))}),l.length>0&&l.imagesLoaded(function(){}).done(function(e){l.justifiedGallery({rowHeight:s,lastRow:r,selector:"div",waitThumbnailsLoad:!0})}),a("html").on("click",function(){d.removeClass("show-list")}),e.on("click",".uael-filters-dropdown-button",function(e){e.stopPropagation(),d.addClass("show-list")});var g=e.find(".uael-img-carousel-wrap");if(g.length>0){var h=function(e,t){var i=t.$slider,n=-1;i.find(".slick-slide.slick-active").each(function(e){var t=a(this).innerHeight();n0&&(k="."+n.toLowerCase(),b.siblings().removeClass("uael-current"),b.addClass("uael-current"))}if(y.length>0)""!==(E=y.attr("data-default"))&&(k=E,def_cat_sel=y.find('[data-filter="'+E+'"]'),def_cat_sel.length>0&&(def_cat_sel.siblings().removeClass("uael-current"),def_cat_sel.addClass("uael-current")));if(l.length>0)l.imagesLoaded(function(){}).done(function(e){l.justifiedGallery({filter:k,rowHeight:s,lastRow:r,selector:"div"})});else{var C={filter:k,itemSelector:".uael-grid-item",percentPosition:!0,layoutMode:_,hiddenStyle:{opacity:0}},x={};e.imagesLoaded(function(e){x=w.isotope(C)})}if(e.on("click",".uael-masonry-filter",function(){var t=a(this),i=t.attr("data-filter");if(t.siblings().removeClass("uael-current"),t.addClass("uael-current"),"*"===i?e.find(".uael-img-gallery-wrap").data("filter-default"):i.substr(1),e.find(".uael-masonry-filters").data("default"))e.find(".uael-masonry-filters").data("default");else e.find(".uael-img-gallery-wrap").data("filter-default");var n=e.find(".uael-masonry-filters-wrapper .uael-current").text(),o=e.find(".uael-filters-dropdown-list .uael-current").text(),d=window.location.hash.replace("#",""),c=n.replace(o,""),u=n.replace(c,"");(!d&&window.screen.availWidth>768||d)&&(u=n.replace(o,"")),d&&window.screen.availWidth<768&&(u=n.replace(c,"")),e.find(".uael-filters-dropdown-button").text(u),l.length>0?l.justifiedGallery({filter:i,rowHeight:s,lastRow:r,selector:"div"}):x.isotope({filter:i})}),e.find(".uael-masonry-filters").data("default"))var E=e.find(".uael-masonry-filters").data("default");else E="."+e.find(".uael-img-gallery-wrap").data("filter-default");var L=e.find(".uael-filters-dropdown-list .uael-current").text();e.find(".uael-filters-dropdown-button").text(L)}}};UAELVideo={_play:function(a,t){var i=e("