PageSourceSearch

https://friendlys.com/wp-content/themes/dfadairybrands/assets/js/main.js?ver=16.0.0

js friendlys.com collected 2026-10-02 07:47:44 UTC 10,903 bytes, 407 lines download raw bytes

1$(document).ready(function(){
2	$('body').on('click', '.back-to-top.active', function(e){
3        $('body,html').animate({scrollTop: 0}, 1000);
4        $('.back-to-top').removeClass('active');
5  	});
6  	$(window).scroll(function() {
7		if ($(this).scrollTop() > 100) {
8	 		$('.back-to-top').addClass('active');
9		} else {
10	  		$('.back-to-top').removeClass('active');
11		}
12	});
13
14	/*product submenu*/
15		// productSubmenu();
16
17		// https://kenwheeler.github.io/slick/
18		// Only initialize the main slider as a Slick carousel when there is
19		// more than one slide. With a single slide, Slick's structure/styles
20		// can cause layout issues, so we leave it as plain markup.
21	var $mainpageSlider = $('#mainpageSlider');
22	var mainpageSlideCount = $mainpageSlider.children().length;
23	console.log(mainpageSlideCount);
24
25	if (mainpageSlideCount > 1) {
26		$mainpageSlider.slick({
27		  slidesToShow: 1,
28		  slidesToScroll: 1,
29		  autoplay: true,
30			autoplaySpeed: 6000,
31			pauseOnHover: false,
32			pauseOnFocus: false,
33		  arrows: true,
34			prevArrow: "<div class='arrow-container prev'><button type='button' class='slick-prev'></button></div>",
35			nextArrow: "<div class='arrow-container next'><button type='button' class='slick-next'></button></div>",
36		  fade: true,
37		  dots: false,
38		// responsive: [
39		// 	{
40		// 		breakpoint: 1200,
41		// 		settings: {
42		// 			slidesToShow: 2,
43		// 			slidesToScroll: 2,
44		// 			infinite: true,
45		// 			dots: false
46		// 		}
47		// 	},
48		// 	{
49		// 		breakpoint: 1024,
50		// 		settings: {
51		// 			slidesToShow: 1,
52		// 			slidesToScroll: 1,
53		// 			infinite: true,
54		// 			dots: false
55		// 		}
56		// 	}
57
58			// ]
59		  // asNavFor: '#mainpageAdditionalSlider .slider'
60		});
61	}
62
63	$('#mainpageAdditionalSlider2').slick({
64	  slidesToShow: 3,
65	  slidesToScroll: 3,
66	  // asNavFor: '#mainpageSlider',
67	  autoplaySpeed: 6000,
68		infinite: true,
69		pauseOnHover: false,
70		pauseOnFocus: false,
71	  arrows: true,
72		prevArrow: "<div class='arrow-container prev'><button type='button' class='slick-prev'></button></div>",
73		nextArrow: "<div class='arrow-container next'><button type='button' class='slick-next'></button></div>",
74	  dots: false,
75		adaptiveHeight: true,
76		responsive: [
77			{
78				breakpoint: 992,
79				settings: {
80					slidesToShow: 1,
81					slidesToScroll: 1,
82					infinite: true,
83					dots: false
84				}
85			}
86		]
87	});
88
89	/*mobile menu*/
90		$('#mobile-menu-btn').on('click', function() {
91			$('#top_nav').addClass('is-active');
92		});
93		$('.close-menu-btn').on('click', function() {
94			$('#top_nav').removeClass('is-active');
95		});
96
97	/*submenu*/
98		headerSubmenu();
99
100	/*serch*/
101		$('.search-toggle').on('click', function() {
102			if ($(this).hasClass('is-active')) {
103				$(this).removeClass('is-active');
104				$('#site_search').removeClass('is-active');
105			}else{
106				$(this).addClass('is-active');
107				$('#site_search').addClass('is-active');
108			}
109		});
110
111	if ( $('body').hasClass('single-recipe') ) {
112		var $subject = $('.recipe-title-block h2').text();
113		console.log($subject);
114	}
115	
116	if ( $('body').hasClass('page-template-simple-newspage') ) {
117		var $subject = $('.family-top-info-section h2').text();
118		console.log($subject);
119	}
120    
121    if ( $('body').hasClass('page-template-simple-newspage2') ) {
122		var $subject = $('.middle-title-image-section h2').text();
123		console.log($subject);
124	}	
125	
126
127	/*social share*/
128		$("#recipe-share").jsSocials({
129			showLabel: false,
130    		showCount: false,
131    		shares: [{
132		        share: "facebook",
133		        logo: "fab fa-facebook-f"
134		    },{
135		    	share: "twitter",
136		        logo: "fab fa-twitter"
137		    },{
138		    	share: "pinterest",
139		        logo: "fab fa-pinterest"
140		    },{
141		    	share: "email",
142		        logo: "fas fa-envelope",
143		        shareUrl: 'mailto:?subject=' + $subject + '&body={url}'
144
145		    }]
146        });
147
148    /*faq*/
149    	$('.nav-toggler-mobile').on('click', function() {
150			if ($(this).hasClass('is-active')) {
151				$(this).removeClass('is-active');
152				$(this).next('.page-nav').slideUp();
153			}else{
154				$(this).addClass('is-active');
155				$(this).next('.page-nav').slideDown();
156			}
157		});
158
159    	$('.faq-item .question').on('click', function() {
160			if ($(this).hasClass('is-active')) {
161				$(this).removeClass('is-active');
162				$(this).next('.answer').slideUp();
163			}else{
164				$(this).addClass('is-active');
165				$(this).next('.answer').slideDown();
166			}
167		});
168
169		$(".page-nav a").click(function () {
170
171			if ( $(window).width() > 991) {
172
173		        var elementClick = $(this).attr("href");
174		        var elemPos = $(elementClick).offset().top;
175		        var winCenter = $(window).height() / 4;
176		        var destination = elemPos - winCenter;
177
178		        if ($('.nav-toggler-mobile').hasClass('is-active')) {
179					$('.nav-toggler-mobile').removeClass('is-active');
180					$('.page-nav').slideUp();
181				}
182
183		        $('html,body').animate({ scrollTop: destination }, 1100);
184		        return false; 
185
186		    } else {
187
188		    	var elementClick = $(this).attr("href");
189		        var elemPos = $(elementClick).offset().top;
190		        var winCenter = $(window).height() / 4;
191		        var menuHeight = $('.page-nav').height();
192		        var destination = elemPos - winCenter - menuHeight;
193
194		        if ($('.nav-toggler-mobile').hasClass('is-active')) {
195					$('.nav-toggler-mobile').removeClass('is-active');
196					$('.page-nav').slideUp();
197				}
198
199		        $('html,body').animate({ scrollTop: destination }, 1100);
200		        return false; 
201
202		    }
203	    });
204
205	/*contact*/
206		$('#retailer-form-link').magnificPopup({
207			type: 'inl
207ine',
208
209			fixedContentPos: false,
210			fixedBgPos: true,
211
212			overflowY: 'auto',
213
214			closeBtnInside: true,
215			preloader: false,
216
217			removalDelay: 300,
218			mainClass: 'my-mfp-zoom-in'
219		});
220
221		$('#availability-form-link').magnificPopup({
222		  type: 'iframe',
223		  
224		  	iframe: {
225			    patterns: {
226			      everesthosted: {
227			       
228			        index: 'everesthosted.net',
229			        src: 'https://www.everesthosted.net/kemps/availability/WebForm.asp'
230			        
231			      }
232			    }
233		  	},
234
235			removalDelay: 300,
236			mainClass: 'my-mfp-zoom-in availability-popup'
237		});
238
239		$('#feedback-form-link').magnificPopup({
240		  type: 'iframe',
241		  
242		  	iframe: {
243			    patterns: {
244			      everesthosted: {
245			       
246			        index: 'everesthosted.net',
247			        src: 'https://www.everesthosted.net/kemps/feedback/WebForm.asp'
248			        
249			      }
250			    }
251		  	},
252
253			removalDelay: 300,
254			mainClass: 'my-mfp-zoom-in feedback-popup'
255		});
256
257		$('.b-select').selectric({
258			arrowButtonMarkup: '<b class="button"></b>'
259		});
260
261	/*recipes*/
262		$('.recipes-filter-section .filter-dropdown-btn').on('click', function() {
263			if ($(this).hasClass('is-active')) {
264				$(this).removeClass('is-active');
265				$(this).next('.filter-dropdown').removeClass('is-active');
266			}else{
267				$(this).addClass('is-active');
268				$(this).next('.filter-dropdown').addClass('is-active');
269			}
270		});
271
272		//Close dropdown list target
273        $(document).on('click', 'body',  function(event) {
274          if (!$(event.target).closest('.filter-dropdown').length && !$(event.target).closest('.filter-dropdown-btn').length) {
275
276              $('.filter-dropdown-btn').removeClass('is-active');
277              $('.filter-dropdown').removeClass('is-active');
278          }
279        });
280
281
282     //    $(".recipe-item-col").slice(0, 6).addClass('display');
283     //    $(".recipe-item-col:hidden").addClass('not-active');
284	    // $("#loadMore").on('click', function (e) {
285	    //     e.preventDefault();
286	    //     $(".recipe-item-col:hidden").slice(0, 3).removeClass('not-active').addClass('display');
287	    //     $grid.isotope('layout')
288	    //     if ($(".recipe-item-col:hidden").length == 0) {
289	    //         $("#loadMore").fadeOut('slow');
290	    //     }
291	    // });
292
293	     // init Isotope
294		var $grid = $('.recipes-wrap-section .row').isotope({
295		  itemSelector: '.recipe-item-col',
296		  layoutMode: 'fitRows'
297		});
298
299		// bind filter button click
300		$('.filter-dropdown .filter-btn').on( 'click', function() {
301		  var filterValue = $( this ).attr('data-filter');
302		  $grid.isotope({ filter: filterValue });
303		  $('.filter-dropdown-btn').text( $(this).text() );
304		});
305
306		$('.filter-btn').on('click', function() {
307			$('.filter-dropdown-btn').removeClass('is-active');
308            $('.filter-dropdown').removeClass('is-active');
309		});
310
311    
312});
313
314$(window).on('load', function(){
315	// productSubmenu();
316});
317
318$(window).on('resize', function(){
319	// productSubmenu();
320	// headerSubmenu();
321});
322
323// function productSubmenu() {
324// 	if ($(window).width() > '991') {
325// 		var menuWidth = $('#header').width(),
326// 			containerWidth = $('#header .container').width(),
327// 			menuLinkPos = $('#menu-item-3218').offset().left;
328
329// 		$('#menu-item-3218 .sub-menu').css({
330// 			'width' : menuWidth,
331// 			'padding-left' : (menuWidth - containerWidth),
332// 			'padding-right' : (menuWidth - containerWidth),
333// 			'left' : - menuLinkPos
334// 		});
335// 	}
336// }
337
338function headerSubmenu() {
339	if ($(window).width() > '991') {
340		$('#menu-main-menu').hoverIntent({
341		    over: startHover,
342		    out: endHover,
343		    timeout: 400,
344		    selector: '.menu-item-has-children'
345		});
346
347		function startHover(e){
348		  	$(this).find('.sub-menu').addClass('is-active');
349		}
350
351		function endHover(e){
352		  	$(this).find('.sub-menu').removeClass('is-active');
353		}
354	} else {
355		if ( !$('.menu-item-has-children').find('.drop-submenu').length ) {
356			$('<span class="drop-submenu"></span>').insertAfter( $('.menu-item-has-children > a') );
357		}
358		$('.drop-submenu').on('click', function() {
359			if ( $(this).hasClass('is-active') ) {
360				$(this).removeClass('is-active');
361				$(this).parent('li').find('.sub-menu').removeClass('is-active').slideUp();
362			}else{
363				$(this).addClass('is-active');
364				$(this).parent('li').find('.sub-menu').addClass('is-active').slideDown();
365			}
366			
367		});
368	}
369	
370}
371
372
373// Masking birthday field for MM-DD
374// https://imask.js.org/
375window.onload = function() {
376   let birthday = document.getElementById('nf-field-68');
377   let birthday2 = document.getElementById('nf-field-96');
378   let birthday3 = document.getElementById('nf-field-142');	
379   
380        let maskOptions = {
381          mask: 'MM{/}DD',
382          blocks: {
383            MM: {
384              mask: IMask.MaskedRange,
385              from: 1,
386              to: 12,  // Limit months from 01 to 12
387              maxLength: 2, // Enforce 2 digits for months
388            },
389            DD: {
390              mask: IMask.MaskedRange,
391              from: 1,
392              to: 31,  // Limit days from 01 to 31
393              maxLength: 2, // Enforce 2 digits for days
394            }
395          }
396        };
397	    if(birthday !=null && birthday != undefined){
398		    let mask = IMask(birthday, maskOptions);
399        }
400	    if(birthday2 !=null && birthday2 != undefined){
401		    let mask2 = IMask(birthday2, maskOptions);
402       	}
403	    if(birthday3 !=null && birthday3 != undefined){
404		    let mask3 = IMask(birthday3, maskOptions);
405       	}
406		
407};

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.