PageSourceSearch

https://iheartcats.com/wp-content/plugins/hlm-discover-feed/assets/js/jquery-feed-footer.js?ver=0.1

js iheartcats.com collected 2026-09-24 18:59:27 UTC 9,013 bytes, 158 lines download raw bytes

1if (typeof jQuery != 'undefined'){
2	jQuery(document).ready(function($){
3		// Guard flag to prevent concurrent AJAX requests (fixes duplicate section bug)
4		var hlm_feed_footer_loading = false;
5		
6		// Check if the feed section exists or not
7		if( !jQuery("section.discover-feed-sections").length ){
8			jQuery("div.site-footer").prepend('<section class="vc_section discover-feed-sections" style="margin:0 auto 30px;" scrollState="on"><div class="container-fluid clearfix ovh"><div class="row"></div></div></section>');
9		}
10		
11		// Helper: remove duplicate sections from HTML string before inserting
12		function hlm_dedupe_feed_html( htmlString ){
13			var temp = jQuery('<div>').html( htmlString );
14			temp.find('.feed-section-container').each(function(){
15				var sectionId = jQuery(this).attr('id');
16				if( sectionId && jQuery('#' + sectionId).length > 0 ){
17					jQuery(this).remove();
18				}
19			});
20			return temp.html();
21		}
22		
23		jQuery(window).on("scroll",function(){
24			if( jQuery(".discover-feed-sections").length > 0 ){
25				var currentPosition = jQuery(window).scrollTop() + jQuery(window).height();
26				var feedSection = jQuery(".discover-feed-sections");
27				if ( !feedSection.offset() ) return;
28				var actualBottom = feedSection.offset().top + feedSection.outerHeight(true),actualBottom = actualBottom - 1000;
29				if( currentPosition > actualBottom ){
30					if( feedSection.attr("scrollState") == "on" && !hlm_feed_footer_loading ){
31						feedSection.attr("scrollState","off");
32						hlm_feed_footer_loading = true;
33						
34						if( typeof feed_footer_category != 'undefined' && feed_footer_category != "" ){
35							feed_page_category = feed_footer_category;
36						}
37						
38						if( typeof feed_footer_sorting != 'undefined' && feed_footer_sorting != "" ){
39							feed_page_sorting = feed_footer_sorting;
40						}
41						
42						var ajaxData = {
43							'action': 'hlm_load_next_feed_sections',
44							'sections': feed_page_init_ids,
45							'sort': feed_page_sorting,
46							'cat': feed_page_category,
47							'limit': feed_page_limit,
48							'nonce': feed_page_ajx_nonce
49						};
50						
51						jQuery.ajax({
52							type: "POST",
53							dataType: "json",
54							url: ajaxurl,
55							data: jQuery.param(ajaxData),
56							success: function(data){
57								if( data["response"] == "success" ){
58									var cleanHtml = hlm_dedupe_feed_html( JSON.parse(data["section_html"]) );
59									
60									if( feedSection.find(".feed-section-container").eq(0).length ){
61										jQuery('.feed-section-container:last').after( cleanHtml );
62									}else{
63										jQuery('.discover-feed-sections').before('<section class="vc_section header-section"><div class="container-fluid clearfix ovh"><div class="row"><div class="footer-feed-logo-container"><img src="'+feed_page_website_url+'/wp-content/plugins/hlm-discover-feed/assets/images/the_feed_logo.png" border="0" /><span>Discover, Shop and Feed Shelter Dogs</span></div></div></div></section>');
64										jQuery('.discover-feed-sections .row').append( cleanHtml );
65										feedSection.attr("scrollState","end");
66										
67										// Insert Load More Button
68										jQuery('.discover-feed-sections .row').append("<button class='load-more-feed-items'>SEE MORE</button>");
69									}
70									hlm_feed_ga_tracking( "footer", "Loaded Feed Content into Footer of Page", "", "" );
71									
72									// Activate Product Carousels
73									jQuery(".products-container.carousel:not('.slick-initialized')").slick({ lazyLoad: 'ondemand', prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i>Previous</button>', nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i>Next</button>', infinite: true, centerMode: true, centerPadding: '80px', slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, responsive: [ { breakpoint: 1024,settings: {centerMode: true, centerPadding: '80px',slidesToShow: 3,slidesToScroll: 1} }, { breakpoint: 769,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 2,slidesToScroll: 1} }, { breakpoint: 501,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 1,slidesToScroll: 1} } ] });
74									
75									// Activate Media Carousels
76									jQuery(".media-container.carousel:not('.slick-initialized')").slick({ prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i>Previous</button>', nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i>Next</button>', infinite: true, centerMode: false, centerPadding: '80px', slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, responsive: [ { breakpoint: 1024,settings: {centerMode: true, centerPadding: '80px',slidesToShow: 3,slidesToScroll: 1} }, { breakpoint: 769,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 2,slidesToScroll: 1} }, { breakpoint: 501,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 1,slidesToScroll: 1} } ] });
77									
78									feed_page_init_ids = data["section_ids"];
79								}else{
80									feedSection.attr("scrollState","end");
81									hlm_feed_ga_tracking( "footer", "Finished Loading All Feed Content into Footer", "", "" );
82								}
83								hlm_feed_footer_loading = false;
84								hlm_feed_page_responsive_modifications();
85							},
86							error: function(jqXHR, textStatus, errorThrown){
87								hlm_feed_footer_loading = false;
88								//window.alert("Data Error: " + textStatus);
89							}
90						});
91					}
92				}else{
93					if( feedSection.attr("scrollState") != "end" && !hlm_feed_footer_loading ){
94						feedSection.attr("scrollState","on");
95					}else{
96						//console.log("we are at the end or loading");
97					}
98				}
99			}
100		});
101		
102		jQuery(window).on("resize",function(){
103			if( jQuery(".discover-feed-sections").find(".feed-section-container").eq(0).length ){
104				hlm_feed_page_responsive_modifications();
105			}
106		});
107		
108		// Load more feed content after clicking the load more button
109		jQuery(document).on('click', '.discover-feed-sections .load-more-feed-items', function(e){
110			if( hlm_feed_footer_loading ) return;
111			hlm_feed_footer_loading = true;
112			
113			var loadButton = jQuery(this);
114			loadButton.html("").addClass("loading");
115			
116			var ajaxData = {
117				'action': 'hlm_load_next_feed_sections',
118				'sections': feed_page_init_ids,
119				'sort': feed_page_sorting,
120				'cat': feed_page_category,
121				'nonce': feed_page_ajx_nonce
122			};
123			
124			jQuery.ajax({
125				type: "POST",
126				dataType: "json",
127				url: ajaxurl,
128				data: jQuery.param(ajaxData),
129				success: function(data){
130					loadButton.hide();
131					if( data["response"] == "success" ){
132						jQuery(".discover-feed-sections").attr("scrollState","on");
133						var cleanHtml = hlm_dedupe_feed_html( JSON.parse(data["section_html"]) );
134						jQuery('.feed-section-container:last').after( cleanHtml );
135						
136						// Activate Product Carousels
137						jQuery(".products-container.carousel:not('.slick-initialized')").slick({ lazyLoad: 'ondemand', prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i>Previous</button>', nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i>Next</button>', infinite: true, centerMode: true, centerPadding: '80px', slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, responsive: [ { breakpoint: 1024,settings: {centerMode: true, centerPadding: '80px',slidesToShow: 3,slidesToScroll: 1} }, { breakpoint: 769,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 2,slidesToScroll: 1} }, { breakpoint: 501,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 1,slidesToScroll: 1} } ] });
138						
139						// Activate Media Carousels
140						jQuery(".media-container.carousel:not('.slick-initialized')").slick({ prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i>Previous</button>', nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i>Next</button>', infinite: true, centerMode: false, centerPadding: '80px', slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, responsive: [ { breakpoint: 1024,settings: {centerMode: true, centerPadding: '80px',slidesToShow: 3,slidesToScroll: 1} }, { breakpoint: 769,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 2,slidesToScroll: 1} }, { breakpoint: 501,settings: {centerMode: true, centerPadding: '20px', slidesToShow: 1,slidesToScroll: 1} } ] });
141						
142						feed_page_init_ids = data["section_ids"];
143						hlm_feed_ga_tracking( "footer", "Loaded More Content into Footer After Clicking Button", "", "" );
144					}else{
145						jQuery(".discover-feed-sections").attr("scrollState","end");
146						hlm_feed_ga_tracking( "footer", "Finished Loading All Feed Content into Footer", "", "" );
147					}
148					hlm_feed_footer_loading = false;
149					hlm_feed_page_responsive_modifications();
150				},
151				error: function(jqXHR, textStatus, errorThrown){
152					loadButton.hide();
153					hlm_feed_footer_loading = false;
154				}
155			});
156		});
157	});
158}

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.