PageSourceSearch

https://www.cablelabs.com/wp-content/plugins/divi-machine/js/frontend-general.min.js?ver=6.5.6

js cablelabs.com collected 2026-10-01 10:21:55 UTC 47,831 bytes, 1,089 lines download raw bytes

1
2
3function nitroThumb(e) {
4    return (
5      '<img src="' + document.getElementById(e).getAttribute("data-thumb") + '" alt="' + document.getElementById(e).getAttribute("data-thumbalt") + '">'
6      ).replace("ID", e) + '<a href="#" class="et_pb_video_play"></a>'
7  }
8  
9  function machineYoutubeFrame(event) {
10    event.preventDefault();
11    var iframe = document.createElement("iframe");
12    // Check if unmuted is enabled
13    var isUnmuted = this.dataset.unmuted === "1";
14    var muteParam = isUnmuted ? "&mute=0" : "&mute=1";
15    iframe.setAttribute(
16      "src",
17      "https://www.youtube.com/embed/" + this.dataset.id + "?autoplay=1" + muteParam + "&enablejsapi=1"
18    );
19    iframe.setAttribute("frameborder", "0");
20    iframe.setAttribute("allowfullscreen", "1");
21    iframe.setAttribute("allow", "autoplay; fullscreen");
22  
23    // Create wrapper just like fitVids
24    var wrapper = document.createElement("div");
25    wrapper.className = "fluid-width-video-wrapper";
26    wrapper.style.paddingTop = "56.25%";
27  
28    // Style iframe like fitVids does
29    iframe.style.position = "absolute";
30    iframe.style.top = "0";
31  
32    wrapper.appendChild(iframe);
33  
34    // Replace the thumbnail container with the wrapped iframe
35    this.parentNode.replaceWith(wrapper);
36  }
37  
38  function machineVimeoFrame(event) {
39    event.preventDefault();    
40
41    var e = document.createElement("iframe");
42    var videoId = this.dataset.id;
43    // Check if unmuted is enabled
44    var isUnmuted = this.dataset.unmuted === "1";
45    var mutedParam = isUnmuted ? "" : "&muted=1";
46
47    e.setAttribute("src", "https://player.vimeo.com/video/" + videoId + "?autoplay=1" + mutedParam);
48    e.setAttribute("frameborder", "0");
49    e.setAttribute("allow", "autoplay; fullscreen");
50    e.setAttribute("allowfullscreen", "1");
51
52    this.parentNode.replaceChild(e, this);    
53  }
54  
55  function initializeVideoListeners() {
56    var e, t, r = document.getElementsByClassName("de_demach_youtube_listener");
57    for (t = 0; t < r.length; t++) {
58        // Skip if already initialized
59        if (r[t].classList.contains('de_video_initialized')) continue;
60        r[t].classList.add('de_video_initialized');
61        
62        e = document.createElement("div");
63        e.setAttribute("data-id", r[t].dataset.id);
64        // Copy unmuted attribute if present
65        if (r[t].dataset.unmuted) {
66          e.setAttribute("data-unmuted", r[t].dataset.unmuted);
67        }
68        e.innerHTML = nitroThumb(r[t].dataset.id);
69        e.onclick = machineYoutubeFrame;
70        r[t].appendChild(e);
71    }
72  
73    r = document.getElementsByClassName("de_demach_vimeo_listener");
74    for (t = 0; t < r.length; t++) {
75        // Skip if already initialized
76        if (r[t].classList.contains('de_video_initialized')) continue;
77        r[t].classList.add('de_video_initialized');
78        
79        e = document.createElement("div");
80        e.setAttribute("data-id", r[t].dataset.id);
81        // Copy unmuted attribute if present
82        if (r[t].dataset.unmuted) {
83          e.setAttribute("data-unmuted", r[t].dataset.unmuted);
84        }
85        e.innerHTML = nitroThumb(r[t].dataset.id);
86        e.onclick = machineVimeoFrame;
87        r[t].appendChild(e);
88    }
89  }
90  
91  document.addEventListener("DOMContentLoaded", function() {
92    initializeVideoListeners();
93  });
94  
95  // Reinitialize listeners when the AJAX filter completes
96  jQuery(document).on('divi_filter_completed', function() {
97    initializeVideoListeners();
98  });
99
100  // Reinitialize listeners when modal content loads
101  jQuery(document).on('divi_machine_modal_loaded', function() {
102    initializeVideoListeners();
103  });
104  
105  // Function to pause all videos in a modal
106  function pauseAllVideosInModal($modal) {
107    if (!$modal || !$modal.length) {
108      console.log('pauseAllVideosInModal: No modal found');
109      return;
110    }
111    
112    // Also check inside post-modal-cont and other nested containers
113    var $searchContainer = $modal.find('.post-modal-cont').length ? $modal.find('.post-modal-cont') : $modal;
114    
115    var videoCount = $searchContainer.find('video').length;
116    var youtubeCount = $searchContainer.find('iframe[src*="youtube.com"], iframe[src*="youtu.be"]').length;
117    var vimeoCount = $searchContainer.find('iframe[src*="vimeo.com"]').length;
118    
119    console.log('pauseAllVideosInModal: Found', videoCount, 'HTML5 videos,', youtubeCount, 'YouTube iframes,', vimeoCount, 'Vimeo iframes');
120    
121    // Pause HTML5 video elements
122    $searchContainer.find('video').each(function() {
123      try {
124        if (this.pause) {
125          this.pause();
126        }
127      } catch (e) {
128        console.log('Could not pause HTML5 video:', e);
129      }
130    });
131    
132    // Pause YouTube iframes (check in modal and nested containers)
133    $searchContainer.find('iframe[src*="youtube.com"], iframe[src*="youtu.be"]').each(function() {
134      var iframe = this;
135      var originalSrc = iframe.src;
136      
137      if (!originalSrc) {
138        console.log('pauseAllVideosInModal: YouTube iframe has no src');
139        return;
140      }
141      
142      console.log('pauseAllVideosInModal: Attempting to pause YouTube video:', originalSrc);
143      
144      try {
145        // Method 1: Try postMessage API (works if enablejsapi=1 is in URL)
146        if (iframe.contentWindow && originalSrc.indexOf('enablejsapi=1') !== -1) {
147          console.log('pauseAllVideosInModal: Using postMessage for YouTube');
148          iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
149          // Also try stopVideo for good measure
150          iframe.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
151        } else {
152          console.log('pauseAllVideosInModal: enablejsapi not found, modifying src');
153          // Method 2: For videos without enablejsapi, we need to modify src to stop playback
154          // Extract video ID and rebuild URL without autoplay
155          var videoIdMatch = originalSrc.match(/(?:youtube\.com\/embed\/|youtu\.be\/)([^?&]+)/
155);
156          if (videoIdMatch && videoIdMatch[1]) {
157            var videoId = videoIdMatch[1];
158            // Rebuild URL with autoplay=0 to stop the video
159            var newSrc = 'https://www.youtube.com/embed/' + videoId + '?autoplay=0&enablejsapi=1';
160            iframe.src = newSrc;
161            console.log('pauseAllVideosInModal: Modified YouTube src to:', newSrc);
162          } else {
163            // Fallback: just remove autoplay
164            var modifiedSrc = originalSrc.replace(/[?&]autoplay=\d+/gi, '');
165            modifiedSrc += (modifiedSrc.indexOf('?') === -1 ? '?' : '&') + 'autoplay=0';
166            iframe.src = modifiedSrc;
167            console.log('pauseAllVideosInModal: Modified YouTube src (fallback) to:', modifiedSrc);
168          }
169        }
170      } catch (e) {
171        console.log('Could not pause YouTube video:', e);
172        // Last resort: try to stop by rebuilding src
173        try {
174          var videoIdMatch = originalSrc.match(/(?:youtube\.com\/embed\/|youtu\.be\/)([^?&]+)/);
175          if (videoIdMatch && videoIdMatch[1]) {
176            iframe.src = 'https://www.youtube.com/embed/' + videoIdMatch[1] + '?autoplay=0';
177          }
178        } catch (e2) {
179          console.log('Failed to stop YouTube video:', e2);
180        }
181      }
182    });
183    
184    // Pause Vimeo iframes (check in modal and nested containers)
185    $searchContainer.find('iframe[src*="vimeo.com"]').each(function() {
186      var iframe = this;
187      var originalSrc = iframe.src;
188      
189      if (!originalSrc) {
190        console.log('pauseAllVideosInModal: Vimeo iframe has no src');
191        return;
192      }
193      
194      console.log('pauseAllVideosInModal: Attempting to pause Vimeo video:', originalSrc);
195      
196      try {
197        // Method 1: Try postMessage API
198        if (iframe.contentWindow) {
199          console.log('pauseAllVideosInModal: Using postMessage for Vimeo');
200          iframe.contentWindow.postMessage('{"method":"pause"}', '*');
201        }
202        
203        // Method 2: Modify src to remove autoplay (rebuild URL to ensure it stops)
204        var videoIdMatch = originalSrc.match(/vimeo\.com\/video\/([^?&]+)/);
205        if (videoIdMatch && videoIdMatch[1]) {
206          var videoId = videoIdMatch[1];
207          // Rebuild URL with autoplay=0 to stop the video
208          var newSrc = 'https://player.vimeo.com/video/' + videoId + '?autoplay=0';
209          if (originalSrc.indexOf('muted') !== -1) {
210            newSrc += '&muted=1';
211          }
212          iframe.src = newSrc;
213          console.log('pauseAllVideosInModal: Modified Vimeo src to:', newSrc);
214        } else {
215          // Fallback: just modify autoplay
216          var modifiedSrc = originalSrc.replace(/[?&]autoplay=\d+/gi, '');
217          modifiedSrc += (modifiedSrc.indexOf('?') === -1 ? '?' : '&') + 'autoplay=0';
218          iframe.src = modifiedSrc;
219          console.log('pauseAllVideosInModal: Modified Vimeo src (fallback) to:', modifiedSrc);
220        }
221      } catch (e) {
222        console.log('Could not pause Vimeo video:', e);
223        // Last resort: try to stop by rebuilding src
224        try {
225          var videoIdMatch = originalSrc.match(/vimeo\.com\/video\/([^?&]+)/);
226          if (videoIdMatch && videoIdMatch[1]) {
227            iframe.src = 'https://player.vimeo.com/video/' + videoIdMatch[1] + '?autoplay=0';
228          }
229        } catch (e2) {
230          console.log('Failed to stop Vimeo video:', e2);
231        }
232      }
233    });
234  }
235    
236    jQuery(document).ready(function ($) {
237    
238      /*$(document.body).on('click', '.et_pb_de_mach_search_posts .et_pb_button', function () {
239        $(this).closest(".et_pb_de_mach_search_posts").find("#dmach-search-form").submit();
240      });*/
241    
242    
243    
244      /*  $(document).on('click', '.show_modal', function(e){
245          e.preventDefault();
246          e.stopPropagation();
247          var srcContent = $($(this).attr('data-mfp-src')).html();
248          $.magnificPopup.open({
249          items: {
250            src: srcContent, // can be a HTML string, jQuery object, or CSS selector
251            type: 'inline'
252          }
253        });
254        });*/
255    
256      if (typeof jQuery.fn.magnificPopup !== 'undefined') {
257          $('.et_pb_de_mach_gallery_trigger').magnificPopup({
258              type:'inline',
259              midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
260          });
261      }
262    
263      $(document.body).on('click', '.dmach-link-whole-grid-card', function () {
264        var url = $(this).data("link-url");
265        window.location.href = url;
266      });
267    
268    
269    
270      main_count = Number(0);
271    
272      $('.dmach-search-items').each(function (i, obj) {
273        main_count = Number(0);
274        $(this).children('.et_pb_de_mach_search_posts_item').each(function (i, obj) {
275          var count = Number($(this).find(".search_filter_cont").attr("data-count"));
276          main_count = main_count + count;
277          if (main_count >= "100") {
278            $(this).addClass("last-item");
279            main_count = Number(0);
280          }
281    
282        });
283      });
284    
285    
286      $(".search_filter_cont").removeClass("hidden");
287      $(".button_container").removeClass("hidden");
288    
289      $('#select_post_types').on('change', function () {
290        var post_type_change = this.value;
291        $("#search_post_type").val(post_type_change);
292    
293      });
294    
295      // end
296    
297      var columns = $(".filtered-posts").attr("data-columns");
298      $(".filtered-posts").find(".et_pb_column").addClass(columns)
299    
300      $(window).click(function () {
301        $(".et_pb_de_mach_search_posts_item").removeClass("visible");
302      });
303    
304      $('.et_pb_de_mach_search_posts_item').click(function (event) {
305        event.stopPropagation();
306      });
307    
308      $(".dmach-filer-toggle .et_pb_contact_field_options_title ").click(function (e) {
309    
310        if ($(this).closest(".et_pb_de_mach_search_posts_item").hasClass("visible")) {
311          $(".et_pb_de_mach_search_posts_item").removeClass("visible");
312        } else {
313          $(".et_pb_de_mach_search_posts_item").removeClass("visible");
314          $(this).closest(".et_pb_de_mach_search_posts_item").addClass("visible");
315        }
316    
317      });
318    
319      $('.dmach-tag-cloud a').click(function (e) {
320    
321        var theClass = $(this).attr("class").match(/tag-link-[\w-]*\b/);
322    
323        $(this).closest(".dmach-tag-cloud").find("select").val(theClass);
324        $(this).closest(".dmach-tag-cloud").find("select").trigger("change");
325    
326      });
327    
328    
329      get_post_popup();
330    
331    });
332    
333    jQuery(document).on('click', '.dmach-popup .modal-close', function (e) {
334      e.preventDefault();
335      var $modal = jQuery(this).closest('.dmach-popup');
336      pauseAllVideosInModal($modal);
337      $modal.removeClass('open');
338      jQuery('html').css('overflow', 'auto');
339      jQuery('a').css('pointer-events','none');
340      setTimeout(
341        function() 
342        {
343          jQuery('a').css('pointer-events','');
344        }, 100);
345    });
346    
347    jQuery(document).on('touchstart click', '.dmach-popup', function () {
348      var $modal = jQuery(this).closest('.dmach-popup');
349      pauseAllVideosInModal($modal);
350      $modal.removeClass('open');
351      jQuery('html').css('overflow', 'auto');
352      jQuery('a').css('pointer-events','none');
353      setTimeout(
354        function() 
355        {
356          jQuery('a').css('pointer-events','');
357        }, 100);
358    });
359    
360    
361    jQuery(document).on('touchstart click', '.post-modal-cont', function (event) {
362      event.stopPropagation();
363    });
364    
365    jQuery(document).on('touchstart click', '.dmach-next-post', function (event) {
366      var $currentModal = jQuery(this).closest('.dmach-popup');
367      if ($currentModal.next('.dmach-popup').length) {
368        pauseAllVideosInModal($currentModal);
369        $currentModal.removeClass('open');
370        $currentModal.next('.dmach-popup').addClass('open');
371      } else {
372        pauseAllVideosInModal($currentModal);
373        $currentModal.removeClass('open');
374        jQuery('html').css('overflow', 'auto');
375      }
376    });
377    
378    
379    jQuery(document).on('touchstart click', '.dmach-prev-post', function (event) {
380      var $currentModal = jQuery(this).closest('.dmach-popup');
381      if ($currentModal.prev('.dmach-popup').length) {
382        pauseAllVideosInModal($currentModal);
383        $currentModal.removeClass('open');
384        $currentModal.prev('.dmach-popup').addClass('open');
385      } else {
386        pauseAllVideosInModal($currentModal);
387        $currentModal.removeClass('open');
388        jQuery('html').css('overflow', 'auto');
389      }
390    });
391    
392    
393    function get_post_popup() {
394      jQuery('.dmach-popup').remove();
395      if (jQuery('.show_modal').length > 0) {
396    
397        var modal_style = jQuery('.show_modal').eq(0).attr('data-modal-style');
398    
399        var post_ids = [];
400        var modal_layouts = [];
401        var modal_posttypes = [];
402        // FIX: Get post_type from archive loop, fallback to button's data-modal-postype for single page usage
403        var post_type = jQuery('.show_modal').eq(0).closest('.divi-filter-archive-loop').attr('data-posttype');
404        if (!post_type || post_type === 'auto') {
405          post_type = jQuery('.show_modal').eq(0).attr('data-modal-postype');
406        }
407        jQuery('.show_modal').each(function () {
408          var post_id = jQuery(this).attr('data-id');
409          var modal_layout = jQuery(this).attr('data-modal-layout');
410          var modal_postype = jQuery(this).attr('data-modal-postype');
411          var m_index = modal_layouts.indexOf( modal_layout );
412          if ( m_index != -1 ) {
413            post_ids[m_index].push( post_id );
414          } else {
415            modal_layouts.push( modal_layout );
416            modal_posttypes.push( modal_postype );
417            post_ids.push([post_id]);
418          }
419        });
420    
421        if (jQuery(".et-l--body").length) {
422          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>');
423        } else {
424          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>');
425        }
426    
427        var data = {
428          'action': 'divi_filter_get_post_modal_ajax_handler',
429          'security': filter_ajax_object.security,
430          'post_ids': JSON.stringify(post_ids),
431          'post_type': post_type,
432          'modal_layout': JSON.stringify(modal_layouts),
433          'modal_postype': JSON.stringify(modal_posttypes)
434        };
435    
436        jQuery("body").addClass("hide_update_content_modal");
437    
438        jQuery('.show_modal').click(function (event) {
439          event.preventDefault();
440          event.stopPropagation();
441    
442          var update_content_show_start = jQuery(this).attr('update_content_show_start');
443    
444          if (update_content_show_start == "off") {
445            jQuery("body").removeClass("hide_update_content_modal");
446          }
447    
448          var data_id = jQuery(this).attr('data-id');
449          var loading_animation_color = jQuery(this).attr('loading_animation_color');
450          var modal_type = jQuery(this).attr('modal_type');
451          var modal_layout = jQuery(this).attr('data-modal-layout');
452    
453          if (modal_type == "update_content") {
454             
455              jQuery('.dmach_content_update').each(function() {
456                  // Pause videos before hiding
457                  pauseAllVideosInModal(jQuery(this));
458                  jQuery(this).hide();
459                  jQuery(this).removeClass('open');
460              });
461    
462              if (jQuery('#post-modal-' + modal_layout + '-' + data_id).length) {
463                  jQuery('#post-modal-' + modal_layout + '-' + data_id).addClass('open');
464              } else {
465                  jQuery('#loading-modal').attr('modaldata-id', data_id);
466                  jQuery('#loading-modal').attr('modallayout-id', modal_layout);
467                  jQuery('#loading-modal').addClass('open');
468              }
469    
470              var $scrolltosection = jQuery('.dmach_content_update_cont'),
471              scrollto_fine_tune = '0px',
472              scrollto_fine_tune_dis = parseInt(scrollto_fine_tune);
473    
474              jQuery('html, body').animate({
475                scrollTop: $scrolltosection.offset().top - scrollto_fine_tune_dis
476              }, 500);
477    
478          } else {
479              if (loading_animation_color !== "") {
480                  jQuery('#loading-modal .line').each(function (i, obj) {
481                      jQuery(this).css('background-color', loading_animation_color);
482                  });
483              }
484    
485              if (jQuery('#post-modal-' + modal_layout + '-' + data_id).length) {
486                  jQuery('#post-modal-' + modal_layout + '-' + data_id).addClass('open');
487              } else {
488                  jQuery('#loading-modal').attr('modaldata-id', data_id);
489                  jQuery('#loading-modal').attr('modallayout-id', modal_layout);
490                  jQuery('#loading-modal').addClass('open');
491              }
492              jQuery('html').css('overflow', 'hidden');
493          }
494        });
495    
496        jQuery.ajax({
497          url: filter_ajax_object.ajax_url, // AJAX handler
498          data: data,
499          type: 'POST',
500          dataType: 'JSON',
501          success: function (data) {
502    
503              // FIX: Save loading modal attributes BEFORE removing it
504              var pending_modal_data_id = jQuery('#loading-modal').attr('modaldata-id');
505              var pending_modal_layout_id = jQuery('#loading-modal').attr('modallayout-id');
506              var was_loading = jQuery("#dmach-modal-wrapper").hasClass('loading');
507
508              jQuery('body').find('#dmach-modal-wrapper:not(.loading)').remove();
509              jQuery('#loading-modal').remove();
510    
511              if (jQuery("#dmach-modal-wrapper.loading").length) {
512              } else {
513                if (jQuery(".et-l--body").length) {
514                    jQuery('.et-l--body').append('<div id="dmach-modal-wrapper" class="' + modal_style + '"></div>');
515                } else {
516                    jQuery('#page-container').append('<div id="dmach-modal-wrapper" class="' + modal_style + '"></div>');
517                }
518              }
519    
520              jQuery('.show_modal').each(function () {
521    
522                var data_id = jQuery(this).attr('data-id');
523                var modal_type = jQuery(this).attr('modal_type');
524                var update_content_pos = jQuery(this).attr('update_content_pos');
525                var cur_modal_layout = jQuery(this).attr('data-modal-layout');
526    
527                if (modal_type == "update_content") {
528                    if (update_content_pos == "above") {
529                        jQuery('.update_content_loop .dmach-before-posts').addClass('dmach_content_update_cont');
530                        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>');
531                    } else {
532                        jQuery('.update_content_loop .dmach-after-posts').addClass('dmach_content_update_cont');
533                        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>');
534      
535                    }
536                } else {
537                    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>');
538                }
539    
540          // FIX: Fixed map initialization - use local variables instead of nested object access
541          if (jQuery('#post-modal-' + cur_modal_layout + '-' + data_id).find('.et_pb_map_container').length > 0) {
542            jQuery('#post-modal-' + cur_modal_layout + '-' + data_id).find('.et_pb_map_container').each(function () {
543              var $mapContainer = jQuery(this);
544              if (typeof et_pb_map_init !== "function") {
545                var mapInterval = setInterval(function () {
546                  if (typeof et_pb_map_init === "function") {
547                    et_pb_map_init($mapContainer);
548                    clearInterval(mapInterval);
549                  }
550                }, 1000);
551              } else {
552                et_pb_map_init($mapContainer);
553              }
554            });
555          }
556              });
557    
558        // FIX: Use saved attributes instead of reading from removed element
559        if (was_loading && pending_modal_data_id && pending_modal_layout_id) {
560          jQuery('#dmach-modal-wrapper').removeClass('loading');
561          jQuery('#post-modal-' + pending_modal_layout_id + '-' + pending_modal_data_id).addClass('open');
562        }
563    
564            jQuery('#dmach-modal-wrapper').append(data.css_output);
565    
566            jQuery(".dmach-popup").each(function () {
567              var $popup = jQuery(this);
568              
569              $popup.find(".et_pb_de_mach_acf_slider_containter").each(function () {
570                var $sliderContainer = jQuery(this);
571                var sliderID = $sliderContainer.attr("id"); // Get the ID of the container
572                
573                if (sliderID) {
574                  // Find gallery vars associated with this popup
575                  var $galleryVarsElement = $popup.find(".gallery_vars");
576                  
577                  if ($galleryVarsElement.length > 0) {
578                    var galleryVars = $galleryVarsElement.attr("data-gallery_vars");
579                    var galleryType = $galleryVarsElement.attr("data-gallery_type");
580            
581                    if (galleryVars) {
582                      // Clean and parse gallery_vars
583                      galleryVars = galleryVars.replace(/,\s*$/, "");
584                      galleryVars = galleryVars.replace(/,/g, ", ");
585                      galleryVars = galleryVars.replace(/'/g, '"');
586                      galleryVars = "{" + galleryVars + "}";
587                      galleryVars = JSON.parse(galleryVars);
588            
589                      // Apply Slick to the container
590                      if ($sliderContainer.hasClass("slick-initialized")) {
591                        $sliderContainer.slick("unslick");
592                      }
593                      $sliderContainer.slick(galleryVars);
594                    }
595            
596                    // If gallery_type is 'gallery', handle the navigation slider
597                    if (galleryType === "gallery") {
598                      var galleryNavVars = $galleryVarsElement.attr("data-gallery_nav");
599            
600                      if (galleryNavVars) {
601                        // Clean and parse gallery_nav_vars
602                        galleryNavVars = galleryNavVars.replace(/,\s*$/, "");
603                        galleryNavVars = galleryNavVars.replace(/,/g, ", ");
604                        galleryNavVars = galleryNavVars.replace(/'/g, '"');
605                        galleryNavVars = "{" + galleryNavVars + "}";
606                        galleryNavVars = JSON.parse(galleryNavVars);
607            
608                        // Set navigation-specific properties
609                        galleryNavVars.asNavFor = "#" + sliderID;
610                        galleryNavVars.focusOnSelect = true;
611            
612                        // Find the navigation container and apply Slick
613                        var $navContainer = $popup.find(".et_pb_de_mach_acf_slider_containter_nav");
614            
615                        if ($navContainer.length > 0) {
616                          if ($navContainer.hasClass("slick-initialized")) {
617                            $navContainer.slick("unslick");
618                          }
619                          $navContainer.slick(galleryNavVars);
620                        }
621                      }
622                    }
623                  }
624                }
625              });
626            });
627    
628            jQuery('#dmach-modal-wrapper .dmach-popup').each(function (i, obj) {
629              if (jQuery(this).find('.wpcf7-form').length > 0) {
630                wpcf7.init(jQuery(this).find('.wpcf7-form'));
631              }
632            });
633    
634            if ( "undefined" != typeof wc_add_to_cart_variation_params ) {
635              jQuery(".variations_form").each(function() {
636                  jQuery(this).wc_variation_form();
637              });
638            } 
639  
640            if (typeof jQuery.fn.magnificPopup !== 'undefined') {
641              if (jQuery('.et_pb_de_mach_gallery_item').length > 0) {
642                // reinitalize magnific popup
643                jQuery('.et_pb_gallery_image a').magnificPopup({ 
644                  type: 'image'
645                });
646              }
647            } else {
648            }
649    
650            jQuery.event.trigger({
651              type: "divi_machine_modal_loaded",
652            });
653    
654          }
655        })
656      }
657    }
658    
659    function same_height_cards() {
660      jQuery('.same-height-cards .filtered-posts').each(function () {
661    
662        // Cache the highest
663        var highestBox = 0;
664    
665        // Select and loop the elements you want to equalise
666        jQuery('.grid-col', this).each(function () {
667          // If this box is higher than the cached highest then store it
668          if (jQuery(this).height() > highestBox) {
669            highestBox = jQuery(this).height();
670          }
671        });
672    
673        var margin_bottom = jQuery(this).find(".et_pb_section").css("marginBottom");
674    
675        // Set the height of all those children to whichever was highest
676        jQuery('.grid-col', this).height(highestBox);
677        jQuery('.grid-col', this).css("margin-bottom", margin_bottom);
678      });
679    }
680    
681    jQuery(document).ready(function($){
682      $('span.hidethis').each(function(){
683        var hide_option = $(this).attr('data-hide_option');
684        if ( typeof hide_option !== "undefined" ) {
685          if ( hide_option == "hide_parent_row" ) {
686              if ($(this).parents('.et_section_specialty').length) {
687                  $(this).closest('.et_pb_row_inner').hide();
688                  $(this).closest('.et_pb_row_inner').addClass('hidethis');
689              } else {
690                  $(this).closest('.et_pb_row').hide();
691                  $(this).closest('.et_pb_row').addClass('hidethis');
692              }
693          } else if ( hide_option == "hide_parent_section") {
694              $(this).closest(".et_pb_section").hide();
695              $(this).closest(".et_pb_section").addClass('hidethis');
696          } else if ( hide_option == "hide_element" ) {
697              var target_selector = $(this).attr('data-hide_target');
698              var target_in_section = $(this).attr('data-hide_target_in_section');
699      
700              if ( typeof target_in_section != 'undefined' && target_in_section == "on" ) {
701                  $(this).closest('.et_pb_section').find(target_selector).hide();
702                  $(this).closest('.et_pb_section').find(target_selector).addClass('hidethis');
703      
704                  // Check if target_selector includes 'grid-item' or 'grid-col'
705                  if ( target_selector.indexOf('grid-item') > -1 || target_selector.indexOf('grid-col') > -1 || target_selector.indexOf('dmach-grid-item') > -1 ) {
706                      $(this).closest('.grid-item, .grid-col, .dmach-grid-item').hide();
707                      $(this).closest('.grid-item, .grid-col, .dmach-grid-item').addClass('hidethis');
708                  }
709      
710              } else {
711                  $(target_selector).hide();
712                  $(target_selector).addClass('hidethis');
713              }
714          }
715        }
716      
717      });
718      jQuery(document).on('divi_filter_completed', function(){
719        jQuery('span.hidethis').each(function(){
720          var hide_option = jQuery(this).attr('data-hide_option');
721          if ( typeof hide_option !== "undefined" ) {
722            if ( hide_option == "hide_parent_row" ) {
723                if ($(this).parents('.et_section_specialty').length) {
724                    $(this).closest('.et_pb_row_inner').hide();
725                    $(this).closest('.et_pb_row_inner').addClass('hidethis');
726                } else {
727                    $(this).closest('.et_pb_row').hide();
728                    $(this).closest('.et_pb_row').addClass('hidethis');
729                }
730            } else if ( hide_option == "hide_parent_section") {
731                $(this).closest(".et_pb_section").hide();
732                $(this).closest(".et_pb_section").addClass('hidethis');
733            } else if ( hide_option == "hide_element" ) {
734                var target_selector = $(this).attr('data-hide_target');
735                var target_in_section = $(this).attr('data-hide_target_in_section');
736        
737                if ( typeof target_in_section != 'undefined' && target_in_section == "on" ) {
738                    $(this).closest('.et_pb_section').find(target_selector).hide();
739                    $(this).closest('.et_pb_section').find(target_selector).addClass('hidethis');
740        
741                    // Check if target_selector includes 'grid-item' or 'grid-col'
742                    if ( target_selector.indexOf('grid-item') > -1 || target_selector.indexOf('grid-col') > -1 || target_selector.indexOf('dmach-grid-item') > -1 ) {
743                        $(this).closest('.grid-item, .grid-col, .dmach-grid-item').hide();
744                        $(this).closest('.grid-item, .grid-col, .dmach-grid-item').addClass('hidethis');
745                    }
746        
747                } else {
748                    $(target_selector).hide();
749                    $(target_selector).addClass('hidethis');
750                }
751            }
752          }
753        });
754      });
755    });
756    
757    
758    
759    
760    
761    
762    jQuery(document).ready(function ($) {
763    var $et_pb_countdown_timer = $( '.et_pb_countdown_timer' );   
764        window.et_countdown_timer = function( timer ) {
765                    var end_date = parseInt( timer.attr( 'data-end-timestamp') ),
766                        current_date = new Date().getTime() / 1000,
767                        seconds_left = ( end_date - current_date );
768    
769                    days = parseInt(seconds_left / 86400);
770                    days = days > 0 ? days : 0;
771                    seconds_left = seconds_left % 86400;
772    
773                    hours = parseInt(seconds_left / 3600);
774                    hours = hours > 0 ? hours : 0;
775    
776                    seconds_left = seconds_left % 3600;
777    
778                    minutes = parseInt(seconds_left / 60);
779                    minutes = minutes > 0 ? minutes : 0;
780    
781                    seconds = parseInt(seconds_left % 60);
782                    seconds = seconds > 0 ? seconds : 0;
783    
784                    var $days_section = timer.find('.days > .value').parent('.section'),
785                        $hours_section = timer.find('.hours > .value').parent('.section'),
786                        $minutes_section = timer.find('.minutes > .value').parent('.section'),
787                        $seconds_section = timer.find('.seconds > .value').parent('.section');
788    
789    
790                    if ( days == 0 ) {
791                        if ( ! $days_section.hasClass('zero') ) {
792                            timer.find('.days > .value').html( '000' ).parent('.section').addClass('zero').next().addClass('zero');
793                        }
794                    } else {
795                        days_slice = days.toString().length >= 3 ? days.toString().length : 3;
796                        timer.find('.days > .value').html( ('000' + days).slice(-days_slice) );
797    
798                        if ( $days_section.hasClass('zero') ) {
799                            $days_section.removeClass('zero').next().removeClass('zero');
800                        }
801                    }
802    
803                    if ( days == 0 && hours == 0 ) {
804                        if ( ! $hours_section.hasClass('zero') ) {
805                            timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
806                        }
807                    } else {
808                        timer.find('.hours > .value').html( ( '0' + hours ).slice(-2) );
809    
810                        if ( $hours_section.hasClass('zero') ) {
811                            $hours_section.removeClass('zero').next().removeClass('zero');
812                        }
813                    }
814    
815                    if ( days == 0 && hours == 0 && minutes == 0 ) {
816                        if ( ! $minutes_section.hasClass('zero') ) {
817                            timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
818                        }
819                    } else {
820                        timer.find('.minutes > .value').html( ( '0' + minutes ).slice(-2) );
821    
822                        if ( $minutes_section.hasClass('zero') ) {
823                            $minutes_section.removeClass('zero').next().removeClass('zero');
824                        }
825                    }
826    
827                    if ( days == 0 && hours == 0 && minutes == 0 && seconds == 0 ) {
828                        if ( ! $seconds_section.hasClass('zero') ) {
829                            timer.find('.seconds > .value').html('00').parent('.section').addClass('zero');
830                        }
831                    } else {
832                        timer.find('.seconds > .value').html( ( '0' + seconds ).slice(-2) );
833    
834                        if ( $seconds_section.hasClass('zero') ) {
835                            $seconds_section.removeClass('zero').next().removeClass('zero');
836                        }
837                    }
838                }
839    
840                window.et_countdown_timer_labels = function( timer ) {
841                    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 ) {
842                        timer.find('.days .label').html( timer.f
842ind('.days').data('short') );
843                        timer.find('.hours .label').html( timer.find('.hours').data('short') );
844                        timer.find('.minutes .label').html( timer.find('.minutes').data('short') );
845                        timer.find('.seconds .label').html( timer.find('.seconds').data('short') );
846                    } else {
847                        timer.find('.days .label').html( timer.find('.days').data('full') );
848                        timer.find('.hours .label').html( timer.find('.hours').data('full') );
849                        timer.find('.minutes .label').html( timer.find('.minutes').data('full') );
850                        timer.find('.seconds .label').html( timer.find('.seconds').data('full') );
851                    }
852                }
853    
854                if ( $et_pb_countdown_timer.length ) {
855                    window.et_pb_countdown_timer_init = function( $et_pb_countdown_timer ) {
856                        $et_pb_countdown_timer.each(function(){
857                            var timer = $(this);
858                            et_countdown_timer_labels( timer );
859                            et_countdown_timer( timer );
860                            setInterval(function(){
861                                et_countdown_timer( timer );
862                            }, 1000);
863                        });
864                    }
865                    et_pb_countdown_timer_init( $et_pb_countdown_timer );
866                }
867    });
868    
869    
870    /* Refresh countdown after ajax return */
871    jQuery(document).ready(function ($) {
872      jQuery(document).on('divi_filter_completed', function(){
873    
874    
875        var $et_pb_countdown_timer = $( '.et_pb_countdown_timer' );
876        if ( $et_pb_countdown_timer.length ) {
877          window.et_pb_countdown_timer_init = function( $et_pb_countdown_timer ) {
878            $et_pb_countdown_timer.each(function(){
879              var timer = $(this);
880              et_countdown_timer_labels( timer );
881              et_countdown_timer( timer );
882              setInterval(function(){
883                et_countdown_timer( timer );
884              }, 1000);
885            });
886          }
887          et_pb_countdown_timer_init( $et_pb_countdown_timer );
888        }
889    
890    
891        var $et_pb_tabs = $( '.et_pb_tabs' ),
892        is_frontend_builder = $('body').hasClass('et-fb');
893    
894        if ( $et_pb_tabs.length || is_frontend_builder ) {
895          window.et_pb_tabs_init = function( $et_pb_tabs ) {
896            var $et_pb_tabs_li = $et_pb_tabs.find( '.et_pb_tabs_controls li' );
897    
898            $et_pb_tabs.et_pb_simple_slider( {
899              use_controls   : false,
900              use_arrows     : false,
901              slide          : '.et_pb_all_tabs > div',
902              tabs_animation : true
903            } ).on('et_hashchange', function( event ){
904              var params = event.params;
905              var $the_tabs = $( '#' + event.target.id );
906              var active_tab = params[0];
907              if ( !$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).hasClass('et_pb_tab_active') ) {
908                $the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).click();
909              }
910            });
911    
912            $et_pb_tabs_li.click( function() {
913              var $this_el        = $(this),
914                $tabs_container = $this_el.closest( '.et_pb_tabs' ).data('et_pb_simple_slider');
915    
916              if ( $tabs_container.et_animation_running ) return false;
917    
918              $this_el.addClass( 'et_pb_tab_active' ).siblings().removeClass( 'et_pb_tab_active' );
919    
920              $tabs_container.data('et_pb_simple_slider').et_slider_move_to( $this_el.index() );
921    
922              if ( $this_el.closest( '.et_pb_tabs' ).attr('id') ) {
923                var tab_state = [];
924                tab_state.push( $this_el.closest( '.et_pb_tabs' ).attr('id') );
925                tab_state.push( $this_el.index() );
926                tab_state = tab_state.join( et_hash_module_param_seperator );
927                et_set_hash( tab_state );
928              }
929    
930              return false;
931            } );
932          }
933          window.et_pb_tabs_init( $et_pb_tabs );
934        }
935    
936    
937      });
938    });
939    
940    // load more gallery 
941    jQuery(document).ready(function ($) {
942    
943      function ajax_load_more_gallery($this, is_popup) {
944    
945          
946          // if has the class loading, then stop
947          if ($this.hasClass('loading')) {
948              return false;
949          }
950    
951          var $et_pb_gallery_grid = $this.closest('.et_pb_de_mach_acf_slider ');
952          var data_grid_image_ids = $et_pb_gallery_grid.find('.grid-item').attr('data-grid-image-ids');
953          var data_load_more_num = $et_pb_gallery_grid.find('.grid-item').attr('data-load-more-num');
954          var enable_lightbox = $et_pb_gallery_grid.find('.grid-item').attr('data-enable_lightbox');
955          var show_title_and_caption = $et_pb_gallery_grid.find('.grid-item').attr('data-show_title_and_caption');
956    
957          var loading_text = $this.attr('data-loading_text');
958          var original_text = $this.text();
959    
960          var data = {
961              'action': 'divi_filter_load_more_gallery_ajax_handler',
962              'data_grid_image_ids': data_grid_image_ids,
963              'data_load_more_num': data_load_more_num,
964              'enable_lightbox': enable_lightbox,
965              'show_title_and_caption': show_title_and_caption
966          };
967    
968          jQuery.ajax({
969              url: filter_ajax_object.ajax_url, // AJAX handler
970              data: data,
971              type: 'POST',
972              dataType: 'JSON',
973              beforeSend: function () {
974                  $this.addClass('loading');
975                  $this.attr('disabled', 'disabled');
976                  $this.text(loading_text);
977              },
978              success: function (data) {
979
980                    $this.removeClass('loading');
981                    $et_pb_gallery_grid.find('.grid-item').attr('data-grid-image-ids', data['ids']);
982                    // $et_pb_gallery_grid.find('.grid-item').attr('data-load-more-num', data['data_load_more_num']);
983                    $et_pb_gallery_grid.find('.grid-posts').append(data['content']);
984                    $this.text(original_text);
985                    
986                    if (data['data_load_more_num'] == 0) {
987                        $this.hide();
988                    }
989                    
990                    if (typeof jQuery.fn.magnificPopup !== 'undefined' && data['gallery_image_urls'] != '' && is_popup == true) {
991                        // get instance (after popup was opened)
992                        var mfp = jQuery.magnificPopup.instance;
993                        jQuery.each(data['gallery_image_urls'], function( index, value ) {
994                        mfp.items.push({
995                            src: value
996                        });
997                        });
998        
999                        // call update method to refresh counters (if required)
1000                        mfp.updateItemHTML();
1001        
1002                    } else {
1003                    }
1004
1005                  
1006
1007                    // if et_pb_gallery_grid find grid-item has the class "masonry", console log "masonry"
1008                    if ($et_pb_gallery_grid.find('.grid-item').hasClass('masonry')) {
1009                        let classes = $et_pb_gallery_grid.find('.grid-item').attr('class');
1010
1011                        // Match col-desk-4, col-tab-2, col-mob-1 and extract the colNumbers
1012                        let matches = classes.match(/col-(?:desk|tab|mob)-(\d+)/g);
1013
1014                        // Extract only the digits
1015                        let colNumbers = matches.map(m => m.match(/\d+/)[0]);
1016
1017                        var macyInstance = Macy({
1018                            container: $et_pb_gallery_grid.find('.grid-posts')[0],
1019                            trueOrder: false,
1020                            waitForImages: true,
1021                            margin: {
1022                                x: 25,
1023                                y: 25  
1024                            },
1025                            columns:  colNumbers[0],
1026                            breakAt: {
1027                                1200: colNumbers[0],
1028                                980: colNumbers[1],
1029                                767: colNumbers[2]
1030                            }
1031                            }); 
1032
1033                            macyInstance.recalculate();
1034                            $et_pb_gallery_grid.find('.masonry.et_pb_gallery_grid').addClass('loaded');
1035                    }
1036
1037              }
1038          });
1039          
1040      }
1041    
1042    
1043      $(document.body).on('click', '.et_pb_de_mach_load_more_button_link', function (e) {
1044          e.preventDefault();
1045    
1046          var $this = $(this);
1047          var is_popup = false;
1048          ajax_load_more_gallery($this, is_popup);
1049    
1050      });
1051    
1052      // on .mfp-arrow click
1053      $(document.body).on('click', '.mfp-arrow', function (e) {
1054          // get the current image src
1055          var current_src = $('.mfp-img').attr('src');
1056          // get the 2nd to last gallery item image src - .et_pb_gallery_items .grid-item:nth-last-child(2) img
1057          var second_last_src = $('.et_pb_gallery_items .grid-item:nth-last-child(2) img').attr('src');
1058          
1059          // if the current image src is the same as the 2nd to last gallery item image src, ajax load more
1060          if (current_src == second_last_src) {
1061              var $this = $('.et_pb_de_mach_load_more_button_link');
1062              var is_popup = true;
1063              ajax_load_more_gallery($this, is_popup);
1064          }
1065      });
1066    
1067      // on keyboard arrow press
1068      $(document).keydown(function(e) {
1069          switch(e.which) {
1070      
1071              case 39: // right
1072                  // get the current image src
1073                  var current_src = $('.mfp-img').attr('src');
1074                  // get the 2nd to last gallery item image src - .et_pb_gallery_items .grid-item:nth-last-child(2) img
1075                  var second_last_src = $('.et_pb_gallery_items .grid-item:nth-last-child(2) img').attr('src');
1076                  
1077                  // if the current image src is the same as the 2nd to last gallery item image src, ajax load more
1078                  if (current_src == second_last_src) {
1079                      var $this = $('.et_pb_de_mach_load_more_button_link');
1080                      var is_popup = true;
1081                      ajax_load_more_gallery($this, is_popup);
1082                  }
1083              break;
1084          }
1085        });
1086    
1087    
1088    
1089    });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.