PageSourceSearch

https://nayamasters.com/wp-content/plugins/divi-machine/js/frontend-general.min.js?ver=6.2.12

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

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.