PageSourceSearch

https://www.latestnewsresource.com/wp-content/themes/life/js/main.js

js latestnewsresource.com collected 2026-10-02 12:01:40 UTC 24,833 bytes, 839 lines download raw bytes

1/*
2	Name: TheBlogger
3	Description: Shape-Shifter Blog Theme
4	Version: 1.0
5	Author: pixelwars
6*/
7
8(function($) { "use strict"; 
9	
10	/* global variables */
11	var $masonry_container;
12	
13
14	// DOCUMENT READY
15	$(function() {
16		
17		
18		// FIX SIDEBAR INSTAGRAM
19		$('.sidebar .instagram-pics').wrap('<div class="instagram-pics-wrap"></div>');
20		$('.sidebar .null-instagram-feed > p').appendTo($('.instagram-pics-wrap'));
21		
22		
23		// FORMS
24		$('input:not([type=submit]):not([type=button]):not([type=file]):not([type=radio]):not([type=checkbox])').addClass('input-text');
25		
26				
27
28		// ------------------------------
29		// STICKY MENU
30		if($('html').hasClass('is-menu-sticky')) {
31			
32			// the element to be sticky
33			var theElement = $('html').hasClass('is-menu-bar') ? $('.site-navigation') : $('.site-header');
34			
35			// variables
36			var smart,
37				$orgElement,
38				$clonedElement,
39				orgElementTop,
40				currentScroll,
41				previousScroll = 0,
42				scrollDifference,
43				detachPoint = 650, // point of detach (after scroll passed it, menu is fixed)
44				hideShowOffset = 6, // scrolling value after which triggers hide/show menu
45				$html = $('html');
46
47				
48			// Create a clone of the menu, right next to original.
49			theElement.addClass('original').clone().insertAfter(theElement).addClass('cloned').removeClass('original');
50			
51			$orgElement = $('.original'); 
52			$clonedElement = $('.cloned'); 
53			
54			
55			smart = $('html').hasClass('is-menu-smart-sticky');
56			
57			// fix css max-width issue for the fixed positioned clone element
58			$clonedElement.width($orgElement.width());
59			$( window ).on( "resize", function() {
60				$clonedElement.width($orgElement.width());
61			});
62			
63			$( window ).on( "scroll", function() {
64				
65				currentScroll = $(this).scrollTop(), // gets current scroll position
66				scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
67				
68				// fix css max-width issue for the fixed positioned clone element
69				$clonedElement.width($orgElement.width());
70							
71				if (window.matchMedia("(min-width: 992px)").matches) {
72					
73					  orgElementTop = $orgElement.offset().top;  
74								   
75					  // Scrolled past the original position; now only show the cloned, sticky element.
76					  if (currentScroll >= (orgElementTop)) {
77						  
78						
79						// if : SMART STICKY 
80						if(smart) {
81							
82								// if scrolled past detach point add class to fix menu
83								if (currentScroll > detachPoint) 
84								{
85									if (!$html.hasClass('menu-detached')) {
86										$html.addClass('menu-detached');
87										}
88								}
89								  
90								// if scrolling faster than hideShowOffset hide/show menu
91								if (scrollDifference >= hideShowOffset) 
92								{
93									// scrolling down; hide menu  
94									if (currentScroll > previousScroll) 
95									{
96										if (!$html.hasClass('menu-invisible'))
97											$html.addClass('menu-invisible');
98									} 
99									// scrolling up; show menu
100									else 
101									{
102										if ($html.hasClass('menu-invisible'))
103											$html.removeClass('menu-invisible');
104									}
105								}
106						} // if : smart
107						
108						
109						// else : NORMAL STICKY
110						else {
111							$clonedElement.addClass('is-visible');
112							$orgElement.addClass('is-hidden');
113						}
114						
115					  }
116					  // Scrolled past the original position; now only show the cloned, sticky element.
117					  
118					  
119					  // NOT scrolled past the menu; only show the original menu.
120					  else 
121					  {
122						$clonedElement.removeClass('is-visible');
123						$orgElement.removeClass('is-hidden');
124						
125						if(smart) {
126							$html.removeClass('menu-detached').removeClass('menu-invisible');
127						} // if : smart
128						
129					  } 
130					  // NOT scrolled past the menu; only show the original menu.
131					  
132					  
133					  // replace previous scroll position with new one
134					  previousScroll = currentScroll;
135					  
136					
137					
138				} // > 991
139			  
140			}); // window on scroll
141			
142		} // STICKY MENU 
143		// ------------------------------	
144		
145		// ------------------------------
146		// STICKY: HEADER ROW & HEADER SMALL
147		window.addEventListener('scroll', function(e){
148			var distanceY = window.pageYOffset || document.documentElement.scrollTop,
149				shrinkOn = 300,
150				header = $('.is-header-row.is-menu-sticky .site-header.cloned, .is-header-small.is-menu-sticky .site-header.cloned');
151			if (distanceY > shrinkOn) {
152				header.addClass("smaller");
153			} else {
154				if (header.hasClass("smaller")) {
155					header.removeClass("smaller");
156				}
157			}
158		});
159		// ------------------------------
160
161
162
163		// ------------------------------	
164        // SEARCH TOGGLE
165        $('.search-toggle').on("click", function(e) {
166            e.stopPropagation();
167			var search_input = $(this).parent().find('.search-container input[type="search"]');
168            $('html').toggleClass('is-search-toggled-on');
169			if($('html').hasClass('is-search-toggled-on')) {
170				setTimeout(function() { search_input.trigger('focus'); },400);
171			}
172        });
173        // ------------------------------
174		
175
176
177		// ------------------------------	
178        // HEADER MENU TOGGLE
179        $('.menu-toggle').on("click", function(e) {
180            e.stopPropagation();
181            $('html').toggleClass('is-menu-toggled-on');
182        });
183        // ------------------------------
184		
185		
186		// ------------------------------
187		// MOBILE MENU
188		var $menu = $('.nav-menu');
189		
190		// add classes
191		$menu.find('li').each(function(index, element) {
192			if($(this).children('ul').length) {
193				$(this).addClass('has-submenu');
194				$(this).find('>a').after('<span class="submenu-toggle"></span>');
195			}
196		});
197		
198		var $submenuTrigger = $('.has-submenu > .submenu-toggle');
199		// submenu link click event
200		$submenuTrigger.on( "click", function() {
201			$(this).parent().toggleClass('active');
202			$(this).siblings('ul').toggleClass('active');
203		});
204		// ------------------------------
205		
206		
207		
208		/* Slider more-link clone */
209		$('.post-thumbnail .entry-header .more-link').each(function(index, element) {
210            $(this).clone().appendTo($(this).parents('.post-wrap')).addClass('outside');
211        });
212		
213		
214		// ------------------------------
215        // OWL-CAROUSEL
216		var owl = $('.owl-carousel');
217		if(owl.length) {
218			owl.each(function(index, element) {
219				//wait for images
220				$(element).imagesLoaded( function() {
221					
222					//remove loading
223					$(element).find('.loading').remove();
224					
225					var items = $(element).data('items');
226					$(element).owlCarousel({
227						mouseDrag : 		$(element).data('mouse-drag'),
228						pagination : 		$(element).data('dots'),
229						navigation : 		$(element).data('nav'),
230						autoPlay : 			$(element).data('autoplay') ? $(element).data('autoplay-timeout') : false,
231						stopOnHover :		true,
232						navigationText : 	false,
233						slideSpeed : 300,
234						rewindSpeed : 400,
235						autoHeight : true,
236						transitionStyle : $(element).data('animation'), // default = false(slide) / fade - backSlide - goDown - fadeUp 
237						itemsCustom : 		[[0, 1], [700, items <= 2 ? items : 2], [960, items <= 3 ? items : 3], [1260, items <= 4 ? items : 4]],
238						afterInit : function() {
239							
240							
241							// ------------------------------
242							// PARALLAX
243							var $container = $('.post-slider');
244							$('.post-slider .post-thumbnail').each(function() {
245								if($(this).data('parallax-video')) { //parallax video
246									$(this).jarallax({
247										speed: 0,
248										zIndex: 1,
249										elementInViewport: $container,
250										videoSrc: $(this).data('parallax-video')
251									});	
252								} else if($('html').hasClass('is-slider-parallax')) { //parallax image
253								   $(this).jarallax({
254									  elementInViewport: $container,
255									  zIndex : 1,
256									  speed: 0.6
257								   });
258								} // else if
259							}); // each
260							// ------------------------------
261							
262							
263						} // afterInit
264					}); // owlCarousel()
265
266				}); // wait for images
267			});	// owl.each()
268		}
269		// ------------------------------
270		
271		
272		
273		
274		// ------------------------------
275		// Fitvids.js : fluid width video embeds
276		$("body").fitVids({ customSelector: 'iframe[src*="facebook.com/plugins/video"], iframe[src*="facebook.com/video/embed"]' });
277		// preserve 16:9 aspect ratio for soundcloud embeds
278		$('iframe[src*="soundcloud.com"]').wrap('<div class="fluid-audio fluid-width-video-wrapper"></div>');
279		$('.fluid-width-video-wrapper').wrap('<div class="media-wrap"></div>');
280		// ------------------------------
281			
282		
283		// ------------------------------
284		// FluidBox : Zoomable Images
285		setupFluidbox();
286        // ------------------------------
287		
288		
289		// ------------------------------
290		// remove click delay on touch devices
291		FastClick.attach(document.body);
292		// ------------------------------
293		
294		
295		
296		// ------------------------------
297		// FORM VALIDATION
298		// comment form validation fix
299		$('#commentform, .post-password-form, .mc4wp-form form, .mc4wp-form').addClass('validate-form');
300		$('#commentform').find('input,textarea').each(function(index, element) {
301            if($(this).attr('aria-required') == "true") {
302				$(this).addClass('required');
303			}
304			if($(this).attr('name') == "email") {
305				$(this).addClass('email');
306			}
307		});
308		
309		// validate form
310		if($('.validate-form').length) {
311			$('.validate-form').each(function() {
312					$(this).validate();
313				});
314		}
315		// ------------------------------
316        
317        
318        
319		// ------------------------------
320		/* SOCIAL FEED WIDGET */
321		var socialFeed = $('.social-feed');
322		if(socialFeed.length) {
323			socialFeed.each(function() {
324				$(this).socialstream({
325					socialnetwork: $(this).data("social-network"),
326					limit: $(this).data("limit"),
327					username: $(this).data("username")
328				});
329			});	
330		}
331		// ------------------------------
332		
333		
334		// ------------------------------
335		// GALLERY COLLAGE LAYOUT
336		collage();
337		
338		var resizeTimer = null;
339		$(window).bind('resize', function() {
340			
341			// hide all the images until we resize them
342			// set the element you are scaling i.e. the first child nodes of ```.Collage``` to opacity 0
343			$('.gallery figure').css("opacity", 0);
344			// set a timer to re-apply the plugin
345			if (resizeTimer) clearTimeout(resizeTimer);
346			resizeTimer = setTimeout(collage, 1200);
347			collage();
348		});
349		// ------------------------------
350		
351		
352		// ------------------------------
353		// LIGHTBOX - applied to gallery post format  a[href*=".jpg"]
354		if($('.lightbox, .gallery, .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').length) {
355			$('.lightbox, .gallery,  .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').each(function(index, element) {
356				var $media_box = $(this);
357				$media_box.magnificPopup({
358				  delegate: '.lightbox, .gallery-item a, .portfolio-grid .lightbox',
359				  type: 'image',
360				  image: {
361					  markup: '<div class="mfp-figure">'+
362								'<div class="mfp-close"></div>'+
363								'<div class="mfp-img"></div>'+
364							  '</div>' +
365							  '<div class="mfp-bottom-bar">'+
366								'<div class="mfp-title"></div>'+
367								'<div class="mfp-counter"></div>'+
368							  '</div>', // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button
369					
370					  cursor: 'mfp-zoom-out-cur', // Class that adds zoom cursor, will be added to body. Set to null to disable zoom out cursor. 
371					  verticalFit: true, // Fits image in area vertically
372					  tError: '<a href="%url%">The image</a> could not be loaded.' // Error message
373					},
374					gallery: {
375					  enabled:true,
376					  tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter
377					},
378				  iframe: {
379					 markup: '<div class="mfp-iframe-scaler">'+
380								'<div class="mfp-close"></div>'+
381								'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
382								'<div class="mfp-title">Some caption</div>'+
383							  '</div>'
384				  },
385				  mainClass: 'mfp-zoom-in',
386				  tLoading: '',
387				  removalDelay: 300, //delay removal by X to allow out-animation
388				  callbacks: {
389					markupParse: function(template, values, item) {
390						  var title = "";
391						  if(item.el.parents('.gallery-item').length) {
392							  title = item.el.parents('.gallery-item').find('.gallery-caption').text();	  
393						  } else {
394							  title = item.el.attr('title') == undefined ? "" : item.el.attr('title');
395							  }
396						  //return title;
397					 	values.title = title;
398					},
399					imageLoadComplete: function() {
400					  var self = this;
401					  setTimeout(function() {
402						self.wrap.addClass('mfp-image-loaded');
403					  }, 16);
404					},
405					close: function() {
406					  this.wrap.removeClass('mfp-image-loaded');
407					},
408					beforeAppend: function() {
409						var self = this;
410						this.content.find('iframe').on('load', function() {
411						  setTimeout(function() {
412							self.wrap.addClass('mfp-image-loaded');
413						  }, 16);
414						});
415					 }
416				  },
417				  closeBtnInside: false,
418				  closeOnContentClick: true,
419				  midClick: true
420				});
421			});	
422		}
423		// ------------------------------
424		
425		
426		
427		// ------------------------------
428		// MASONRY - ISOTOPE
429		$masonry_container = $('.masonry');
430		if($masonry_container.length) {
431			$masonry_container.imagesLoaded(function() {
432				$masonry_container.width($masonry_container.parent().width());
433				// initialize isotope
434				$masonry_container.isotope({
435				  itemSelector : '.hentry',
436				  layoutMode : $masonry_container.data('layout'),
437				  //transitionDuration: 0
438				});
439				
440				
441				// filters
442				if ($masonry_container.data('isotope')) {
443					var filters = $('.filters');
444					if(filters.length) {
445						filters.find('a').on("click", function() {
446							//alert('hoyt');
447							var selector = $(this).attr('data-filter');
448							  $masonry_container.isotope({ filter: selector });
449							  $(this).parent().addClass('current').siblings().removeClass('current');
450							  return false;
451						});
452					}
453				}
454				
455				setMasonry();
456				setTimeout(function() { $masonry_container.isotope(); }, 20);	
457				$(window).resize(function() {
458					// hack : make container width fixed
459					$masonry_container.width($masonry_container.parent().width());
460					setMasonry();					
461				});
462			});
463		}
464		// ------------------------------
465		
466        
467		
468		// ------------------------------
469		// POST THUMBNAILS
470        if($('.post-thumbnail').length) {
471					
472			var fixWaitTime;
473			$(window).on('resize', function () { 
474				clearTimeout(fixWaitTime);
475				fixWaitTime = setTimeout(function() { 
476					fixText(); 
477				} , 500);
478			});	
479			
480		  setTimeout(function() { 
481		  	fixText();
482			} , 300);
483        }
484		// ------------------------------
485		
486		
487		
488	
489		// ------------------------------
490        // FULL WIDTH IMAGES
491		fullWidthImages();
492		// ------------------------------
493		
494		
495		// ------------------------------
496		// HOME LANDING FULLSCREEN VIDEO
497		var fs_video = $('.intro-vid');
498		if(fs_video.length) {
499			//fs_video.wrap( "<div class='fs-video'></div>" );
500			//fs_video = $('.fs-video');
501			bgVideo(fs_video);
502			$( window ).resize(function() {
503				bgVideo(fs_video);
504				//setTimeout(bgVideo(fs_video), 1500);
505			});
506		}
507		
508		var resizeTimerVideo = null;
509		$(window).bind('resize', function() {
510			if(resizeTimerVideo) { 
511				clearTimeout(resizeTimerVideo);
512			}
513			resizeTimerVideo = setTimeout(bgVideo(fs_video), 200);
514		});
515		// ------------------------------
516		
517		
518		
519		
520		// ------------------------------
521		// PARALLAX VIDEO
522		var video_parallax = $(".header-wrap, .intro, .post-thumbnail");
523		video_parallax.each(function() {
524			if($(this).data('parallax-video')) {
525				$(this).jarallax({
526					speed: 0,
527					zIndex: 1,
528					videoSrc: $(this).data('parallax-video')
529				});	
530			}
531        });
532		
533		// PARALLAX HEADER BG IMAGE
534		$('.is-header-parallax .header-wrap').jarallax({
535			zIndex: 1,
536			speed: 0.6
537		});
538		
539		// PARALLAX INTRO BG IMAGE
540		$('.is-intro-parallax .intro').jarallax({ 
541			zIndex: 1,
542			speed: -0.2	//from -1.0 to 2.0
543		});		
544		
545		// PARALLAX OVERLAY POST OVERLAY MEDIUM
546		$('.is-top-content-single-medium .post-thumbnail').jarallax({
547			zIndex: 1,
548			speed: 0.6
549		});	
550		
551		// PARALLAX OVERLAY POST OVERLAY FULL/FULL MARGINS
552		$('.is-top-content-single-full .post-thumbnail, .is-top-content-single-full-margins .post-thumbnail').jarallax({
553			zIndex: 1,
554			speed: -0.2
555		});	
556		
557		// PARALLAX OVERLAY POST OVERLAY INLINE
558		$('.post-header-overlay-inline .post-thumbnail').jarallax({
559			zIndex: 1,
560			speed: 0.7
561		});
562		
563		// PARALLAX INTRO BOXES
564		$('.is-link-box-parallax .link-box .post-thumbnail').jarallax({
565			zIndex : 1,
566			speed: 0.7
567		});
568		// PARALLAX RELATED POSTS
569		$('.is-related-posts-parallax .related-posts .post-thumbnail').jarallax({
570			zIndex : 1,
571			speed: 0.8
572		});
573		
574		// PARALLAX IMAGE IN POST
575		parallaxImages();
576		// ------------------------------
577		
578		
579		
580		// ------------------------------
581		// STICKY REGIONS
582		sticky_regions();
583		// ------------------------------
584		
585		
586		
587
588		
589		
590    });
591    // DOCUMENT READY
592	
593	
594	
595	
596	// WINDOW ONLOAD
597	window.onload = function() {
598		
599		// html addclass : loaded
600		$('html').addClass('loaded');
601	
602		
603		// STICKY REGIONS
604		sticky_regions();
605		
606		
607		// ------------------------------
608		// POST THUMBNAILS
609        if($('.post-thumbnail').length) {
610		  setTimeout(function() { 
611		  	fixText();
612			} , 300);
613        }
614		// ------------------------------
615				
616		// fix full-width-image
617		resizeFullWidthImage();
618		
619		// intro video bg
620		bgVideo($('.intro-vid'));
621		
622	};
623	// WINDOW ONLOAD
624	
625	
626	
627	
628	// -------------------------------------------------
629	// FUNCTIONS
630	
631	
632	
633	// ------------------------------
634	// STICKY REGIONS
635	function sticky_regions() {
636		jQuery.support.touch = 'ontouchend' in document;
637		if (window.matchMedia("(min-width: 992px)").matches && !(jQuery.support.touch)) {
638			$(".is-sidebar-sticky .sidebar-content").stick_in_parent({ 
639				offset_top: 80, 
640				parent: '.site-main > div',
641				spacer: '.sidebar-wrap'
642				});
643		}
644	}
645	// ------------------------------
646	
647	
648	// ------------------------------
649	// FULL SCREEN BG VIDEO
650	function bgVideo(fs_video) {
651		
652		var videoW = fs_video.find('iframe, video').width(),
653			videoH = fs_video.find('iframe, video').height(),
654			screenW = $('.intro').outerWidth(),
655			screenH = $('.intro').outerHeight();
656			
657		var video_ratio =  videoW / videoH;
658		var screen_ratio = screenW / screenH;
659		
660		if(video_ratio > screen_ratio) {
661			var diffW = screenH / videoH;
662			var newWidth = videoW  * diffW;				
663			fs_video.css( {'width' : newWidth, 'margin-left' : -((newWidth-screenW)/2), 'margin-top' : 0 });	
664		} else {
665			var diffH = screenH / videoH;
666			var newHeight = screenH  * diffH;	
667			fs_video.css( {'width' : "100%", 'margin-left' : 0, 'margin-top' : -((videoH-screenH)/2) });		
668		}
669	}
670	// ------------------------------
671	
672	
673	
674	// ------------------------------
675	// FULL WIDTH IMAGES
676	function parallaxImages() { 
677		$('img.parallax').each(function(index, element) {
678			var img = $(element);
679			img.imagesLoaded(function() {
680				
681				$('<div class="parallax-image"><div class="parallax-image-holder"></div</div>').insertBefore(img);
682				
683				var wrapper = img.prev('.parallax-image');
684				var holder = wrapper.find('.parallax-image-holder');
685				
686				holder.css('background-image', 'url(' + img.attr('src') + ')');
687				img.hide();
688				wrapper.append(img);
689				setParallaxImageHeight();
690							
691				// PARALLAX EFFECT
692				var aspect_ratio = img.width() / img.height();
693				var speed = aspect_ratio > 1.2 ? 0.2 : -0.9;
694				speed = $('.content-area').hasClass('with-sidebar') ? 0.2 : speed;
695				holder.jarallax({
696					zIndex: 1,
697					speed: speed
698				});	
699				
700			});
701        });
702		// adapt screen on resize
703		$( window ).resize(function() {
704			setParallaxImageHeight();
705		});
706	}
707	function setParallaxImageHeight() {
708		$('.parallax-image').each(function(index, element) {
709			
710			var windowH = $(window).height();
711			var minH = $(this).find('img').hasClass('half') ? windowH / 2 : windowH;
712			var minH = $('.content-area').hasClass('with-sidebar') ? $(this).width() : minH;
713			var minH = ( $('.content-area').hasClass('with-sidebar') && $(this).find('img').hasClass('half') ) ? $(this).width() / 2 : minH;
714
715			$(this).css("min-height", minH);
716			$(this).find('.parallax-image-holder').css("height", minH);  
717			
718		});	
719	}
720	// ------------------------------
721	
722	
723	
724	// ------------------------------
725	// FULL WIDTH IMAGES
726	function fullWidthImages() { 
727		var isFullable = window.matchMedia("(max-width: 991px)").matches || !($('.content-area').hasClass('with-sidebar'));
728		if(isFullable) {
729			$('.content-area img.full').each(function(index, element) {
730				var full_img = element;
731				$(full_img).imagesLoaded(function() {
732					$('<div class="full-width-image"></div>').insertBefore(full_img);
733					var wrapper = $(full_img).prev('.full-width-image');
734					wrapper.append(full_img);
735					var minH = $(full_img).height() !== 0 ? $(full_img).height() : $(full_img).find('img').height();
736					wrapper.css("min-height", minH);
737				});
738			});
739			// adapt screen on resize
740			$( window ).resize(function() {
741				resizeFullWidthImage();
742			});
743			
744		}
745	}
746	function resizeFullWidthImage() {
747		$('.full-width-image').each(function(index, element) {
748			$(this).css("min-height", $(this).find('img').height());    
749		});	
750	}
751	// ------------------------------
752	
753	// ------------------------------
754	// FluidBox : Zoomable Images
755	// $('.entry-content > p a, .wp-caption a, [data-rel="prettyPhoto[product-gallery]"]').each(function(index, element) {
756	window.setupFluidbox = function() { 
757		$('.entry-content > p a, .wp-caption a, a.zoom').each(function(index, element) {
758			
759			// prevent conflict with the woocommerce lightbox - both have zoom class
760			if($('body').hasClass('woocommerce')) {
761				return;	
762			}
763			if($(this).attr('href').match(/\.(jpeg|jpg|gif|png)$/) != null) {
764				$(this).fluidbox();
765				}
766		});
767	}
768	// ------------------------------
769	
770
771	
772	
773	// ------------------------------
774	// POST THUMBNAILS FIX TEXT	
775	function fixText() {
776		$('.slider-box .entry-title').fitText($('html').data('title-ratio') , { minFontSize: '12px', maxFontSize: '220px' });
777		$('.link-box .entry-title').fitText($('html').data('link-box-title-ratio') , { minFontSize: '12px' });
778		$('.post-thumbnail .entry-header').addClass('ready');
779	}
780	// ------------------------------
781	
782	
783	
784	// ------------------------------
785	// GALLERY COLLAGE LAYOUT
786	function collage() {
787		var collage = $('.gallery');
788		if(collage.length) {
789			
790			collage.each(function(index, el) {
791				
792				// wait for images to be loaded
793				$(el).imagesLoaded(function() {
794					
795					$(el).removeClass('pw-collage-loading');
796					$(el).collagePlus({
797						
798						//'targetHeight' : collage.data('row-height'),
799						'targetHeight' : 360,
800						'effect' : 'effect-4',
801						'allowPartialLastRow' : false
802						
803					}); //collagePlus()
804					
805				}); //imagesLoaded()
806				
807			}); //each
808		}
809	}
810	// ------------------------------
811	
812	
813	
814	// ------------------------------
815	// MASONRY LAYOUT : changes the number of masonry columns based on the current container's width
816	function setMasonry() {
817		
818		var itemW = $masonry_container.data('item-width');
819		var containerW = $masonry_container.width();
820		var items = $masonry_container.children('.hentry');
821		var columns = Math.round(containerW/itemW);
822		$masonry_container.removeClass('col-1 col-2 col-3 col-4- col-5 col-6 col-7- col-8').addClass('col-' + columns);
823	
824		// set the widths (%) for each of item
825		items.each(function(index, element) {
826			var multiplier = ($masonry_container.hasClass('first-full') && index == 0) && columns > 1 ? 2 : 1;
827			var itemRealWidth = (Math.floor( containerW / columns ) * 100 / containerW) * multiplier ;
828			itemRealWidth = itemRealWidth > 100 ? 100 : itemRealWidth;
829			$(this).css( 'width', itemRealWidth + '%' );
830		});
831	
832		var columnWidth = Math.floor( containerW / columns );
833		$masonry_container.isotope( 'option', { masonry: { columnWidth: columnWidth } } );
834	}
835	// ------------------------------
836	
837	
838	
839})(jQuery);

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.