PageSourceSearch

https://everythingenvy.com/wp-content/themes/smash_theme/smash/js/smash.js

js everythingenvy.com collected 2026-10-05 11:32:50 UTC 8,157 bytes, 368 lines download raw bytes

1jQuery(function($){
2
3	var windowWidth = $(window).outerWidth();
4	var windowHeight = $(window).outerHeight();
5
6	function init(){
7        animateScroll();
8        externalLinks();
9        lazyLoad('.lazy');
10        scaleBgImages();
11		runMoveSocial();
12		followDrop();
13		runSocial();
14		runSearch();
15		runWaypoints();
16		runComments();
17		runSliders();
18        // centerSlides();
19
20        setTimeout(animateElements,2000);
21
22		$(window).resize(function(){
23			runResize();
24		});
25	}
26
27
28	var runResize = function(){
29		windowWidth = $(window).outerWidth();
30		windowHeight = $(window).outerHeight();
31
32		// centerSlides();
33    }
34
35    almComplete = function(alm){
36        lazyLoad();
37        scaleBgImages();
38    }
39
40    function lazyLoad() {
41        $('.lazy').Lazy({
42            // your configuration goes here
43            scrollDirection: 'vertical',
44            threshold: 100,
45            afterLoad: function(element) {
46                scaleBgImages()
47            },
48            onError: function(element) {
49                console.log('error loading ' + element.data('src'));
50            }
51        });
52    }
53
54    function scaleBgImages() {
55        var bgs = $('*[data-bgratio]');
56        bgs.each(function(){
57            var _ = $(this);
58            var w = _.width();
59            var r = _.data('bgratio');
60            _.stop().height(w * r);
61            $(window).resize(function(){
62                setTimeout(function(){
63                    w = _.stop().width();
64                }, 500);
65                setTimeout(function(){
66                    _.stop().height(w * r);
67                },600);
68            });
69        });
70    }
71
72
73	function runMoveSocial() {
74		$('.menu-toggle').click(function(){
75			$('#masthead').toggleClass('nav-open');
76		});
77	}
78
79
80	function runTabSection(){
81		tabs = $('.top-pick-tab');
82		codes = $('.top-pick-code');
83
84		codes.hide();
85		$('.top-pick-code.toggled').show();
86
87		tabs.click(function(){
88			tabID = $(this).data('count');
89
90			$('.top-picks-tabs').find('.active-tab').removeClass('active-tab');
91			$(this).addClass('active-tab');
92
93			$('.top-picks-codes').find('.top-pick-code.toggled').removeClass('toggled').fadeOut('fast', function(){
94				$('.top-picks-codes').find('.top-pick-code[data-count="' + tabID + '"]').fadeIn('fast').addClass('toggled');
95			});
96
97		});
98	}
99
100	setTimeout(function(){
101		runTabSection();
102	}, 2000);
103
104	function showHideIG(){
105		$('#ig-trigger').mouseenter(function(){
106			var styles = {
107				'margin-top': 0
108			}
109			$('#ig-feed-wrapper').animate(styles, 500, function(){
110				console.log('shown');
111			});
112		});
113
114		$('#masthead').mouseleave(function(){
115			var styles = {
116				'margin-top': '-500px'
117			}
118			$('#ig-feed-wrapper').animate(styles, 500, function(){
119				console.log('hidden');
120			});
121		});
122	}
123
124	showHideIG();
125
126
127	// SHOW/HIDE FOLLOW BUTTONS
128	function followDrop(){
129		var followTrigger = $('.follow-trigger');
130
131		followTrigger.mouseenter(function(){
132			$('#header-social').fadeIn();
133        });
134        $('.site-navigation-wrap, #header-social').mouseleave(function(){
135            $('#header-social').fadeOut();
136        });
137	}
138
139
140	// SOCIAL SHARING BUTTONS
141	var runSocial = function(){
142		var shareBlocks = $('.social-share');
143		var alreadyShared = [];
144
145		shareBlocks.each(function(){
146			var shareBlock = $(this);
147            var shareID = $(this).attr('id');
148            
149            // IF NOT LOADING MORE POSTS ON PAGE
150            $(this).find('.share').ShareLink({
151                title: shareBlock.find('input.title').val(),
152                text: shareBlock.find('input.title').val(),
153                image: shareBlock.find('input.image').val(),
154                url: shareBlock.find('input.url').val()
155            });
156
157            // IF LOADING MORE POSTS ON PAGE
158			// if($.inArray(shareID,alreadyShared)){
159			// 	$(this).find('.share').ShareLink({
160			//         title: shareBlock.find('input.title').val(),
161			//         text: shareBlock.find('input.title').val(),
162			//         image: shareBlock.find('input.image').val(),
163			//         url: shareBlock.find('input.url').val()
164			//     });
165
166			//     alreadyShared.push($(this).attr('id'));
167			// }
168		});
169	}
170
171
172
173// BEGIN CROPPING FUNCTIONS
174	function initCrop(){
175		function runCrop(){
176			var crops = [];
177			container = $('.ig-container');
178			
179			container.each(function(){
180				var containerWidth = $(this).outerWidth();
181				var el = $(this).find('.crop-wrap');
182				var elCount = el.length;
183				if($(this).hasClass('flex-col')){
184					size = containerWidth;
185				} else {
186					size = containerWidth / elCount;
187				}
188
189				el.each(function(){
190					$(this).width(size);
191					$(this).height(size);
192				});
193			});
194		}
195
196		runCrop();
197
198		$(window).resize(function(){
199			runCrop();	
200		});
201	}
202
203	initCrop();
204// END CROPPING FUNCTIONS
205
206
207// SEARCH
208	function runSearch(){
209		$('.modal').click(function() {
210			$('.modal').fadeOut();
211		});
212	}
213
214
215	function runSliders(){
216		$('.featured-categories-row, .popular-posts-wrapper').slick({
217			dots: false,
218			arrows: true,
219			prevArrow: '<i class="slider-prev slider-arrow fa fa-angle-left"></i>',
220			nextArrow: '<i class="slider-next slider-arrow fa fa-angle-right"></i>',
221			autoplay: false,
222			variableWidth: false,
223			slidesToShow: 3,
224			slidesToScroll: 1,
225			responsive: [
226				{
227				  breakpoint: 600,
228				  settings: {
229					slidesToShow: 2,
230					slidesToScroll: 1
231				  }
232				},
233				{
234				  breakpoint: 480,
235				  settings: {
236					slidesToShow: 1,
237					slidesToScroll: 1
238				  }
239				}
240			  ]
241		});
242		
243		$('.featured-slider-container').slick({
244			dots: true,
245			arrows: false,
246			autoplay: false,
247			centerMode: true,
248			variableWidth: false,
249			slidesToShow: 3,
250			slidesToScroll: 1,
251			responsive: [
252				{
253				  breakpoint: 768,
254				  settings: {
255					centerMode: false,
256					slidesToShow: 1,
257					slidesToScroll: 1
258				  }
259				}
260			]
261		});
262	}
263
264	function runIndividualRsSliders(){
265		codes = $('.top-pick-code');
266
267		codes.each(function(){
268			$(this).slick({
269				infinite: true,
270				centerMode: false,
271				slidesToShow: 4,
272				slidesToScroll: 1,
273				prevArrow: '<i class="slick-prev slick-arrow fa fa-caret-left" aria-hidden="true"></i>',
274				nextArrow: '<i class="slick-next slick-arrow fa fa-caret-right" aria-hidden="true"></i>',
275				responsive: [
276				    {
277				      breakpoint: 770,
278				      settings: {
279				        slidesToShow: 2,
280				        slidesToScroll: 1,
281				        infinite: true,
282				        dots: false
283				      }
284				    }
285				]
286			});
287		});
288
289		// rsSliders();
290	}
291
292	//runIndividualRsSliders();
293
294	function rsSliders(){
295		$('.top-picks-codes').slick({
296			infinite: true,
297			centerMode: false,
298			slidesToShow: 1,
299			slidesToScroll: 1,
300			arrows: false,
301			dots: false,
302			asNavFor: '.top-picks-tabs',
303			responsive: [
304		    {
305		      breakpoint: 770,
306		      settings: {
307		        slidesToShow: 1,
308		        slidesToScroll: 1,
309		        infinite: true,
310		        dots: false
311		      }
312		    }
313			]
314		});
315
316		$('.top-picks-tabs').slick({
317		//   slidesToScroll: 1,
318		  asNavFor: '.top-picks-codes',
319		  dots: false,
320		  arrows: false,
321		  centerMode: false,
322		  focusOnSelect: true
323		});
324	}
325
326	function centerSlides(){
327		var itemWidth = $('.featured_post').outerWidth();
328		var itemHeight = $('.featured_post').outerHeight();
329		$('.featured_post').css({
330			left: -(itemWidth/1.95)
331		});
332
333		$('#featured_posts_slider .slick-next, #featured_posts_slider .slick-prev').css({
334			width: ((windowWidth - itemWidth) - (15)) / (2),
335			height: itemHeight
336		});
337	}
338
339
340// ADD CLASS FOR HEADER STYLE ON SCROLL
341	var runWaypoints = function(){
342		var waypoints = $('#waypoint').waypoint(function(direction) {
343		  $('#masthead, body').toggleClass('lock_nav');
344		});
345
346		var lockSocial = $('#social-waypoint').waypoint(function(direction) {
347		  $('#vertical-social').toggleClass('lock_social');
348        });
349        
350        var hideSidebars = $('#hide_sidebars').waypoint(function(direction) {
351            $('.article-sidebar').fadeToggle();
352          });
353	}
354
355
356    // CLICK TO SHOW COMMENT FORM
357    var runComments = function(){
358        let btns = $('.comment-btn');
359        btns.each(function(){
360            $(this).click(function(){
361                $('#comments').addClass('show');
362            })
363        })
364    }
365
366	init();
367
368});

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.