PageSourceSearch

https://www.ritcheysdairy.com/wp-content/themes/RitcheyDairy/js/ritcheydairy-script.js?ver=1791320182

js ritcheysdairy.com collected 2026-10-07 14:57:31 UTC 6,450 bytes, 295 lines download raw bytes

1jQuery(function($){
2
3	if ( $.isFunction($.fn.select2) ) {
4		$('select').select2({
5			minimumResultsForSearch: Infinity
6		});
7	}
8
9	function render_map( $el ) {
10	 
11		var $markers = $el.find('.marker');
12		var args = {
13			zoom		: 16,
14			center		: new google.maps.LatLng(0, 0),
15			mapTypeId	: google.maps.MapTypeId.ROADMAP
16		};
17	 
18		var map = new google.maps.Map( $el[0], args);
19		map.markers = [];
20		$markers.each(function(){
21	    	add_marker( $(this), map );
22		});
23		center_map( map );
24	}
25	 
26	function add_marker( $marker, map ) {
27		var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
28		var marker = new google.maps.Marker({
29			position	: latlng,
30			map			: map
31		});
32
33		map.markers.push( marker );
34
35		if( $marker.html() )
36		{
37			var infowindow = new google.maps.InfoWindow({
38				content		: $marker.html()
39			});
40			google.maps.event.addListener(marker, 'click', function() {
41				infowindow.open( map, marker );
42			});
43
44			if (map.markers.length == 1) {
45				infowindow.open( map, marker );
46			}
47		}
48	}
49	 
50	function center_map( map ) {
51		var bounds = new google.maps.LatLngBounds();
52
53		$.each( map.markers, function( i, marker ){
54			var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() );
55			bounds.extend( latlng );
56		});
57	 
58		if( map.markers.length == 1 )
59		{
60		    map.setCenter( bounds.getCenter() );
61		    map.setZoom( 16 );
62		}
63		else
64		{
65			map.fitBounds( bounds );
66		}
67	}
68
69	function setSameHeight(selector) {
70		var tallest = 0;
71
72		$(selector).each(function() {
73			if ($(this).css('height', 'auto').height() > tallest) {
74				tallest = $(this).height();
75			}
76		});
77
78		$(selector).each(function() {
79			$(this).height(tallest);
80		});
81	}
82
83	function setSameOuterHeight(selector) {
84		var tallest = 0;
85
86		$(selector).each(function() {
87			if ($(this).css('height', 'auto').outerHeight() > tallest) {
88				tallest = $(this).outerHeight();
89			}
90		});
91
92		$(selector).each(function() {
93			$(this).outerHeight(tallest);
94		});
95	}
96
97	function checkHeader() {
98		if ($(window).scrollTop() > 40) {
99			$('#branding').addClass('active');
100		} else {
101			$('#branding').removeClass('active');
102		}
103	}
104
105	function moveBackground(selector) {
106
107		if ($(selector).length > 0) {
108			$(selector).css('background-position', ($(window).scrollTop() / 20) + 'px 0px');
109		}
110	}
111
112	function isScrolledIntoView(elem)
113	{
114	    var docViewTop = $(window).scrollTop();
115	    var docViewBottom = docViewTop + $(window).height();
116
117	    var elemTop = $(elem).offset().top;
118	    var elemBottom = elemTop + $(elem).height();
119
120	    return (elemBottom <= docViewBottom - 100);
121	}
122
123	function moveSlideText() {
124		if ($('#home-slideshow .slide-message').length > 0) {
125			$('#home-slideshow .slide-message').css('margin-top', ($(window).scrollTop() / 3));
126		}
127	}
128
129	function repeatFunctions() {
130
131		checkHeader();
132		moveSlideText();
133		moveBackground('#home-content');
134
135		$('#home-columns .column-content').each(function() {
136			$(this).css('padding-bottom', $(this).find('.sub-text-wrapper').outerHeight());
137		});
138
139		setSameOuterHeight('#home-columns .column-content');
140		setTimeout(function() {
141			setSameOuterHeight('#home-columns .column-content');
142		}, 200);
143		$('.checkbox').each(function() {
144			if (isScrolledIntoView($(this))) {
145				$(this).removeClass('hidden');
146			}
147		});
148
149		$('#primary-nav').css('max-height', $(window).height() - $('#branding').height() - 30);
150
151		$('.menu-item-has-children').each(function() {
152			var $this = $(this);
153
154			$(this).hover(function() {
155				if ($(window).width() > 1320) {
156					var maxHeight = 0;
157					$this.find('.sub-menu li').each(function() {
158						maxHeight = maxHeight + $(this).outerHeight();
159					});
160					$this.find('.sub-menu').css('max-height', maxHeight);
161				}
162			}, function() {
163				if ($(window).width() > 1320) {
164					$this.find('.sub-menu').css('max-height', 0);
165				}
166			});
167		});
168
169		if ($('#main #home-slideshow').length > 0) {
170			if ($(window).width() <= 640) {
171				$('#main #home-slideshow').css('margin-top', $('#branding').outerHeight());
172			} else {
173				$('#main #home-slideshow').css('margin-top', '');
174			}
175		}
176	}
177
178	$(document).ready(function() {
179
180		$('#home-slideshow .slide-container').slick({
181			slidesToShow: 1,
182			slidesToScroll: 1,
183			arrows: true,
184			dots: false,
185			autoplay: true,
186			autoplaySpeed: 5000,
187			pauseOnHover: false
188		});
189
190		$('.store-thumbnail-gallery').slick({
191			slidesToShow: 1,
192			slidesToScroll: 1,
193			arrows: true,
194			dots: false,
195			autoplay: true,
196			autoplaySpeed: 5000,
197			pauseOnHover: false
198		});
199
200		$("#home-columns .column-wrapper").slick({
201			slidesToShow: 2,
202			slidesToScroll: 1,
203			arrows: false,
204			dots: false,
205			autoplay: true,
206			autoplaySpeed: 7000,
207			pauseOnHover: false,
208			responsive: [
209			    {
210			      breakpoint: 1180,
211			      settings: {
212			        slidesToShow: 1,
213			      }
214			    },
215		    ]
216		});
217
218		$('.ice-cream-button').click(function() {
219			$('.flavor-list-lightbox').addClass('active');
220		});
221
222		$('.delivery-lightbox-button').click(function() {
223			$('.delivery-lightbox').addClass('active');
224		});
225
226		$('.delivery-policy-lightbox-button').click(function() {
227			$('.delivery-policy-lightbox').addClass('active');
228		});
229
230		$('.lightbox-close').click(function() {
231			$(this).parent().parent().parent().removeClass('active');
232		});
233
234		$('.menu-item-has-children > a').click(function(e) {
235			e.preventDefault();
236
237			$(this).find('.sub-menu').toggleClass('active');
238		});
239
240		$('.acf-map').each(function(){
241 
242			render_map( $(this) );
243	 
244		});
245
246		$('.mobile-menu-button').click(function() {
247			$('#primary-nav').toggleClass('active');
248		});
249
250		$('.menu-item-has-children').each(function() {
251			$this = $(this);
252
253			$this.click(function() {
254				if ($(window).width() <= 1320) {
255					$this.toggleClass('active');
256
257					if ($this.hasClass('active')) {
258						var maxHeight = 0;
259						$this.find('.sub-menu li').each(function() {
260							maxHeight = maxHeight + $(this).outerHeight();
261						});
262						$this.find('.sub-menu').css('max-height', maxHeight);
263					} else {
264						$this.find('.sub-menu').css('max-height', 0);
265					}
266				}
267			});
268		});
269
270		repeatFunctions();
271	});
272
273	$(window).load(function() {
274
275		repeatFunctions();
276	});
277
278	$(window).resize(function() {
279
280		repeatFunctions();
281	});
282
283	$(window).scroll(function() {
284
285		checkHeader();
286		moveSlideText();
287		moveBackground('#home-content');
288
289		$('.checkbox').each(function() {
290			if (isScrolledIntoView($(this))) {
291				$(this).removeClass('hidden');
292			}
293		});
294	});
295});

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.