function nitroThumb(e){
return (
'<img src="' + document.getElementById(e).getAttribute("data-thumb") + '" alt="' + document.getElementById(e).getAttribute("data-thumbalt") + '">'
).replace("ID", e) + '<a href="#" class="et_pb_video_play"></a>'
}
function machineYoutubeFrame(event){
event.preventDefault();
var iframe=document.createElement("iframe");
var isUnmuted=this.dataset.unmuted==="1";
var muteParam=isUnmuted ? "&mute=0":"&mute=1";
iframe.setAttribute("src",
"https://www.youtube.com/embed/" + this.dataset.id + "?autoplay=1" + muteParam + "&enablejsapi=1"
);
iframe.setAttribute("frameborder", "0");
iframe.setAttribute("allowfullscreen", "1");
iframe.setAttribute("allow", "autoplay; fullscreen");
var wrapper=document.createElement("div");
wrapper.className="fluid-width-video-wrapper";
wrapper.style.paddingTop="56.25%";
iframe.style.position="absolute";
iframe.style.top="0";
wrapper.appendChild(iframe);
this.parentNode.replaceWith(wrapper);
}
function machineVimeoFrame(event){
event.preventDefault();
var e=document.createElement("iframe");
var videoId=this.dataset.id;
var isUnmuted=this.dataset.unmuted==="1";
var mutedParam=isUnmuted ? "":"&muted=1";
e.setAttribute("src", "https://player.vimeo.com/video/" + videoId + "?autoplay=1" + mutedParam);
e.setAttribute("frameborder", "0");
e.setAttribute("allow", "autoplay; fullscreen");
e.setAttribute("allowfullscreen", "1");
this.parentNode.replaceChild(e, this);
}
function initializeVideoListeners(){
var e, t, r=document.getElementsByClassName("de_demach_youtube_listener");
for (t=0; t < r.length; t++){
if(r[t].classList.contains('de_video_initialized')) continue;
r[t].classList.add('de_video_initialized');
e=document.createElement("div");
e.setAttribute("data-id", r[t].dataset.id);
if(r[t].dataset.unmuted){
e.setAttribute("data-unmuted", r[t].dataset.unmuted);
}
e.innerHTML=nitroThumb(r[t].dataset.id);
e.onclick=machineYoutubeFrame;
r[t].appendChild(e);
}
r=document.getElementsByClassName("de_demach_vimeo_listener");
for (t=0; t < r.length; t++){
if(r[t].classList.contains('de_video_initialized')) continue;
r[t].classList.add('de_video_initialized');
e=document.createElement("div");
e.setAttribute("data-id", r[t].dataset.id);
if(r[t].dataset.unmuted){
e.setAttribute("data-unmuted", r[t].dataset.unmuted);
}
e.innerHTML=nitroThumb(r[t].dataset.id);
e.onclick=machineVimeoFrame;
r[t].appendChild(e);
}}
document.addEventListener("DOMContentLoaded", function(){
initializeVideoListeners();
});
jQuery(document).on('divi_filter_completed', function(){
initializeVideoListeners();
});
jQuery(document).on('divi_machine_modal_loaded', function(){
initializeVideoListeners();
});
function pauseAllVideosInModal($modal){
if(!$modal||!$modal.length){
console.log('pauseAllVideosInModal: No modal found');
return;
}
var $searchContainer=$modal.find('.post-modal-cont').length ? $modal.find('.post-modal-cont'):$modal;
var videoCount=$searchContainer.find('video').length;
var youtubeCount=$searchContainer.find('iframe[src*="youtube.com"], iframe[src*="youtu.be"]').length;
var vimeoCount=$searchContainer.find('iframe[src*="vimeo.com"]').length;
console.log('pauseAllVideosInModal: Found', videoCount, 'HTML5 videos,', youtubeCount, 'YouTube iframes,', vimeoCount, 'Vimeo iframes');
$searchContainer.find('video').each(function(){
try {
if(this.pause){
this.pause();
}} catch (e){
console.log('Could not pause HTML5 video:', e);
}});
$searchContainer.find('iframe[src*="youtube.com"], iframe[src*="youtu.be"]').each(function(){
var iframe=this;
var originalSrc=iframe.src;
if(!originalSrc){
console.log('pauseAllVideosInModal: YouTube iframe has no src');
return;
}
console.log('pauseAllVideosInModal: Attempting to pause YouTube video:', originalSrc);
try {
if(iframe.contentWindow&&originalSrc.indexOf('enablejsapi=1')!==-1){
console.log('pauseAllVideosInModal: Using postMessage for YouTube');
iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
iframe.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
}else{
console.log('pauseAllVideosInModal: enablejsapi not found, modifying src');
var videoIdMatch=originalSrc.match(/(?:youtube\.com\/embed\/|youtu\.be\/)([^?&]+)/);
if(videoIdMatch&&videoIdMatch[1]){
var videoId=videoIdMatch[1];
var newSrc='https://www.youtube.com/embed/' + videoId + '?autoplay=0&enablejsapi=1';
iframe.src=newSrc;
console.log('pauseAllVideosInModal: Modified YouTube src to:', newSrc);
}else{
var modifiedSrc=originalSrc.replace(/[?&]autoplay=\d+/gi, '');
modifiedSrc +=(modifiedSrc.indexOf('?')===-1 ? '?':'&') + 'autoplay=0';
iframe.src=modifiedSrc;
console.log('pauseAllVideosInModal: Modified YouTube src (fallback) to:', modifiedSrc);
}}
} catch (e){
console.log('Could not pause YouTube video:', e);
try {
var videoIdMatch=originalSrc.match(/(?:youtube\.com\/embed\/|youtu\.be\/)([^?&]+)/);
if(videoIdMatch&&videoIdMatch[1]){
iframe.src='https://www.youtube.com/embed/' + videoIdMatch[1] + '?autoplay=0';
}} catch (e2){
console.log('Failed to stop YouTube video:', e2);
}}
});
$searchContainer.find('iframe[src*="vimeo.com"]').each(function(){
var iframe=this;
var originalSrc=iframe.src;
if(!originalSrc){
console.log('pauseAllVideosInModal: Vimeo iframe has no src');
return;
}
console.log('pauseAllVideosInModal: Attempting to pause Vimeo video:', originalSrc);
try {
if(iframe.contentWindow){
console.log('pauseAllVideosInModal: Using postMessage for Vimeo');
iframe.contentWindow.postMessage('{"method":"pause"}', '*');
}
var videoIdMatch=originalSrc.match(/vimeo\.com\/video\/([^?&]+)/);
if(videoIdMatch&&videoIdMatch[1]){
var videoId=videoIdMatch[1];
var newSrc='https://player.vimeo.com/video/' + videoId + '?autoplay=0';
if(originalSrc.indexOf('muted')!==-1){
newSrc +='&muted=1';
}
iframe.src=newSrc;
console.log('pauseAllVideosInModal: Modified Vimeo src to:', newSrc);
}else{
var modifiedSrc=originalSrc.replace(/[?&]autoplay=\d+/gi, '');
modifiedSrc +=(modifiedSrc.indexOf('?')===-1 ? '?':'&') + 'autoplay=0';
iframe.src=modifiedSrc;
console.log('pauseAllVideosInModal: Modified Vimeo src (fallback) to:', modifiedSrc);
}} catch (e){
console.log('Could not pause Vimeo video:', e);
try {
var videoIdMatch=originalSrc.match(/vimeo\.com\/video\/([^?&]+)/);
if(videoIdMatch&&videoIdMatch[1]){
iframe.src='https://player.vimeo.com/video/' + videoIdMatch[1] + '?autoplay=0';
}} catch (e2){
console.log('Failed to stop Vimeo video:', e2);
}}
});
}
jQuery(document).ready(function ($){
/*  $(document).on('click', '.show_modal', function(e){
e.preventDefault();
e.stopPropagation();
var srcContent=$($(this).attr('data-mfp-src')).html();
$.magnificPopup.open({
items: {
src: srcContent,
type: 'inline'
}});
});*/
if(typeof jQuery.fn.magnificPopup!=='undefined'){
$('.et_pb_de_mach_gallery_trigger').magnificPopup({
type:'inline',
midClick: true
});
}
$(document.body).on('click', '.dmach-link-whole-grid-card', function (){
var url=$(this).data("link-url");
window.location.href=url;
});
main_count=Number(0);
$('.dmach-search-items').each(function (i, obj){
main_count=Number(0);
$(this).children('.et_pb_de_mach_search_posts_item').each(function (i, obj){
var count=Number($(this).find(".search_filter_cont").attr("data-count"));
main_count=main_count + count;
if(main_count >="100"){
$(this).addClass("last-item");
main_count=Number(0);
}});
});
$(".search_filter_cont").removeClass("hidden");
$(".button_container").removeClass("hidden");
$('#select_post_types').on('change', function (){
var post_type_change=this.value;
$("#search_post_type").val(post_type_change);
});
var columns=$(".filtered-posts").attr("data-columns");
$(".filtered-posts").find(".et_pb_column").addClass(columns)
$(window).click(function (){
$(".et_pb_de_mach_search_posts_item").removeClass("visible");
});
$('.et_pb_de_mach_search_posts_item').click(function (event){
event.stopPropagation();
});
$(".dmach-filer-toggle .et_pb_contact_field_options_title ").click(function (e){
if($(this).closest(".et_pb_de_mach_search_posts_item").hasClass("visible")){
$(".et_pb_de_mach_search_posts_item").removeClass("visible");
}else{
$(".et_pb_de_mach_search_posts_item").removeClass("visible");
$(this).closest(".et_pb_de_mach_search_posts_item").addClass("visible");
}});
$('.dmach-tag-cloud a').click(function (e){
var theClass=$(this).attr("class").match(/tag-link-[\w-]*\b/);
$(this).closest(".dmach-tag-cloud").find("select").val(theClass);
$(this).closest(".dmach-tag-cloud").find("select").trigger("change");
});
get_post_popup();
});
jQuery(document).on('click', '.dmach-popup .modal-close', function (e){
e.preventDefault();
var $modal=jQuery(this).closest('.dmach-popup');
pauseAllVideosInModal($modal);
$modal.removeClass('open');
jQuery('html').css('overflow', 'auto');
jQuery('a').css('pointer-events','none');
setTimeout(
function(){
jQuery('a').css('pointer-events','');
}, 100);
});
jQuery(document).on('touchstart click', '.dmach-popup', function (){
var $modal=jQuery(this).closest('.dmach-popup');
pauseAllVideosInModal($modal);
$modal.removeClass('open');
jQuery('html').css('overflow', 'auto');
jQuery('a').css('pointer-events','none');
setTimeout(
function(){
jQuery('a').css('pointer-events','');
}, 100);
});
jQuery(document).on('touchstart click', '.post-modal-cont', function (event){
event.stopPropagation();
});
jQuery(document).on('touchstart click', '.dmach-next-post', function (event){
var $currentModal=jQuery(this).closest('.dmach-popup');
if($currentModal.next('.dmach-popup').length){
pauseAllVideosInModal($currentModal);
$currentModal.removeClass('open');
$currentModal.next('.dmach-popup').addClass('open');
}else{
pauseAllVideosInModal($currentModal);
$currentModal.removeClass('open');
jQuery('html').css('overflow', 'auto');
}});
jQuery(document).on('touchstart click', '.dmach-prev-post', function (event){
var $currentModal=jQuery(this).closest('.dmach-popup');
if($currentModal.prev('.dmach-popup').length){
pauseAllVideosInModal($currentModal);
$currentModal.removeClass('open');
$currentModal.prev('.dmach-popup').addClass('open');
}else{
pauseAllVideosInModal($currentModal);
$currentModal.removeClass('open');
jQuery('html').css('overflow', 'auto');
}});
function get_post_popup(){
jQuery('.dmach-popup').remove();
if(jQuery('.show_modal').length > 0){
var modal_style=jQuery('.show_modal').eq(0).attr('data-modal-style');
var post_ids=[];
var modal_layouts=[];
var modal_posttypes=[];
var post_type=jQuery('.show_modal').eq(0).closest('.divi-filter-archive-loop').attr('data-posttype');
if(!post_type||post_type==='auto'){
post_type=jQuery('.show_modal').eq(0).attr('data-modal-postype');
}
jQuery('.show_modal').each(function (){
var post_id=jQuery(this).attr('data-id');
var modal_layout=jQuery(this).attr('data-modal-layout');
var modal_postype=jQuery(this).attr('data-modal-postype');
var m_index=modal_layouts.indexOf(modal_layout);
if(m_index!=-1){
post_ids[m_index].push(post_id);
}else{
modal_layouts.push(modal_layout);
modal_posttypes.push(modal_postype);
post_ids.push([post_id]);
}});
if(jQuery(".et-l--body").length){
jQuery('.et-l--body').append('<div id="dmach-modal-wrapper" class="' + modal_style + ' loading"><div id="loading-modal" modallayout-id="" modaldata-id="" class="dmach-popup"><div class="post-modal-cont"><div class="modal-close"></div><div class="et_pb_section"><div class="et_pb_row"><div class="et_pb_column et_pb_column_4_4"><div class="filtered-posts-loading load-3"><span class="line"></span><span class="line"></span><span class="line"></span></div></div></div></div></div></div></div>');
}else{
jQuery('#page-container').append('<div id="dmach-modal-wrapper" class="' + modal_style + ' loading"><div id="loading-modal" modallayout-id="" modaldata-id="" class="dmach-popup"><div class="post-modal-cont"><div class="modal-close"></div><div class="et_pb_section"><div class="et_pb_row"><div class="et_pb_column et_pb_column_4_4"><div class="filtered-posts-loading load-3"><span class="line"></span><span class="line"></span><span class="line"></span></div></div></div></div></div></div></div>');
}
var data={
'action': 'divi_filter_get_post_modal_ajax_handler',
'security': filter_ajax_object.security,
'post_ids': JSON.stringify(post_ids),
'post_type': post_type,
'modal_layout': JSON.stringify(modal_layouts),
'modal_postype': JSON.stringify(modal_posttypes)
};
jQuery("body").addClass("hide_update_content_modal");
jQuery('.show_modal').click(function (event){
event.preventDefault();
event.stopPropagation();
var update_content_show_start=jQuery(this).attr('update_content_show_start');
if(update_content_show_start=="off"){
jQuery("body").removeClass("hide_update_content_modal");
}
var data_id=jQuery(this).attr('data-id');
var loading_animation_color=jQuery(this).attr('loading_animation_color');
var modal_type=jQuery(this).attr('modal_type');
var modal_layout=jQuery(this).attr('data-modal-layout');
if(modal_type=="update_content"){
jQuery('.dmach_content_update').each(function(){
pauseAllVideosInModal(jQuery(this));
jQuery(this).hide();
jQuery(this).removeClass('open');
});
if(jQuery('#post-modal-' + modal_layout + '-' + data_id).length){
jQuery('#post-modal-' + modal_layout + '-' + data_id).addClass('open');
}else{
jQuery('#loading-modal').attr('modaldata-id', data_id);
jQuery('#loading-modal').attr('modallayout-id', modal_layout);
jQuery('#loading-modal').addClass('open');
}
var $scrolltosection=jQuery('.dmach_content_update_cont'),
scrollto_fine_tune='0px',
scrollto_fine_tune_dis=parseInt(scrollto_fine_tune);
jQuery('html, body').animate({
scrollTop: $scrolltosection.offset().top - scrollto_fine_tune_dis
}, 500);
}else{
if(loading_animation_color!==""){
jQuery('#loading-modal .line').each(function (i, obj){
jQuery(this).css('background-color', loading_animation_color);
});
}
if(jQuery('#post-modal-' + modal_layout + '-' + data_id).length){
jQuery('#post-modal-' + modal_layout + '-' + data_id).addClass('open');
}else{
jQuery('#loading-modal').attr('modaldata-id', data_id);
jQuery('#loading-modal').attr('modallayout-id', modal_layout);
jQuery('#loading-modal').addClass('open');
}
jQuery('html').css('overflow', 'hidden');
}});
jQuery.ajax({
url: filter_ajax_object.ajax_url,
data: data,
type: 'POST',
dataType: 'JSON',
success: function (data){
var pending_modal_data_id=jQuery('#loading-modal').attr('modaldata-id');
var pending_modal_layout_id=jQuery('#loading-modal').attr('modallayout-id');
var was_loading=jQuery("#dmach-modal-wrapper").hasClass('loading');
jQuery('body').find('#dmach-modal-wrapper:not(.loading)').remove();
jQuery('#loading-modal').remove();
if(jQuery("#dmach-modal-wrapper.loading").length){
}else{
if(jQuery(".et-l--body").length){
jQuery('.et-l--body').append('<div id="dmach-modal-wrapper" class="' + modal_style + '"></div>');
}else{
jQuery('#page-container').append('<div id="dmach-modal-wrapper" class="' + modal_style + '"></div>');
}}
jQuery('.show_modal').each(function (){
var data_id=jQuery(this).attr('data-id');
var modal_type=jQuery(this).attr('modal_type');
var update_content_pos=jQuery(this).attr('update_content_pos');
var cur_modal_layout=jQuery(this).attr('data-modal-layout');
if(modal_type=="update_content"){
if(update_content_pos=="above"){
jQuery('.update_content_loop .dmach-before-posts').addClass('dmach_content_update_cont');
jQuery('.update_content_loop .dmach-before-posts').append('<div id="post-modal-' + cur_modal_layout + '-' + data_id + '" class="dmach_content_update"><div class="post-modal-cont">' + data['content']['show_modal_' + cur_modal_layout + '_' + data_id] + '</div></div>');
}else{
jQuery('.update_content_loop .dmach-after-posts').addClass('dmach_content_update_cont');
jQuery('.update_content_loop .dmach-after-posts').append('<div id="post-modal-' + cur_modal_layout + '-' + data_id + '" class="dmach_content_update"><div class="post-modal-cont">' + data['content']['show_modal_' + cur_modal_layout + '_' + data_id] + '</div></div>');
}}else{
jQuery('#dmach-modal-wrapper').append('<div id="post-modal-' + cur_modal_layout + '-' + data_id + '" class="dmach-popup"><div class="post-modal-cont"><div class="modal-close"></div>' + data['content']['show_modal_' + cur_modal_layout + '_' + data_id] + '<div class="dmach-nextprev-post"><div class="dmach-prev-post"></div><div class="dmach-next-post"></div></div></div></div>');
}
if(jQuery('#post-modal-' + cur_modal_layout + '-' + data_id).find('.et_pb_map_container').length > 0){
jQuery('#post-modal-' + cur_modal_layout + '-' + data_id).find('.et_pb_map_container').each(function (){
var $mapContainer=jQuery(this);
if(typeof et_pb_map_init!=="function"){
var mapInterval=setInterval(function (){
if(typeof et_pb_map_init==="function"){
et_pb_map_init($mapContainer);
clearInterval(mapInterval);
}}, 1000);
}else{
et_pb_map_init($mapContainer);
}});
}});
if(was_loading&&pending_modal_data_id&&pending_modal_layout_id){
jQuery('#dmach-modal-wrapper').removeClass('loading');
jQuery('#post-modal-' + pending_modal_layout_id + '-' + pending_modal_data_id).addClass('open');
}
jQuery('#dmach-modal-wrapper').append(data.css_output);
jQuery(".dmach-popup").each(function (){
var $popup=jQuery(this);
$popup.find(".et_pb_de_mach_acf_slider_containter").each(function (){
var $sliderContainer=jQuery(this);
var sliderID=$sliderContainer.attr("id");
if(sliderID){
var $galleryVarsElement=$popup.find(".gallery_vars");
if($galleryVarsElement.length > 0){
var galleryVars=$galleryVarsElement.attr("data-gallery_vars");
var galleryType=$galleryVarsElement.attr("data-gallery_type");
if(galleryVars){
galleryVars=galleryVars.replace(/,\s*$/, "");
galleryVars=galleryVars.replace(/,/g, ", ");
galleryVars=galleryVars.replace(/'/g, '"');
galleryVars="{" + galleryVars + "}";
galleryVars=JSON.parse(galleryVars);
if($sliderContainer.hasClass("slick-initialized")){
$sliderContainer.slick("unslick");
}
$sliderContainer.slick(galleryVars);
}
if(galleryType==="gallery"){
var galleryNavVars=$galleryVarsElement.attr("data-gallery_nav");
if(galleryNavVars){
galleryNavVars=galleryNavVars.replace(/,\s*$/, "");
galleryNavVars=galleryNavVars.replace(/,/g, ", ");
galleryNavVars=galleryNavVars.replace(/'/g, '"');
galleryNavVars="{" + galleryNavVars + "}";
galleryNavVars=JSON.parse(galleryNavVars);
galleryNavVars.asNavFor="#" + sliderID;
galleryNavVars.focusOnSelect=true;
var $navContainer=$popup.find(".et_pb_de_mach_acf_slider_containter_nav");
if($navContainer.length > 0){
if($navContainer.hasClass("slick-initialized")){
$navContainer.slick("unslick");
}
$navContainer.slick(galleryNavVars);
}}
}}
}});
});
jQuery('#dmach-modal-wrapper .dmach-popup').each(function (i, obj){
if(jQuery(this).find('.wpcf7-form').length > 0){
wpcf7.init(jQuery(this).find('.wpcf7-form'));
}});
if("undefined"!=typeof wc_add_to_cart_variation_params){
jQuery(".variations_form").each(function(){
jQuery(this).wc_variation_form();
});
}
if(typeof jQuery.fn.magnificPopup!=='undefined'){
if(jQuery('.et_pb_de_mach_gallery_item').length > 0){
jQuery('.et_pb_gallery_image a').magnificPopup({
type: 'image'
});
}}else{
}
jQuery.event.trigger({
type: "divi_machine_modal_loaded",
});
}})
}}
function same_height_cards(){
jQuery('.same-height-cards .filtered-posts').each(function (){
var highestBox=0;
jQuery('.grid-col', this).each(function (){
if(jQuery(this).height() > highestBox){
highestBox=jQuery(this).height();
}});
var margin_bottom=jQuery(this).find(".et_pb_section").css("marginBottom");
jQuery('.grid-col', this).height(highestBox);
jQuery('.grid-col', this).css("margin-bottom", margin_bottom);
});
}
jQuery(document).ready(function($){
$('span.hidethis').each(function(){
var hide_option=$(this).attr('data-hide_option');
if(typeof hide_option!=="undefined"){
if(hide_option=="hide_parent_row"){
if($(this).parents('.et_section_specialty').length){
$(this).closest('.et_pb_row_inner').hide();
$(this).closest('.et_pb_row_inner').addClass('hidethis');
}else{
$(this).closest('.et_pb_row').hide();
$(this).closest('.et_pb_row').addClass('hidethis');
}}else if(hide_option=="hide_parent_section"){
$(this).closest(".et_pb_section").hide();
$(this).closest(".et_pb_section").addClass('hidethis');
}else if(hide_option=="hide_element"){
var target_selector=$(this).attr('data-hide_target');
var target_in_section=$(this).attr('data-hide_target_in_section');
if(typeof target_in_section!='undefined'&&target_in_section=="on"){
$(this).closest('.et_pb_section').find(target_selector).hide();
$(this).closest('.et_pb_section').find(target_selector).addClass('hidethis');
if(target_selector.indexOf('grid-item') > -1||target_selector.indexOf('grid-col') > -1||target_selector.indexOf('dmach-grid-item') > -1){
$(this).closest('.grid-item, .grid-col, .dmach-grid-item').hide();
$(this).closest('.grid-item, .grid-col, .dmach-grid-item').addClass('hidethis');
}}else{
$(target_selector).hide();
$(target_selector).addClass('hidethis');
}}
}});
jQuery(document).on('divi_filter_completed', function(){
jQuery('span.hidethis').each(function(){
var hide_option=jQuery(this).attr('data-hide_option');
if(typeof hide_option!=="undefined"){
if(hide_option=="hide_parent_row"){
if($(this).parents('.et_section_specialty').length){
$(this).closest('.et_pb_row_inner').hide();
$(this).closest('.et_pb_row_inner').addClass('hidethis');
}else{
$(this).closest('.et_pb_row').hide();
$(this).closest('.et_pb_row').addClass('hidethis');
}}else if(hide_option=="hide_parent_section"){
$(this).closest(".et_pb_section").hide();
$(this).closest(".et_pb_section").addClass('hidethis');
}else if(hide_option=="hide_element"){
var target_selector=$(this).attr('data-hide_target');
var target_in_section=$(this).attr('data-hide_target_in_section');
if(typeof target_in_section!='undefined'&&target_in_section=="on"){
$(this).closest('.et_pb_section').find(target_selector).hide();
$(this).closest('.et_pb_section').find(target_selector).addClass('hidethis');
if(target_selector.indexOf('grid-item') > -1||target_selector.indexOf('grid-col') > -1||target_selector.indexOf('dmach-grid-item') > -1){
$(this).closest('.grid-item, .grid-col, .dmach-grid-item').hide();
$(this).closest('.grid-item, .grid-col, .dmach-grid-item').addClass('hidethis');
}}else{
$(target_selector).hide();
$(target_selector).addClass('hidethis');
}}
}});
});
});
jQuery(document).ready(function ($){
var $et_pb_countdown_timer=$('.et_pb_countdown_timer');
window.et_countdown_timer=function(timer){
var end_date=parseInt(timer.attr('data-end-timestamp')),
current_date=new Date().getTime() / 1000,
seconds_left=(end_date - current_date);
days=parseInt(seconds_left / 86400);
days=days > 0 ? days:0;
seconds_left=seconds_left % 86400;
hours=parseInt(seconds_left / 3600);
hours=hours > 0 ? hours:0;
seconds_left=seconds_left % 3600;
minutes=parseInt(seconds_left / 60);
minutes=minutes > 0 ? minutes:0;
seconds=parseInt(seconds_left % 60);
seconds=seconds > 0 ? seconds:0;
var $days_section=timer.find('.days > .value').parent('.section'),
$hours_section=timer.find('.hours > .value').parent('.section'),
$minutes_section=timer.find('.minutes > .value').parent('.section'),
$seconds_section=timer.find('.seconds > .value').parent('.section');
if(days==0){
if(! $days_section.hasClass('zero')){
timer.find('.days > .value').html('000').parent('.section').addClass('zero').next().addClass('zero');
}}else{
days_slice=days.toString().length >=3 ? days.toString().length:3;
timer.find('.days > .value').html(('000' + days).slice(-days_slice));
if($days_section.hasClass('zero')){
$days_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0){
if(! $hours_section.hasClass('zero')){
timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}}else{
timer.find('.hours > .value').html(( '0' + hours).slice(-2));
if($hours_section.hasClass('zero')){
$hours_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0&&minutes==0){
if(! $minutes_section.hasClass('zero')){
timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}}else{
timer.find('.minutes > .value').html(( '0' + minutes).slice(-2));
if($minutes_section.hasClass('zero')){
$minutes_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0&&minutes==0&&seconds==0){
if(! $seconds_section.hasClass('zero')){
timer.find('.seconds > .value').html('00').parent('.section').addClass('zero');
}}else{
timer.find('.seconds > .value').html(( '0' + seconds).slice(-2));
if($seconds_section.hasClass('zero')){
$seconds_section.removeClass('zero').next().removeClass('zero');
}}
}
window.et_countdown_timer_labels=function(timer){
if(timer.closest('.et_pb_column_3_8').length||timer.closest('.et_pb_column_1_4').length||timer.children('.et_pb_countdown_timer_container').width() <=400){
timer.find('.days .label').html(timer.find('.days').data('short'));
timer.find('.hours .label').html(timer.find('.hours').data('short'));
timer.find('.minutes .label').html(timer.find('.minutes').data('short'));
timer.find('.seconds .label').html(timer.find('.seconds').data('short'));
}else{
timer.find('.days .label').html(timer.find('.days').data('full'));
timer.find('.hours .label').html(timer.find('.hours').data('full'));
timer.find('.minutes .label').html(timer.find('.minutes').data('full'));
timer.find('.seconds .label').html(timer.find('.seconds').data('full'));
}}
if($et_pb_countdown_timer.length){
window.et_pb_countdown_timer_init=function($et_pb_countdown_timer){
$et_pb_countdown_timer.each(function(){
var timer=$(this);
et_countdown_timer_labels(timer);
et_countdown_timer(timer);
setInterval(function(){
et_countdown_timer(timer);
}, 1000);
});
}
et_pb_countdown_timer_init($et_pb_countdown_timer);
}});
jQuery(document).ready(function ($){
jQuery(document).on('divi_filter_completed', function(){
var $et_pb_countdown_timer=$('.et_pb_countdown_timer');
if($et_pb_countdown_timer.length){
window.et_pb_countdown_timer_init=function($et_pb_countdown_timer){
$et_pb_countdown_timer.each(function(){
var timer=$(this);
et_countdown_timer_labels(timer);
et_countdown_timer(timer);
setInterval(function(){
et_countdown_timer(timer);
}, 1000);
});
}
et_pb_countdown_timer_init($et_pb_countdown_timer);
}
var $et_pb_tabs=$('.et_pb_tabs'),
is_frontend_builder=$('body').hasClass('et-fb');
if($et_pb_tabs.length||is_frontend_builder){
window.et_pb_tabs_init=function($et_pb_tabs){
var $et_pb_tabs_li=$et_pb_tabs.find('.et_pb_tabs_controls li');
$et_pb_tabs.et_pb_simple_slider({
use_controls:false,
use_arrows:false,
slide:'.et_pb_all_tabs > div',
tabs_animation:true
}).on('et_hashchange', function(event){
var params=event.params;
var $the_tabs=$('#' + event.target.id);
var active_tab=params[0];
if(!$the_tabs.find('.et_pb_tabs_controls li').eq(active_tab).hasClass('et_pb_tab_active')){
$the_tabs.find('.et_pb_tabs_controls li').eq(active_tab).click();
}});
$et_pb_tabs_li.click(function(){
var $this_el=$(this),
$tabs_container=$this_el.closest('.et_pb_tabs').data('et_pb_simple_slider');
if($tabs_container.et_animation_running) return false;
$this_el.addClass('et_pb_tab_active').siblings().removeClass('et_pb_tab_active');
$tabs_container.data('et_pb_simple_slider').et_slider_move_to($this_el.index());
if($this_el.closest('.et_pb_tabs').attr('id')){
var tab_state=[];
tab_state.push($this_el.closest('.et_pb_tabs').attr('id'));
tab_state.push($this_el.index());
tab_state=tab_state.join(et_hash_module_param_seperator);
et_set_hash(tab_state);
}
return false;
});
}
window.et_pb_tabs_init($et_pb_tabs);
}});
});
jQuery(document).ready(function ($){
function ajax_load_more_gallery($this, is_popup){
if($this.hasClass('loading')){
return false;
}
var $et_pb_gallery_grid=$this.closest('.et_pb_de_mach_acf_slider ');
var data_grid_image_ids=$et_pb_gallery_grid.find('.grid-item').attr('data-grid-image-ids');
var data_load_more_num=$et_pb_gallery_grid.find('.grid-item').attr('data-load-more-num');
var enable_lightbox=$et_pb_gallery_grid.find('.grid-item').attr('data-enable_lightbox');
var show_title_and_caption=$et_pb_gallery_grid.find('.grid-item').attr('data-show_title_and_caption');
var loading_text=$this.attr('data-loading_text');
var original_text=$this.text();
var data={
'action': 'divi_filter_load_more_gallery_ajax_handler',
'data_grid_image_ids': data_grid_image_ids,
'data_load_more_num': data_load_more_num,
'enable_lightbox': enable_lightbox,
'show_title_and_caption': show_title_and_caption
};
jQuery.ajax({
url: filter_ajax_object.ajax_url,
data: data,
type: 'POST',
dataType: 'JSON',
beforeSend: function (){
$this.addClass('loading');
$this.attr('disabled', 'disabled');
$this.text(loading_text);
},
success: function (data){
$this.removeClass('loading');
$et_pb_gallery_grid.find('.grid-item').attr('data-grid-image-ids', data['ids']);
$et_pb_gallery_grid.find('.grid-posts').append(data['content']);
$this.text(original_text);
if(data['data_load_more_num']==0){
$this.hide();
}
if(typeof jQuery.fn.magnificPopup!=='undefined'&&data['gallery_image_urls']!=''&&is_popup==true){
var mfp=jQuery.magnificPopup.instance;
jQuery.each(data['gallery_image_urls'], function(index, value){
mfp.items.push({
src: value
});
});
mfp.updateItemHTML();
}else{
}
if($et_pb_gallery_grid.find('.grid-item').hasClass('masonry')){
let classes=$et_pb_gallery_grid.find('.grid-item').attr('class');
let matches=classes.match(/col-(?:desk|tab|mob)-(\d+)/g);
let colNumbers=matches.map(m=> m.match(/\d+/)[0]);
var macyInstance=Macy({
container: $et_pb_gallery_grid.find('.grid-posts')[0],
trueOrder: false,
waitForImages: true,
margin: {
x: 25,
y: 25 
},
columns:  colNumbers[0],
breakAt: {
1200: colNumbers[0],
980: colNumbers[1],
767: colNumbers[2]
}});
macyInstance.recalculate();
$et_pb_gallery_grid.find('.masonry.et_pb_gallery_grid').addClass('loaded');
}}
});
}
$(document.body).on('click', '.et_pb_de_mach_load_more_button_link', function (e){
e.preventDefault();
var $this=$(this);
var is_popup=false;
ajax_load_more_gallery($this, is_popup);
});
$(document.body).on('click', '.mfp-arrow', function (e){
var current_src=$('.mfp-img').attr('src');
var second_last_src=$('.et_pb_gallery_items .grid-item:nth-last-child(2) img').attr('src');
if(current_src==second_last_src){
var $this=$('.et_pb_de_mach_load_more_button_link');
var is_popup=true;
ajax_load_more_gallery($this, is_popup);
}});
$(document).keydown(function(e){
switch(e.which){
case 39:
var current_src=$('.mfp-img').attr('src');
var second_last_src=$('.et_pb_gallery_items .grid-item:nth-last-child(2) img').attr('src');
if(current_src==second_last_src){
var $this=$('.et_pb_de_mach_load_more_button_link');
var is_popup=true;
ajax_load_more_gallery($this, is_popup);
}
break;
}});
});