PageSourceSearch

https://campeche.gob.mx/wp-content/plugins/divi-machine/includes/m…/js/divi-filter-loadmore.min.js?ver=3.2.10

js campeche.gob.mx collected 2026-09-24 09:24:05 UTC 18,471 bytes, 437 lines download raw bytes

1jQuery(function ($) { // use jQuery code inside this to avoid "$ is not defined" error
2
3	var infinite_loadmore_started = false;
4	var infinite_page_end = false;
5	function post_load_more(e) {
6		e.preventDefault();
7		var button;
8		var is_loadmore = 'on';
9		if ($(e.target).hasClass('dmach-loadmore')) {
10			button = $(e.target);
11		} else {
12			button = $('.divi-filter-archive-loop.main-loop').closest('.filtered-posts-cont');
13			is_loadmore = 'off';
14		}
15		var $module_featured_posts = button.parent().find('.divi-filter-archive-loop'),
16			layoutid = $module_featured_posts.attr("data-layoutid"),
17			posttype = $module_featured_posts.attr("data-posttype"),
18			noresults = $module_featured_posts.attr("data-noresults"),
19			sortorder = $module_featured_posts.attr("data-sortorder"),
20			sortasc = $module_featured_posts.attr("data-sortasc"),
21			gridstyle = $module_featured_posts.attr("data-gridstyle"),
22			columnscount = $module_featured_posts.attr("data-columnscount"),
23			postnumber = $module_featured_posts.attr("data-postnumber"),
24			loadmoretext = $module_featured_posts.attr("data-btntext"),
25			loadmoretextloading = $module_featured_posts.attr("data-btntext_loading"),
26			resultcount = $module_featured_posts.attr("data-resultcount"),
27			countposition = $module_featured_posts.attr("data-countposition"),
28			shortcode_name = $module_featured_posts.attr("data-shortcode_name"),
29			module_current_page = parseInt($module_featured_posts.attr("data-current-page")),
30			module_max_page = parseInt($module_featured_posts.attr("data-max-page")),
31			post_var = $module_featured_posts.attr("data-filter-var"),
32			loadmore_icon = $module_featured_posts.find(".divi-loadmore").attr("data-icon"),
33			has_map = $module_featured_posts.attr("data-has-map"),
34			hide_marker_label = $module_featured_posts.attr("data-hide-marker-label"),
35			map_selector = $module_featured_posts.attr("data-map-selector"),
36			marker_layout = $module_featured_posts.attr("data-map-marker-layout"),
37			map_all_posts = $module_featured_posts.attr("data-map-all-posts"),
38			map_cluster = $module_featured_posts.attr("data-map-cluster"),
39			link_wholegrid = $module_featured_posts.attr("data-link_wholegrid"),
40			link_wholegrid_external = $module_featured_posts.attr("data-wholegrid-external"),
41			link_wholegrid_external_acf = $module_featured_posts.attr("data-wholegrid-external_acf"),
42            result_count_single_text = $module_featured_posts.attr("data-result-count-single-text"),
43            result_count_all_text = $module_featured_posts.attr("data-result-count-all-text"),
44            result_count_pagination_text = $module_featured_posts.attr("data-result-count-pagination-text");
45        
46        if ( $module_featured_posts.attr("data-loop-var") ) {
47            var loop_var = JSON.stringify(JSON.parse($module_featured_posts.attr("data-loop-var")));
48        }
49
50		var data = {
51			'action': 'divi_filter_loadmore_ajax_handler',
52			'security': loadmore_ajax_object.security,
53			'query': post_var,
54			'page': module_current_page,
55			'layoutid': layoutid,
56			'posttype': posttype,
57			'noresults': noresults,
58			'sortorder': sortorder,
59			'sortasc': sortasc,
60			'gridstyle': gridstyle,
61			'columnscount': columnscount,
62			'resultcount': resultcount,
63			'countposition': countposition,
64			'shortcode_name': shortcode_name,
65			'postnumber': postnumber,
66			'loadmoretext': loadmoretext,
67			'loadmore_icon': loadmore_icon,
68			'link_wholegrid': link_wholegrid,
69			'link_wholegrid_external': link_wholegrid_external,
70			'link_wholegrid_external_acf': link_wholegrid_external_acf,
71			'is_loadmore': is_loadmore,
72			'has_map': has_map,
73			'map_all_posts': map_all_posts,
74			'map_selector': map_selector,
75			'marker_layout': marker_layout,
76            'result_count_single_text':result_count_single_text,
77            'result_count_all_text':result_count_all_text,
78            'result_count_pagination_text':result_count_pagination_text,
79            'loop_var': loop_var
80		};
81        
82        if ( $module_featured_posts.attr('data-groupping-taxonomy') ) {
83            data.groupping_taxonomy = $module_featured_posts.attr('data-groupping-taxonomy');
84            data.last_grouping_term_id = $module_featured_posts.find('.groupping-term-title').last().attr('data-term_id');
85        }
86
87		if (layoutid == 'none') {
88			data.show_rating = $module_featured_posts.attr('data-show_rating');
89			data.show_price = $module_featured_posts.attr('data-show_price');
90			data.show_excerpt = $module_featured_posts.attr('data-show_excerpt');
91			data.show_add_to_cart = $module_featured_posts.attr('data-show_add_to_cart');
92		}
93
94		$.ajax({ // you can also use $.post here
95			url: loadmore_ajax_object.ajax_url, // AJAX handler
96			data: data,
97			type: 'POST',
98			beforeSend: function (xhr) {
99                $module_featured_posts.closest('.filtered-posts-cont').addClass('infinite-loading');
100				if (is_loadmore == 'on') {
101					button.text(loadmoretextloading); // change the button text, you can also add a preloader image	
102				} else {
103					var anim_chosen = jQuery('.filtered-posts-cont').attr('data-ajaxload-anim');
104					button.parent().append('<div class="loadmore-ajax-loading ' + anim_chosen + '"><div class="lines"><div class="line"></div><div class="line"></div><div class="line"></div></div><div class="spinner donut-cont"><div class="donut"></div></div><div class="spinner donutmulti-cont"><div class="donut multi"></div></div><div class="spinner ripple-cont"><div class="ripple"></div></div></div>');
105				}
106
107				$module_featured_posts.closest('.filtered-posts-cont').find('.filtered-posts-loading').prepend('<div class="ajax-loading"><div class="lines"><div class="line"></div><div class="line"></div><div class="line"></div></div><div class="spinner donut-cont"><div class="donut"></div></div><div class="spinner donutmulti-cont"><div class="donut multi"></div></div><div class="spinner ripple-cont"><div class="ripple"></div></div></div>');
108			},
109			success: function (data) {
110
111                $module_featured_posts.closest('.filtered-posts-cont').removeClass('infinite-loading');
112				infinite_loadmore_started = false;
113				if (data) {
114					var new_posts = $(data.posts);
115					if (button.hasClass('dmach-loadmore')) {
116						button.text(loadmoretext.replace(/\\/g, ''));
117					} else {
118						button.parent().find('.loading').remove();
119						button.parent().find('.loadmore-ajax-loading').remove();
120					}
121
122					if (button.parent().find('.loop-grid').length > 0) {
123						button.parent().find('.loop-grid').eq(0).append(new_posts); // insert new posts	
124					} else if (button.parent().find('ul.products').length > 0) {
125						button.parent().find('ul.products').eq(0).append(new_posts);
126					}
127
128					button.parent().find('.divi-filter-archive-loop').append(data.css_output);
129
130					$module_featured_posts.closest('.filtered-posts-cont').find('.filtered-posts-loading').find('.ajax-loading').remove();
131
132					var filter_post_container = button.parent();
133
134					if (filter_post_container.find('.divi-filter-result-count').length > 0) {
135						filter_post_container.find('.divi-filter-result-count').remove();
136					}
137
138					if (data.bc_result_count && button.parent().find('.woocommerce-result-count').length > 0) {
139						button.parent().find('.woocommerce-result-count').html(data.bc_result_count);
140					}
141
142					//button.parent().find('.divi-filter-archive-loop').append(data.after_post);
143
144					if (button.hasClass('dmach-loadmore')) {
145						button.remove();
146					}
147
148
149					if (data.after_post) {
150						var afterPost = $('<textarea />').html(data.after_post).text();
151						filter_post_container.append(afterPost.replace(/\\/g, ''));
152					}
153
154					jQuery(".single_add_to_cart_button").addClass("ajax_add_to_cart");
155
156					if ("undefined" != typeof ajax_disabled_products_class) {
157						$("." + ajax_disabled_products_class + " .single_add_to_cart_button").removeClass("ajax_add_to_cart");
158					}
159
160					$module_featured_posts.attr("data-current-page", module_current_page + 1);
161
162					if (typeof resizeAllGridItems == 'function') {
163						var totalImgs = new_posts.find('img').length;
164						new_posts.find('img').one('load', function () {
165							totalImgs--;
166							if (totalImgs <= 0) {
167								resizeAllGridItems();
168							}
169						}).each(function () {
170							if (this.complete) {
171								jQuery(this).trigger('load');
172							}
173						});
174
175					}
176					//show_filter_counts();
177					if (typeof get_post_popup == 'function') {
178						get_post_popup();
179					}
180					// same_height_cards();
181
182					if ($module_featured_posts.find(".grid-col").find(".gallery_vars").length > 0) {
183						var gallery_vars = $module_featured_posts.find(".grid-col").find(".gallery_vars").attr("data-gallery_vars");
184						var gallery_type = $module_featured_posts.find(".grid-col").find(".gallery_vars").attr("data-gallery_type");
185						gallery_vars = gallery_vars.replace(/,\s*$/, "");
186						gallery_vars = gallery_vars.replace(/,/g, ", ");
187						gallery_vars = gallery_vars.replace(/'/g, '"');
188						gallery_vars = '{' + gallery_vars + '}';
189
190						gallery_vars = JSON.parse(gallery_vars);
191
192						jQuery('.et_pb_de_mach_acf_slider_containter').each(function (i, obj) {
193							if (jQuery(this).hasClass('slick-initialized')) {
194								jQuery(this).slick('unslick');
195							}
196							jQuery(this).slick(gallery_vars);
197						});
198
199						if (gallery_type == 'gallery') {
200							var gallery_nav_vars = $module_featured_posts.find(".grid-col").find(".gallery_vars").attr("data-gallery_nav");
201							gallery_nav_vars = gallery_nav_vars.replace(/,\s*$/, "");
202							gallery_nav_vars = gallery_nav_vars.replace(/,/g, ", ");
203							gallery_nav_vars = gallery_nav_vars.replace(/'/g, '"');
204							gallery_nav_vars = '{' + gallery_nav_vars + '}';
205
206							gallery_nav_vars = JSON.parse(gallery_nav_vars);
207							gallery_nav_vars.asNavFor = '.et_pb_de_mach_acf_slider_containter';
208							gallery_nav_vars.focusOnSelect = true;
209							jQuery('.et_pb_de_mach_acf_slider_containter_nav').each(function (i, obj) {
210								if (jQuery(this).hasClass('slick-initialized')) {
211									jQuery(this).slick('unslick');
212								}
213								jQuery(this).slick(gallery_nav_vars);
214							});
215						}
216
217					}
218
219					if (data.map_data && jQuery(map_selector).length > 0 && map_all_posts == 'off') {
220						jQuery(map_selector).each(function () {
221
222				            var _this = jQuery(this);
223				            var map_obj = jQuery(this).data('map');
224
225				            for (let i = 0; i < markers.length; i++) {
226				              markers[i].setMap(null);
227				            }
228				            markers = [];
229				            
230				            if (map_cluster != 'on') {
231				              jQuery.each(data.map_data, function (ind, map) {
232				                locations.push({ lat: map.lat, lng: map.lng });
233				                if ( typeof hide_marker_label !== "undefined" && hide_marker_label == "on" ) {
234				                  labels.push(map.title.charAt(0));  
235				                } else {
236				                  labels.push("");
237				                }
238				                i_windows.push(map.infoview);
239				              });
240
241				              if (typeof map_obj != 'undefined') {
242				                markers = locations.map((location, i) => {
243				                  var marker = new google.maps.Marker({
244				                    position: location,
245				                    label: labels[i],
246				                    map: map_obj
247				                  });
248
249				                  var i_window = new google.maps.InfoWindow({
250				                    content: i_windows[i]
251				                  });
252
253				                  google.maps.event.addListener(map_obj, "click", (function () {
254				                    i_window.close()
255				                  }
256				                  ));
257
258				                  google.maps.event.addListener(marker, "click", (function () {
259				                    i_window.open(map_obj, marker);
260				                  }
261				                  ));
262
263				                  return marker;
264				                });
265				              }
266				            } else {
267				              /* Marker Clusterer */
268				              jQuery.each(data.map_data, function (ind, map) {
269				                locations.push({ lat: map.lat, lng: map.lng });
270				                if ( typeof hide_marker_label !== "undefined" && hide_marker_label == "on" ) {
271				                  labels.push(map.title.charAt(0));  
272				                } else {
273				                  labels.push("");
274				                }
275				                i_windows.push(map.infoview);
276				              });
277
278				              if (typeof map_obj != 'undefined') {
279				                markers = locations.map((location, i) => {
280				                  var marker = new google.maps.Marker({
281				                    position: location,
282				                    label: labels[i],
283				                  });
284
285				                  var i_window = new google.maps.InfoWindow({
286				                    content: i_windows[i]
287				                  });
288
289				                  google.maps.event.addListener(map_obj, "click", (function () {
290				                    i_window.close()
291				                  }
292				                  ));
293
294				                  google.maps.event.addListener(marker, "click", (function () {
295				                    i_window.open(map_obj, marker);
296				                  }
297				                  ));
298
299				                  return marker;
300				                });
301
302				                const markerClusterer = new MarkerClusterer(map_obj, markers, { imagePath: clusterer_obj.imgPath });
303				              }
304				            }
305				          });
306					}
307
308					if( gridstyle == 'masonry' ){
309						// for each .divi-filter-archive-loop.masonry
310						// for each .divi-filter-archive-loop.masonry
311						jQuery('.grid-layout-masonry').each(function () {
312							var masonry_data = jQuery(this).find('.divi-filter-archive-loop.masonry');
313							
314							var gutter_row_column = parseInt(masonry_data.attr('data-masonry-row-column'), 10) || 0,
315								gutter_row_gap = parseInt(masonry_data.attr('data-masonry-row-gap'), 10) || 0,
316								columns_desktop = parseInt(masonry_data.attr('data-masonry-columns-desktop'), 10) || 3,
317								columns_tablet = parseInt(masonry_data.attr('data-masonry-columns-tablet'), 10) || 2,
318								columns_mobile = parseInt(masonry_data.attr('data-masonry-columns-mobile'), 10) || 1;
319							
320							var macyInstance = Macy({
321							container: '.masonry .divi-filter-loop-container .grid-posts.loop-grid',
322							trueOrder: false,
323							waitForImages: true,
324							margin: {
325								x: gutter_row_column,
326								y: gutter_row_gap
327							},
328							columns: columns_desktop,
329							breakAt: {
330								1200: columns_desktop,
331								980: columns_tablet,
332								767: columns_mobile
333							}
334							});
335
336							macyInstance.runOnImageLoad(function () {
337							macyInstance.recalculate(true);
338							}, true);
339
340							// Ensure recalculation when new items are loaded via AJAX
341							jQuery(document).off('ajaxComplete').on('ajaxComplete', function () {
342							macyInstance.recalculate(true);
343							});
344						});	
345					}
346
347					if (gridstyle == 'masonry' && typeof resizeAllGridItems == 'function' ) {
348
349						var masonry_ajax_buffer = $module_featured_posts.attr('data-masonry_ajax_buffer');
350						resizeAllGridItems();
351						var totalImgs = jQuery('.divi-filter-archive-loop.main-loop').children().eq(0).find('img').length;
352						jQuery('.divi-filter-archive-loop.main-loop').children().eq(0).find('img').one("load", function () {
353							totalImgs--;
354							if (totalImgs == 0) {
355								resizeAllGridItems();
356							}
357						}).each(function () {
358							if (this.complete) {
359								jQuery(this).trigger('load'); // For jQuery >= 3.0 
360							}
361						});
362
363
364						setTimeout(
365							function () {
366								resizeAllGridItems();
367							}, masonry_ajax_buffer);							
368					}
369
370					if (jQuery.fn.fitVids) {
371						jQuery('#main-content').fitVids({
372							customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"
373						});
374					}
375
376					if ( $module_featured_posts.find('.et_post_gallery').length > 0 ) {
377						$module_featured_posts.find('.et_post_gallery').each((function() {
378	                        jQuery(this).magnificPopup({
379	                            delegate: ".et_pb_gallery_image a",
380	                            type: "image",
381	                            removalDelay: 500,
382	                            gallery: {
383	                                enabled: !0,
384	                                navigateByImgClick: !0
385	                            },
386	                            mainClass: "mfp-fade",
387	                            zoom: {
388	                                enabled: window.et_pb_custom && !window.et_pb_custom.is_builder_plugin_used,
389	                                duration: 500,
390	                                opener: function(t) {
391	                                    return t.find("img")
392	                                }
393	                            },
394	                            autoFocusLast: !1
395	                        })
396	                    }
397	                    ));
398	                    $module_featured_posts.find('.et_post_gallery').find("a").off("
398click");
399					}
400              
401                    jQuery('.variations_form').each(function() {
402                      jQuery(this).wc_variation_form();
403                      jQuery(this).trigger('check_variations');
404                    });
405
406					jQuery.event.trigger({
407						type: "divi_filter_completed"
408					});
409
410					if (data.posts == '') {
411						infinite_page_end = true;
412					}
413				} else {
414					if (button.hasClass('dmach-loadmore')) {
415						button.remove(); // if no data, remove the button as well
416					}
417				}
418			}
419		});
420	}
421	$(document).on('click keydown', '.dmach-loadmore', function (e) {
422		post_load_more(e);
423	});
424
425	if ($('.divi-filter-archive-loop.main-loop').data('loadmore') == 'infinite') {
426		$(window).scroll(function (e) {
427			var main_loop = $('.divi-filter-archive-loop.main-loop');
428			var offset = main_loop.offset();
429			if (parseInt(main_loop.attr('data-current-page')) < parseInt(main_loop.attr('data-max-page'))) {
430				if ($(window).scrollTop() > (offset.top + main_loop.outerHeight(true) - $(window).height()) && !infinite_loadmore_started && !infinite_page_end) {
431					infinite_loadmore_started = true;
432					post_load_more(e);
433				}
434			}
435		});
436	}
437});

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.