PageSourceSearch

https://www.jkuat.ac.ke/wp-content/themes/schule/theme-framework/t…/js/jquery.isotope.mode.js?ver=1.0.0

js jkuat.ac.ke collected 2026-10-02 03:20:24 UTC 26,884 bytes, 952 lines download raw bytes

1/**
2 * @package 	WordPress
3 * @subpackage 	Schule
4 * @version		1.1.0
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		jQuery(this).find('.project_inner').css( { 
396			top : '-' + jQuery(this).find('.project_inner').outerHeight() + 'px' 
397		} );
398	} );
399}
400
401
402
403/* Rearrange Projects Function */
404function reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle) { 
405	if (portfolioGrid) {
406		setColumnWidth(portfolio);
407	} else if (portfolioPuzzle) {
408		setPuzzleColumnWidth(portfolio);
409	}
410	
411	
412	portfolio.isotope('layout');
413}
414
415
416
417/* Start Blog Isotope Function */
418function startBlog(id, layout, layoutMode, url, orderby, order, count, categories, metadata) { 
419	var blogContainer = 	jQuery(id), 
420		blog = 				blogContainer.find('> .blog'), 
421		blogColumns = 		(layout === 'columns') ? true : false;
422	
423	
424	if (blogContainer.find('article').length == 0) {
425		return false;
426	}
427	
428	
429	if (blogColumns) {
430		setColumnWidth(blog);
431	}
432	
433	
434	blog.imagesLoaded(function () { 
435		blog.isotope( { 
436			itemSelector : 	'article.post' 
437		} );
438		
439		
440		if (!blog.hasClass('isotope')) {
441			blog.addClass('isotope');
442		}
443		
444		
445		if (layout === 'columns' && (layoutMode === 'grid' || layoutMode === 'puzzle')) {
446			blog.isotope( { 
447				layoutMode : 	'fitRows', 
448				resizable : 	false 
449			} );
450		} else if (layout === 'columns' && layoutMode === 'masonry') {
451			blog.isotope( { 
452				layoutMode : 	'masonry', 
453				resizable : 	true 
454			} );
455		}
456	} );
457	
458	
459	blogContainer.find('.cmsmasters_post_filter_block .cmsmasters_post_filter_list a').on('click', function () { 
460		var filter = 			jQuery(this), 
461			filterSelector = 	filter.attr('data-filter');
462		
463		
464		filter.parent().parent().find('> li.current').removeClass('current');
465		
466		
467		filter.parent().addClass('current');
468		
469		
470		blog.isotope( { 
471			filter : 	filterSelector 
472		} );
473		
474		
475		setTimeout(function () { 
476			reArrangePosts(blog, blogColumns);
477		}, 300);
478		
479		
480		return false;
481	} );
482	
483	
484	blogContainer.find('.cmsmasters_post_loader').on('click', function () { 
485		blogContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
486		
487		jQuery.ajax( { 
488			type : 		'POST', 
489			dataType : 	'html', 
490			url : 		url + 'inc/post/posts-loader.php', 
491			data : { 
492				layout : 		layout, 
493				layoutmode: 	layoutMode, 
494				orderby : 		orderby, 
495				order : 		order, 
496				count : 		count, 
497				categories : 	categories, 
498				metadata : 		metadata, 
499				offset : 		blog.find('.post').length 
500			}, 
501			success : function (data) { 
502				if (data !== '') {
503					var newHTML = '', 
504						lightboxVars = [];
505					
506					
507					if (data.slice(0, 6) === 'finish') {
508						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));
509						
510						
511						blogContainer.find('.cmsmasters_wrap_more_items').hide();
512					} else {
513						newHTML = jQuery(data.replace(/cmsmasters_post_timeline/g, 'cmsmasters_post_timeline shortcode_animated').replace(/cmsmasters_post_masonry/g, 'cmsmasters_post_masonry shortcode_animated'));
514						blogContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
515					}
516					
517					
518					newHTML.find('a[rel^="ilightbox["]').each(function () { 
519						if (jQuery.inArray(jQuery(this).attr('rel'), lightboxVars) === -1) {
520							lightboxVars.push(jQuery(this).attr('rel'));
521						}
522					} );
523					
524					
525					newHTML.imagesLoaded(function () { 
526						blogContainer.find('.blog').isotope('insert', newHTML);
527						
528						
529						setTimeout(function () { 
530							jQuery('body').trigger('debouncedresize');
531							
532							
533							reArrangePosts(blog, blogColumns);
534							
535							
536							var settings = {};
537							
538							
539							if (typeof _wpmejsSettings !== 'undefined') {
540								settings.pluginPath = _wpmejsSettings.pluginPath;
541							}
542							
543							
544							jQuery('.wp-audio-shortcode, .wp-video-shortcode').filter(':not(.mejs-container)').mediaelementplayer(settings);
545							
546							
547							for (var i = 0, il = lightboxVars.length; i < il; i += 1) { 
548								blogContainer.find('a[rel="' + lightboxVars[i] + '"]').iLightBox(ilightbox_settings);
549							}
550						}, 300);
551					} );
552				}
553			} 
554		} );
555		
556		
557		return false;
558	} );
559
560
561	jQuery(window).on('debouncedresize', function () { 
562		reArrangePosts(blog, blogColumns);
563	} );
564}
565
566
567
568/* Start Portfolio Isotope Function */
569function startPortfolio(id, layout, layoutMode, url, orderby, order, count, categories, metadata) { 
570	var portfolioContainer = 	jQuery(id), 
571		portfolio = 			portfolioContainer.find('> .portfolio'), 
572		portfolioGrid = 		(layout === 'grid') ? true : false, 
573		portfolioPuzzle = 		(layout === 'puzzle') ? true : false;
574	
575	
576	if (portfolioContainer.find('article').length == 0) {
577		return false;
578	}
579	
580	
581	if (portfolioGrid) {
582		setColumnWidth(portfolio);
583	} else if (portfolioPuzzle) {
584		setPuzzleColumnWidth(portfolio);
585	}
586	
587	
588	portfolio.imagesLoaded(function () { 
589		if (!portfolio.hasClass('isotope')) {
590			portfolio.addClass('isotope');
591		}
592		
593		
594		if (portfolioGrid) {
595			portfolio.isotope( { 
596				itemSelector : 	'article.project', 
597				getSortData : { 
598					project_name : function (el) { 
599						return jQuery(el).find('.entry-title > a').text();
600					}, 
601					project_date : function (el) { 
602						return parseInt(jQuery(el).find('.meta-date').text());
603					} 
604				} 
605			} );
606			
607			
608			if (layoutMode === 'perfect') {
609				portfolio.isotope( { 
610					layoutMode : 	'fitRows', 
611					resizable : 	false 
612				} );
613			} else if (layoutMode === 'masonry') {
614				portfolio.isotope( { 
615					layoutMode : 	'masonry', 
616					resizable : 	true 
617				} );
618			}
619		} else if (portfolioPuzzle) {
620			portfolio.isotope( { 
621				itemSelector : 	'article.project', 
622				layoutMode : 	'masonry', 
623				resizable : 	false, 
624				masonry : { 
625					columnWidth : Math.floor(portfolio.width() / 4) 
626				}
627			} );
628		}
629		
630		
631		if ( 
632			!checker.os.iphone && 
633			!checker.os.ipod && 
634			!checker.os.ipad && 
635			!checker.os.blackberry && 
636			!checker.os.android 
637		) {
638			portfolio.waypoint(function (dir) { 
639				if (dir === 'down') {
640					var el = 		jQuery(this), 
641						items = 	el.find('article.project'), 
642						delay = 	200, 
643						i = 		1;
644					
645					
646					items.each(function () { 
647						var item = 	jQuery(this);
648						
649						
650						setTimeout(function () { 
651							item.addClass('shortcode_animated');
652						}, delay * i);
653						
654						
655						i += 1;
656					} );
657				}
658			}, { 
659				offset : 		'100%' 
660			} ).waypoint(function (dir) { 
661				if (dir === 'up') {
662					var el = 		jQuery(this), 
663						items = 	el.find('article.project'), 
664						delay = 	200, 
665						i = 		1;
666					
667					
668					items.each(function () { 
669						var item = 	jQuery(this);
670						
671						
672						setTimeout(function () { 
673							item.addClass('shortcode_animated');
674						}, delay * i);
675						
676						
677						i += 1;
678					} );
679				}
680			}, { 
681				offset : 		'25%' 
682			} );
683		} else {
684			portfolio.find('article.project').addClass('shortcode_animated');
685		}
686		
687		
688		setTimeout(function () { 
689			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
690		}, 300);
691	} );
692	
693	
694	portfolioContainer.find('.cmsmasters_project_filter_block .cmsmasters_project_filter_list a').on('click', function () { 
695		var filter = 			jQuery(this), 
696			filterSelector = 	filter.attr('data-filter');
697		
698		
699		filter.parent().parent().find('> li.current').removeClass('current');
700		
701		
702		filter.parent().addClass('current');
703		
704		
705		portfolio.isotope( { 
706			filter : 	filterSelector 
707		} );
708		
709		
710		setTimeout(function () { 
711			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
712		}, 300);
713		
714		
715		return false;
716	} );
717	
718	
719	portfolioContainer.find('.cmsmasters_project_sort_block .cmsmasters_project_sort_but').on('click', function () { 
720		var type = jQuery(this).attr('name'), 
721			asc = (type === 'project_name') ? true : false, 
722			current = (jQuery(this).hasClass('current')) ? true : false, 
723			reversed = (jQuery(this).hasClass('reversed')) ? true : false;
724		
725		
726		if (current) { 
727			if (reversed) { 
728				jQuery(this).removeClass('reversed');
729				
730				asc = true;
731			} else { 
732				jQuery(this).addClass('reversed');
733				
734				asc = false;
735			}
736		} else { 
737			jQuery(this).parent().find('.current').removeClass('current');
738			
739			jQuery(this).parent().find('.reversed').removeClass('reversed');
740			
741			
742			if (type === 'project_name') { 
743				jQuery(this).addClass('current');
744			} else { 
745				jQuery(this).addClass('current reversed');
746			}
747		}
748		
749		
750		portfolio.isotope( { 
751			sortBy : type, 
752			sortAscending : asc 
753		} );
754		
755		
756		setTimeout(function () { 
757			reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
758		}, 300);
759		
760		
761		return false;
762	} );
763	
764	
765	portfolioContainer.find('.cmsmasters_project_loader').on('click', function () { 
766		portfolioContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
767		
768		jQuery.ajax( { 
769			type : 		'POST', 
770			dataType : 	'html', 
771			url : 		url + 'inc/project/projects-loader.php', 
772			data : { 
773				layout : 		layout, 
774				layoutmode: 	layoutMode, 
775				orderby : 		orderby, 
776				order : 		order, 
777				count : 		count, 
778				categories : 	categories, 
779				metadata : 		metadata, 
780				offset : 		portfolio.find('.project').length 
781			}, 
782			success : 	function (data) { 
783				if (data !== '') {
784					var newHTML = '', 
785						lightboxVars = [];
786					
787					
788					if (data.slice(0, 6) === 'finish') {
789						newHTML = jQuery(data.replace(/type-project/g, 'type-project shortcode_animated').slice(6, -1));
790						
791						
792						portfolioContainer.find('.cmsmasters_wrap_more_items').hide();
793					} else {
794						newHTML = jQuery(data.replace(/type-project/g, 'type-project shortcode_animated'));
795						portfolioContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
796					}
797					
798					
799					newHTML.find('a[rel^="ilightbox["]').each(function () { 
800						if (jQuery.inArray(jQuery(this).attr('rel'), lightboxVars) === -1) {
801							lightboxVars.push(jQuery(this).attr('rel'));
802						}
803					} );
804					
805					
806					newHTML.imagesLoaded(function () { 
807						portfolioContainer.find('.portfolio').isotope('insert', newHTML);
808						
809						
810						setTimeout(function () { 
811							reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
812							
813							
814							var settings = {};
815							
816							
817							if (typeof _wpmejsSettings !== 'undefined') {
818								settings.pluginPath = _wpmejsSettings.pluginPath;
819							}
820							
821							
822							jQuery('.wp-audio-shortcode, .wp-video-shortcode').filter(':not(.mejs-container)').mediaelementplayer(settings);
823							
824							
825							for (var i = 0, il = lightboxVars.length; i < il; i += 1) { 
826								portfolioContainer.find('a[rel="' + lightboxVars[i] + '"]').iLightBox(ilightbox_settings);
827							}
828						}, 300);
829					} );
830				}
831			} 
832		} );
833		
834		
835		return false;
836	} );
837
838
839	jQuery(window).on('debouncedresize', function () { 
840		reArrangeProjects(portfolio, portfolioGrid, portfolioPuzzle);
841		
842		
843		if (portfolioPuzzle) {
844			portfolio.isotope( { 
845				masonry : { 
846					columnWidth : Math.floor(portfolio.width() / 4) 
847				}
848			} );
849		}
850	} );
851}
852
853
854
855/* Start Gallery Isotope Function */
856function startGallery(id, gallery_type, gallery_count) { 
857	var galleryContainer = 	jQuery(id), 
858		gallery = 			galleryContainer.find('> .cmsmasters_gallery'), 
859		gallery_hidden =	galleryContainer.find('> .cmsmasters_hidden_gallery'), 
860		gallery_count = 	gallery_count, 
861		gallery_arr = 		[], 
862		gallery_items = 	'', 
863		gallery_rel = 		'', 
864		ilightbox_run = 	'';
865	
866	
867	if (galleryContainer.find('.cmsmasters_gallery_item').length == 0) {
868		return false;
869	}
870	
871	
872	gallery_hidden.find('.cmsmasters_gallery_item').each(function () {
873		gallery_arr.push(this);
874	} );
875	
876	
877	setColumnWidth(gallery);
878	
879	
880	gallery.imagesLoaded(function () { 
881		gallery.isotope( { 
882			itemSelector : 	'.cmsmasters_gallery_item' 
883		} );
884		
885		
886		if (!gallery.hasClass('isotope')) {
887			gallery.addClass('isotope');
888		}
889		
890		
891		if (gallery_type === 'grid') {
892			gallery.isotope( { 
893				layoutMode : 	'fitRows', 
894				resizable : 	false 
895			} );
896		} else if (gallery_type === 'masonry') {
897			gallery.isotope( { 
898				layoutMode : 	'masonry', 
899				resizable : 	true 
900			} );
901		}
902	} );
903	
904	
905	ilightbox_run = gallery.find('[rel^="ilightbox["]').iLightBox(ilightbox_settings);
906	
907	gallery_rel = gallery.find('[rel^="ilightbox["]').attr('rel');
908	
909	if (gallery_arr.length > 0) {
910		galleryContainer.find('.cmsmasters_gallery_items_loader').on('click', function () {
911			galleryContainer.find('.cmsmasters_wrap_more_items').addClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideUp('fast');
912			
913			gallery_items = gallery_arr.splice(0, gallery_count);
914			
915			
916			jQuery(gallery_items).each(function () {
917				gallery.isotope('insert', jQuery(this));
918				
919				
920				jQuery(this).addClass('shortcode_animated');
921				
922				
923				if (gallery_rel !== undefined) {
924					jQuery(this).find('a').attr('rel', gallery_rel);
925				}
926				
927				
928				jQuery(this).imagesLoaded(function () {
929					reArrangePosts(gallery, true);
930				} );
931			} );
932			
933			
934			ilightbox_run.destroy();
935			
936			ilightbox_run = gallery.find('[rel^="ilightbox["]').iLightBox(ilightbox_settings);
937			
938			
939			if (gallery_arr.length == 0) {
940				galleryContainer.find('.cmsmasters_wrap_more_items').hide();
941			} else {
942				galleryContainer.find('.cmsmasters_wrap_more_items').removeClass('cmsmasters_loading cmsmasters_theme_icon_spinner').find('.cmsmasters_wrap_items_loader').slideDown('fast');
943 			}
944		} );
945	}
946	
947	
948	jQuery(window).on('debouncedresize', function () { 
949		reArrangePosts(gallery, true);
950	} );
951}
952

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.