PageSourceSearch

https://www.nbs4india.org/wp-content/themes/green-planet/theme-fra…/js/jquery.isotope.mode.js?ver=1.0.0

js nbs4india.org collected 2026-10-04 06:52:46 UTC 26,755 bytes, 949 lines download raw bytes

1/**
2 * @package 	WordPress
3 * @subpackage 	Green Planet
4 * @version		1.0.9
5 * 
6 * Modes & Functions for jQuery Isotope Plugin
7 * Created by CMSMasters
8 * 
9 */
10
11
12"use strict";
13
14/* iLightbox Settings */
15var ilightbox_settings = { 
16	skin : 					cmsmasters_isotope_mode.ilightbox_skin, 
17	path : 					cmsmasters_isotope_mode.ilightbox_path, 
18	infinite : 				(cmsmasters_isotope_mode.ilightbox_infinite == '1') ? true : false, 
19	keepAspectRatio : 		(cmsmasters_isotope_mode.ilightbox_aspect_ratio == '1') ? true : false, 
20	mobileOptimizer : 		(cmsmasters_isotope_mode.ilightbox_mobile_optimizer == '1') ? true : false, 
21	maxScale : 				Number(cmsmasters_isotope_mode.ilightbox_max_scale), 
22	minScale : 				Number(cmsmasters_isotope_mode.ilightbox_min_scale), 
23	innerToolbar : 			(cmsmasters_isotope_mode.ilightbox_inner_toolbar == '1') ? true : false, 
24	smartRecognition : 		(cmsmasters_isotope_mode.ilightbox_mobile_optimizer == '1') ? true : false, 
25	fullAlone : 			(cmsmasters_isotope_mode.ilightbox_fullscreen_one_slide == '1') ? true : false, 
26	fullViewPort : 			cmsmasters_isotope_mode.ilightbox_fullscreen_viewport, 
27	controls : { 
28		toolbar : 			(cmsmasters_isotope_mode.ilightbox_controls_toolbar == '1') ? true : false, 
29		arrows : 			(cmsmasters_isotope_mode.ilightbox_controls_arrows == '1') ? true : false, 
30		fullscreen : 		(cmsmasters_isotope_mode.ilightbox_controls_fullscreen == '1') ? true : false, 
31		thumbnail : 		(cmsmasters_isotope_mode.ilightbox_controls_thumbnail == '1') ? true : false, 
32		keyboard : 			(cmsmasters_isotope_mode.ilightbox_controls_keyboard == '1') ? true : false, 
33		mousewheel : 		(cmsmasters_isotope_mode.ilightbox_controls_mousewheel == '1') ? true : false, 
34		swipe : 			(cmsmasters_isotope_mode.ilightbox_controls_swipe == '1') ? true : false, 
35		slideshow : 		(cmsmasters_isotope_mode.ilightbox_controls_slideshow == '1') ? true : false 
36	}, 
37	text : { 
38		close : 			cmsmasters_isotope_mode.ilightbox_close_text, 
39		enterFullscreen : 	cmsmasters_isotope_mode.ilightbox_enter_fullscreen_text, 
40		exitFullscreen : 	cmsmasters_isotope_mode.ilightbox_exit_fullscreen_text, 
41		slideShow : 		cmsmasters_isotope_mode.ilightbox_slideshow_text, 
42		next : 				cmsmasters_isotope_mode.ilightbox_next_text, 
43		previous : 			cmsmasters_isotope_mode.ilightbox_previous_text 
44	}, 
45	errors : { 
46		loadImage : 		cmsmasters_isotope_mode.ilightbox_load_image_error, 
47		loadContents : 		cmsmasters_isotope_mode.ilightbox_load_contents_error, 
48		missingPlugin : 	cmsmasters_isotope_mode.ilightbox_missing_plugin_error 
49	} 
50};
51
52
53
54/* Isotope Timeline Layout Mode */
55(function(window, factory) {
56	factory(window.Isotope.LayoutMode);
57} (window, function factory(LayoutMode) {
58	'use strict';
59	
60	
61	var Timeline = LayoutMode.create('Timeline'), 
62		proto = Timeline.prototype;
63	
64	
65	proto._resetLayout = function () { 
66		this.Timeline = { 
67			colA : 0, 
68			colB : 0, 
69			arrayLeft : [], 
70			arrayRight : [], 
71			postMargin : 40, 
72			dateHeight : 110 
73		};
74	};
75	
76	
77	proto._getItemLayoutPosition = function (item) {
78		item.getSize();
79		
80		
81		var props = 	this.Timeline, 
82			centerX = 	Math.round(this.isotope.size.innerWidth / 2), 
83			isColA = 	props.colA <= props.colB, 
84			x = 		isColA ? 
85							centerX - item.size.outerWidth : // left side 
86							centerX, // right side 
87			yCache = 	isColA ? props.colA : props.colB, 
88			y = 		yCache, 
89			minMargin = props.postMargin;
90		
91		
92		if (isColA) {
93			jQuery(item.element).addClass('cmsmasters_timeline_left');
94			jQuery(item.element).removeClass('cmsmasters_timeline_right');
95			
96			
97			if (props.arrayRight.length > 0) {
98				for (var i = 0, il = props.arrayRight.length; i < il; i += 1) {
99					if (y < props.arrayRight[i] + props.dateHeight) {
100						minMargin = props.dateHeight;
101						
102						
103						y = props.arrayRight[i] + minMargin;
104					} else {
105						y = yCache + minMargin;
106					}
107				}
108			}
109			
110			
111			props.arrayLeft.push(y);
112		} else {
113			jQuery(item.element).addClass('cmsmasters_timeline_right');
114			jQuery(item.element).removeClass('cmsmasters_timeline_left');
115			
116			
117			if (props.arrayLeft.length > 0) {
118				for (var j = 0, jl = props.arrayLeft.length; j < jl; j += 1) {
119					if (y < props.arrayLeft[j] + props.dateHeight) {
120						minMargin = props.dateHeight;
121						
122						
123						y = props.arrayLeft[j] + minMargin;
124					} else {
125						y = yCache + minMargin;
126					}
127				}
128			}
129			
130			
131			props.arrayRight.push(y);
132		}
133		
134		
135		props[(isColA ? 'colA' : 'colB')] = item.size.outerHeight + y;
136		
137		
138		var position = {
139			x: x,
140			y: y
141		};
142		
143		
144		return position;
145	};
146	
147	
148	proto._getContainerSize = function () { 
149		var size = {};
150		
151		
152		size.height = this.Timeline[(this.Timeline.colB > this.Timeline.colA ? 'colB' : 'colA')];
153		
154		
155		return size;
156	};
157
158
159	return Timeline;
160}));
161
162
163
164
165
166/* ========== Isotope Run ========== */
167
168/* Filter Button Click Function */
169jQuery('.cmsmasters_items_filter_but').on('click', function () { 
170	var filter_block = jQuery(this).closest('.cmsmasters_items_filter_block'), 
171		filter_list = filter_block.find('.cmsmasters_items_filter_list');
172	
173	if (jQuery(this).hasClass('current')) {
174		jQuery(this).removeClass('current');
175		
176		filter_list.hide(300);
177	} else {
178		jQuery(this).addClass('current');
179		
180		filter_list.show(300);
181	}
182} );
183
184
185/* Get Columns Width Function */
186function getNumbColumns(container) { 
187	var containerWidth = container.width(), 
188		firstPost = container.find('> article:eq(0), .cmsmasters_gallery_item:eq(0)'), 
189		postMinWidth = Number(firstPost.css('minWidth').replace('px', '')), 
190		maxColumnNumb = Math.floor(containerWidth / postMinWidth), 
191		columnNumb = 1, 
192		layoutGrid = false;
193	
194	
195	if (
196		container.parent().data('layoutMode') === 'perfect' || 
197		container.parent().data('layoutMode') === 'grid' || 
198		container.parent().data('type') === 'grid' 
199	) {
200		layoutGrid = true;
201	}
202	
203	
204	maxColumnNumb = (maxColumnNumb !== 0) ? maxColumnNumb : 1;
205	
206	
207	if (container.hasClass('cmsmasters_5')) {
208		columnNumb = 5;
209	} else if (container.hasClass('cmsmasters_4')) {
210		columnNumb = 4;
211	} else if (container.hasClass('cmsmasters_3')) {
212		columnNumb = 3;
213	} else if (container.hasClass('cmsmasters_2')) {
214		columnNumb = 2;
215	}
216	
217	
218	if (maxColumnNumb < columnNumb) {
219		if (layoutGrid && columnNumb == 4 && maxColumnNumb == 3) {
220			columnNumb = 2;
221		} else if (layoutGrid && columnNumb == 3 && maxColumnNumb == 2) {
222			columnNumb = 1;
223		} else {
224			columnNumb = maxColumnNumb;
225		}
226	}
227	
228	
229	return columnNumb;
230}
231
232
233
234/* Set Columns Width Function */
235function setColumnWidth(container) { 
236	var containerWidth = container.width(), 
237		columnNumb = getNumbColumns(container), 
238		postWidth = Math.floor(containerWidth / columnNumb) - 1;
239	
240	
241	container.find('> article, .cmsmasters_gallery_item').each(function () { 
242		jQuery(this).css( { 
243			width : postWidth + 'px' 
244		} );
245	} );
246}
247
248
249
250/* Rearrange Posts Function */
251function reArrangePosts(blog, blogColumns) { 
252	if (blogColumns) {
253		setColumnWidth(blog);
254	}
255	
256	
257	blog.isotope('layout');
258}
259
260
261
262/* Set Puzzle Columns Width Function */
263function setPuzzleColumnWidth(container) { 
264	var containerWidth = container.width(), 
265		firstPost = container.find('> article:eq(0)'), 
266		postMinWidth = Number(firstPost.css('minWidth').replace('px', '')), 
267		postPaddingLeft = Number(firstPost.css('paddingLeft').replace('px', '')), 
268		postPaddingRight = Number(firstPost.css('paddingRight').replace('px', '')), 
269		postStaticWidth = Math.floor(containerWidth / 4), 
270		postStaticHeight = Math.floor((postStaticWidth / 100) * (cmsmasters_isotope_mode.project_puzzle_proportion * 100)/* preloader padding bottom in % */), 
271		postStaticPadding = Math.floor(((postPaddingLeft + postPaddingRight) / 100) * (cmsmasters_isotope_mode.project_puzzle_proportion * 100)/* preloader padding bottom in % */), 
272		postWidth = postStaticWidth, 
273		postHeight = postStaticHeight;
274	
275	
276	if (containerWidth < postMinWidth * 4) {
277		container.addClass('resp_portfolio_puzzle');
278	} else {
279		container.removeClass('resp_portfolio_puzzle');
280	}
281	
282	
283	container.find('article.project').each(function () { 
284		if (jQuery(this).hasClass('four_x_four')) {
285			postWidth = postStaticWidth * 4;
286			postHeight = (postStaticHeight * 4) - postStaticPadding;
287		} else if (jQuery(this).hasClass('three_x_three')) {
288			if (containerWidth > postMinWidth * 4) {
289				postWidth = postStaticWidth * 3;
290				postHeight = (postStaticHeight * 3) - postStaticPadding;
291			} else if (containerWidth > postMinWidth * 2) {
292				postWidth = postStaticWidth * 2;
293				postHeight = (postStaticHeight * 2) - postStaticPadding;
294			} else {
295				postWidth = postStaticWidth * 4;
296				postHeight = (postStaticHeight * 4) - postStaticPadding;
297			}
298		} else if (jQuery(this).hasClass('three_x_two')) {
299			if (containerWidth > postMinWidth * 4) {
300				postWidth = postStaticWidth * 3;
301				postHeight = (postStaticHeight * 2) - postStaticPadding;
302			} else if (containerWidth > postMinWidth * 2) {
303				postWidth = postStaticWidth * 2;
304				postHeight = Math.floor((postStaticHeight * 4) / 3) - postStaticPadding;
305			} else {
306				postWidth = postStaticWidth * 4;
307				postHeight = Math.floor((postStaticHeight * 8) / 3) - postStaticPadding;
308			}
309		} else if (jQuery(this).hasClass('three_x_one')) {
310			if (containerWidth > postMinWidth * 4) {
311				postWidth = postStaticWidth * 3;
312				postHeight = postStaticHeight - postStaticPadding;
313			} else if (containerWidth > postMinWidth * 2) {
314				postWidth = postStaticWidth * 2;
315				postHeight = Math.floor((postStaticHeight * 2) / 3) - postStaticPadding;
316			} else {
317				postWidth = postStaticWidth * 4;
318				postHeight = Math.floor((postStaticHeight * 4) / 3) - postStaticPadding;
319			}
320		} else if (jQuery(this).hasClass('two_x_three')) {
321			if (containerWidth > postMinWidth * 2) {
322				postWidth = postStaticWidth * 2;
323				postHeight = (postStaticHeight * 3) - postStaticPadding;
324			} else {
325				postWidth = postStaticWidth * 4;
326				postHeight = (postStaticHeight * 6) - postStaticPadding;
327			}
328		} else if (jQuery(this).hasClass('two_x_two')) {
329			if (containerWidth > postMinWidth * 2) {
330				postWidth = postStaticWidth * 2;
331				postHeight = (postStaticHeight * 2) - postStaticPadding;
332			} else {
333				postWidth = postStaticWidth * 4;
334				postHeight = (postStaticHeight * 4) - postStaticPadding;
335			}
336		} else if (jQuery(this).hasClass('two_x_one')) {
337			if (containerWidth > postMinWidth * 2) {
338				postWidth = postStaticWidth * 2;
339				postHeight = postStaticHeight - postStaticPadding;
340			} else {
341				postWidth = postStaticWidth * 4;
342				postHeight = (postStaticHeight * 2) - postStaticPadding;
343			}
344		} else if (jQuery(this).hasClass('one_x_three')) {
345			if (containerWidth > postMinWidth * 4) {
346				postWidth = postStaticWidth;
347				postHeight = (postStaticHeight * 3) - postStaticPadding;
348			} else if (containerWidth > postMinWidth * 2) {
349				postWidth = postStaticWidth * 2;
350				postHeight = (postStaticHeight * 6) - postStaticPadding;
351			} else {
352				postWidth = postStaticWidth * 4;
353				postHeight = (postStaticHeight * 12) - postStaticPadding;
354			}
355		} else if (jQuery(this).hasClass('one_x_two')) {
356			if (containerWidth > postMinWidth * 4) {
357				postWidth = postStaticWidth;
358				postHeight = (postStaticHeight * 2) - postStaticPadding;
359			} else if (containerWidth > postMinWidth * 2) {
360				postWidth = postStaticWidth * 2;
361				postHeight = (postStaticHeight * 4) - postStaticPadding;
362			} else {
363				postWidth = postStaticWidth * 4;
364				postHeight = (postStaticHeight * 8) - postStaticPadding;
365			}
366		} else if (jQuery(this).hasClass('one_x_one')) {
367			if (containerWidth > postMinWidth * 4) {
368				postWidth = postStaticWidth;
369				postHeight = postStaticHeight - postStaticPadding;
370			} else if (containerWidth > postMinWidth * 2) {
371				postWidth = postStaticWidth * 2;
372				postHeight = (postStaticHeight * 2) - postStaticPadding;
373			} else {
374				postWidth = postStaticWidth * 4;
375				postHeight = (postStaticHeight * 4) - postStaticPadding;
376			}
377		}
378		
379		
380		jQuery(this).css( { 
381			width : postWidth + 'px' 
382		} );
383		
384		
385		jQuery(this).find('.project_outer').css( { 
386			height : postHeight + 'px' 
387		} );
388		
389		
390		jQuery(this).find('.preloader').css( { 
391			paddingBottom : postHeight + 'px' 
392		} );
393	} );
394}
395
396
397
398/* Rearrange Projects Function */
399function reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle) { 
400	if (portfolioGrid) {
401		setColumnWidth(portfolio);
402	} else if (portfolioPuzzle) {
403		setPuzzleColumnWidth(portfolio);
404	}
405	
406	
407	portfolio.isotope('layout');
408}
409
410
411
412/* Start Blog Isotope Function */
413function startBlog(id, layout, layoutMode, url, orderby, order, count, categories, metadata) { 
414	var blogContainer = 	jQuery(id), 
415		blog = 				blogContainer.find('> .blog'), 
416		blogColumns = 		(layout === 'columns') ? true : false;
417	
418	
419	if (blogContainer.find('article').length == 0) {
420		return false;
421	}
422	
423	
424	if (blogColumns) {
425		setColumnWidth(blog);
426	}
427	
428	
429	blog.imagesLoaded(function () { 
430		blog.isotope( { 
431			itemSelector : 	'article.post' 
432		} );
433		
434		
435		if (!blog.hasClass('isotope')) {
436			blog.addClass('isotope');
437		}
438		
439		
440		if (layout === 'columns' && (layoutMode === 'grid' || layoutMode === 'puzzle')) {
441			blog.isotope( { 
442				layoutMode : 	'fitRows', 
443				resizable : 	false 
444			} );
445		} else if (layout === 'columns' && layoutMode === 'masonry') {
446			blog.isotope( { 
447				layoutMode : 	'masonry', 
448				resizable : 	true 
449			} );
450		}
451	} );
452	
453	
454	blogContainer.find('.cmsmasters_post_filter_block .cmsmasters_post_filter_list a').on('click', function () { 
455		var filter = 			jQuery(this), 
456			filterSelector = 	filter.attr('data-filter');
457		
458		
459		filter.parent().parent().find('> li.current').removeClass('current');
460		
461		
462		filter.parent().addClass('current');
463		
464		
465		blog.isotope( { 
466			filter : 	filterSelector 
467		} );
468		
469		
470		setTimeout(function () { 
471			reArrangePosts(blog, blogColumns);
472		}, 300);
473		
474		
475		return false;
476	} );
477	
478	
479	blogContainer.find('.cmsmasters_post_loader').on('click', function () { 
480		blogContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
481		
482		jQuery.ajax( { 
483			type : 		'POST', 
484			dataType : 	'html', 
485			url : 		url + 'inc/post/posts-loader.php', 
486			data : { 
487				layout : 		layout, 
488				layoutmode: 	layoutMode, 
489				orderby : 		orderby, 
490				order : 		order, 
491				count : 		count, 
492				categories : 	categories, 
493				metadata : 		metadata, 
494				offset : 		blog.find('.post').length 
495			}, 
496			success : function (data) { 
497				if (data !== '') {
498					var newHTML = '', 
499						lightboxVars = [];
500					
501					
502					if (data.slice(0, 6) === 'finish') {
503						newHTML = jQuery(data.replace(/cmsmasters_post_timeline/g, 'cmsmasters_post_timeline shortcode_animated').replace(/cmsmasters_post_masonry/g, 'cmsmasters_post_masonry shortcode_animated').slice(6, -1));
504						
505						
506						blogContainer.find('.cmsmasters_wrap_more_items').hide();
507					} else {
508						newHTML = jQuery(data.replace(/cmsmasters_post_timeline/g, 'cmsmasters_post_timeline shortcode_animated').replace(/cmsmasters_post_masonry/g, 'cmsmasters_post_masonry shortcode_animated'));
509
510						blogContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
511					}
512					
513					
514					newHTML.find('a[rel^="ilightbox["]').each(function () { 
515						if (jQuery.inArray(jQuery(this).attr('rel'), lightboxVars) === -1) {
516							lightboxVars.push(jQuery(this).attr('rel'));
517						}
518					} );
519					
520					
521					newHTML.imagesLoaded(function () { 
522						blogContainer.find('.blog').isotope('insert', newHTML);
523						
524						
525						setTimeout(function () { 
526							jQuery('body').trigger('debouncedresize');
527							
528							
529							reArrangePosts(blog, blogColumns);
530							
531							
532							var settings = {};
533							
534							
535							if (typeof _wpmejsSettings !== 'undefined') {
536								settings.pluginPath = _wpmejsSettings.pluginPath;
537							}
538							
539							
540							jQuery('.wp-audio-shortcode, .wp-video-shortcode').filter(':not(.mejs-container)').mediaelementplayer(settings);
541							
542							
543							for (var i = 0, il = lightboxVars.length; i < il; i += 1) { 
544								blogContainer.find('a[rel="' + lightboxVars[i] + '"]').iLightBox(ilightbox_settings);
545							}
546						}, 300);
547					} );
548				}
549			} 
550		} );
551		
552		
553		return false;
554	} );
555
556
557	jQuery(window).on('debouncedresize', function () { 
558		reArrangePosts(blog, blogColumns);
559	} );
560}
561
562
563
564/* Start Portfolio Isotope Function */
565function startPortfolio(id, layout, layoutMode, url, orderby, order, count, categories, metadata) { 
566	var portfolioContainer = 	jQuery(id), 
567		portfolio = 			portfolioContainer.find('> .portfolio'), 
568		portfolioGrid = 		(layout === 'grid') ? true : false, 
569		portfolioPuzzle = 		(layout === 'puzzle') ? true : false;
570	
571	
572	if (portfolioContainer.find('article').length == 0) {
573		return false;
574	}
575	
576	
577	if (portfolioGrid) {
578		setColumnWidth(portfolio);
579	} else if (portfolioPuzzle) {
580		setPuzzleColumnWidth(portfolio);
581	}
582	
583	
584	portfolio.imagesLoaded(function () {
585		if (!portfolio.hasClass('isotope')) {
586			portfolio.addClass('isotope');
587		}
588		
589		
590		if (portfolioGrid) {
591			portfolio.isotope( { 
592				itemSelector : 	'article.project', 
593				getSortData : { 
594					project_name : function (el) { 
595						return jQuery(el).find('.entry-title > a').text();
596					}, 
597					project_date : function (el) { 
598						return parseInt(jQuery(el).find('.meta-date').text());
599					} 
600				} 
601			} );
602			
603			
604			if (layoutMode === 'perfect') {
605				portfolio.isotope( { 
606					layoutMode : 	'fitRows', 
607					resizable : 	false 
608				} );
609			} else if (layoutMode === 'masonry') {
610				portfolio.isotope( { 
611					layoutMode : 	'masonry', 
612					resizable : 	true 
613				} );
614			}
615		} else if (portfolioPuzzle) {
616			portfolio.isotope( { 
617				itemSelector : 	'article.project', 
618				layoutMode : 	'masonry', 
619				resizable : 	false, 
620				masonry : { 
621					columnWidth : Math.floor(portfolio.width() / 4) 
622				}
623			} );
624		}
625		
626		
627		if ( 
628			!checker.os.iphone && 
629			!checker.os.ipod && 
630			!checker.os.ipad && 
631			!checker.os.blackberry && 
632			!checker.os.android 
633		) {
634			portfolio.waypoint(function (dir) { 
635				if (dir === 'down') {
636					var el = 		jQuery(this), 
637						items = 	el.find('article.project'), 
638						delay = 	200, 
639						i = 		1;
640					
641					
642					items.each(function () { 
643						var item = 	jQuery(this);
644						
645						
646						setTimeout(function () { 
647							item.addClass('shortcode_animated');
648						}, delay * i);
649						
650						
651						i += 1;
652					} );
653				}
654			}, { 
655				offset : 		'100%' 
656			} ).waypoint(function (dir) { 
657				if (dir === 'up') {
658					var el = 		jQuery(this), 
659						items = 	el.find('article.project'), 
660						delay = 	200, 
661						i = 		1;
662					
663					
664					items.each(function () { 
665						var item = 	jQuery(this);
666						
667						
668						setTimeout(function () { 
669							item.addClass('shortcode_animated');
670						}, delay * i);
671						
672						
673						i += 1;
674					} );
675				}
676			}, { 
677				offset : 		'25%' 
678			} );
679		} else {
680			portfolio.find('article.project').addClass('shortcode_animated');
681		}
682		
683		
684		setTimeout(function () { 
685			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
686		}, 300);
687	} );
688	
689	
690	portfolioContainer.find('.cmsmasters_project_filter_block .cmsmasters_project_filter_list a').on('click', function () { 
691		var filter = 			jQuery(this), 
692			filterSelector = 	filter.attr('data-filter');
693		
694		
695		filter.parent().parent().find('> li.current').removeClass('current');
696		
697		
698		filter.parent().addClass('current');
699		
700		
701		portfolio.isotope( { 
702			filter : 	filterSelector 
703		} );
704		
705		
706		setTimeout(function () { 
707			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
708		}, 300);
709		
710		
711		return false;
712	} );
713	
714	
715	portfolioContainer.find('.cmsmasters_project_sort_block .cmsmasters_project_sort_but').on('click', function () { 
716		var type = jQuery(this).attr('name'), 
717			asc = (type === 'project_name') ? true : false, 
718			current = (jQuery(this).hasClass('current')) ? true : false, 
719			reversed = (jQuery(this).hasClass('reversed')) ? true : false;
720		
721		
722		if (current) { 
723			if (reversed) { 
724				jQuery(this).removeClass('reversed');
725				
726				asc = true;
727			} else { 
728				jQuery(this).addClass('reversed');
729				
730				asc = false;
731			}
732		} else { 
733			jQuery(this).parent().find('.current').removeClass('current');
734			
735			jQuery(this).parent().find('.reversed').removeClass('reversed');
736			
737			
738			if (type === 'project_name') { 
739				jQuery(this).addClass('current');
740			} else { 
741				jQuery(this).addClass('current reversed');
742			}
743		}
744		
745		
746		portfolio.isotope( { 
747			sortBy : type, 
748			sortAscending : asc 
749		} );
750		
751		
752		setTimeout(function () { 
753			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
754		}, 300);
755		
756		
757		return false;
758	} );
759	
760	
761	portfolioContainer.find('.cmsmasters_project_loader').on('click', function () { 
762		portfolioContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
763		
764		jQuery.ajax( { 
765			type : 		'POST', 
766			dataType : 	'html', 
767			url : 		url + 'inc/project/projects-loader.php', 
768			data : { 
769				layout : 		layout, 
770				layoutmode: 	layoutMode, 
771				orderby : 		orderby, 
772				order : 		order, 
773				count : 		count, 
774				categories : 	categories, 
775				metadata : 		metadata, 
776				offset : 		portfolio.find('.project').length 
777			}, 
778			success : 	function (data) { 
779				if (data !== '') {
780					var newHTML = '', 
781						lightboxVars = [];
782					
783					
784					if (data.slice(0, 6) === 'finish') {
785						newHTML = jQuery(data.replace(/type-project/g, 'type-project shortcode_animated').slice(6, -1));
786						
787						
788						portfolioContainer.find('.cmsmasters_wrap_more_items').hide();
789					} else {
790						newHTML = jQuery(data.replace(/type-project/g, 'type-project shortcode_animated'));
791
792						portfolioContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
793					}
794					
795					
796					newHTML.find('a[rel^="ilightbox["]').each(function () { 
797						if (jQuery.inArray(jQuery(this).attr('rel'), lightboxVars) === -1) {
798							lightboxVars.push(jQuery(this).attr('rel'));
799						}
800					} );
801					
802					
803					newHTML.imagesLoaded(function () { 
804						portfolioContainer.find('.portfolio').isotope('insert', newHTML);
805						
806						
807						setTimeout(function () { 
808							reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
809							
810							
811							var settings = {};
812							
813							
814							if (typeof _wpmejsSettings !== 'undefined') {
815								settings.pluginPath = _wpmejsSettings.pluginPath;
816							}
817							
818							
819							jQuery('.wp-audio-shortcode, .wp-video-shortcode').filter(':not(.mejs-container)').mediaelementplayer(settings);
820							
821							
822							for (var i = 0, il = lightboxVars.length; i < il; i += 1) { 
823								portfolioContainer.find('a[rel="' + lightboxVars[i] + '"]').iLightBox(ilightbox_settings);
824							}
825						}, 300);
826					} );
827				}
828			} 
829		} );
830		
831		
832		return false;
833	} );
834
835
836	jQuery(window).on('debouncedresize', function () { 
837		reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
838		
839		
840		if (portfolioPuzzle) {
841			portfolio.isotope( { 
842				masonry : { 
843					columnWidth : Math.floor(portfolio.width() / 4) 
844				}
845			} );
846		}
847	} );
848}
849
850
851
852/* Start Gallery Isotope Function */
853function startGallery(id, gallery_type, gallery_count) { 
854	var galleryContainer = 	jQuery(id), 
855		gallery = 			galleryContainer.find('> .cmsmasters_gallery'), 
856		gallery_hidden =	galleryContainer.find('> .cmsmasters_hidden_gallery'), 
857		gallery_count = 	gallery_count, 
858		gallery_arr = 		[], 
859		gallery_items = 	'', 
860		gallery_rel = 		'', 
861		ilightbox_run = 	'';
862	
863	
864	if (galleryContainer.find('.cmsmasters_gallery_item').length == 0) {
865		return false;
866	}
867	
868	
869	gallery_hidden.find('.cmsmasters_gallery_item').each(function () {
870		gallery_arr.push(this);
871	} );
872	
873	
874	setColumnWidth(gallery);
875	
876	
877	gallery.imagesLoaded(function () {
878		gallery.isotope( { 
879			itemSelector : 	'.cmsmasters_gallery_item' 
880		} );
881		
882		
883		if (!gallery.hasClass('isotope')) {
884			gallery.addClass('isotope');
885		}
886		
887		
888		if (gallery_type === 'grid') {
889			gallery.isotope( { 
890				layoutMode : 	'fitRows', 
891				resizable : 	false 
892			} );
893		} else if (gallery_type === 'masonry') {
894			gallery.isotope( { 
895				layoutMode : 	'masonry', 
896				resizable : 	true 
897			} );
898		}
899	} );
900	
901	
902	ilightbox_run = gallery.find('[rel^="ilightbox["]').iLightBox(ilightbox_settings);
903	
904	gallery_rel = gallery.find('[rel^="ilightbox["]').attr('rel');
905	
906	if (gallery_arr.length > 0) {
907		galleryContainer.find('.cmsmasters_gallery_items_loader').on('click', function () {
908			galleryContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
909			
910			gallery_items = gallery_arr.splice(0, gallery_count);
911			
912			
913			jQuery(gallery_items).each(function () {
914				gallery.isotope('insert', jQuery(this));
915				
916				
917				jQuery(this).addClass('shortcode_animated');
918				
919				
920				if (gallery_rel !== undefined) {
921					jQuery(this).find('a').attr('rel', gallery_rel);
922				}
923				
924				
925				jQuery(this).imagesLoaded(function () {
926					reArrangePosts(gallery, true);
927				} );
928			} );
929			
930			
931			ilightbox_run.destroy();
932			
933			ilightbox_run = gallery.find('[rel^="ilightbox["]').iLightBox(ilightbox_settings);
934			
935			
936			if (gallery_arr.length == 0) {
937				galleryContainer.find('.cmsmasters_wrap_more_items').hide();
938			} else {
939				galleryContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
940 			}
941		} );
942	}
943	
944	
945	jQuery(window).on('debouncedresize', function () { 
946		reArrangePosts(gallery, true);
947	} );
948}
949

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.