PageSourceSearch

https://munksjo.com/wp-content/themes/uncode/library/js/isotopeLayout.js?ver=597385404

js munksjo.com collected 2026-10-02 11:11:44 UTC 32,200 bytes, 860 lines download raw bytes

1(function($) {
2	"use strict";
3
4	UNCODE.isotopeLayout = function() {
5	if ($('.isotope-layout').length > 0) {
6		var isotopeContainersArray = [],
7			typeGridArray = [],
8			layoutGridArray = [],
9			screenLgArray = [],
10			screenMdArray = [],
11			screenSmArray = [],
12			transitionDuration = [],
13			$filterItems = [],
14			$filters = $('.isotope-system .isotope-filters'),
15			$itemSelector = '.tmb-iso',
16			$items,
17			itemMargin,
18			correctionFactor = 0,
19			firstLoad = true,
20			isOriginLeft = $('body').hasClass('rtl') ? false : true;
21		$('[class*="isotope-container"]').each(function(index) {
22			var _this = $(this);
23			var isoData = _this.data(),
24			$data_lg,
25			$data_md,
26			$data_sm;
27			_this.children('.tmb').addClass('tmb-iso');
28			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
29			else $data_lg = '1000';
30			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
31			else $data_md = '600';
32			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
33			else $data_sm = '480';
34			screenLgArray.push($data_lg);
35			screenMdArray.push($data_md);
36			screenSmArray.push($data_sm);
37			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
38			if (isoData.type == 'metro') typeGridArray.push(true);
39			else typeGridArray.push(false);
40			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
41			else layoutGridArray.push('masonry');
42			isotopeContainersArray.push(_this);
43			_this.attr('data-iso-index', index);
44		});
45		var colWidth = function(index) {
46				$(isotopeContainersArray[index]).width('');
47				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
48					widthAvailable = $(isotopeContainersArray[index]).width(),
49					columnNum = 12,
50					columnWidth = 0,
51					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
52					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
53					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
54					$rowContainer,
55					paddingRow,
56					$colContainer,
57					paddingCol;
58
59				if ( consider_menu )
60					winHeight = winHeight - UNCODE.menuHeight;
61
62				if ( data_vp_height === '1' ) {
63					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
64					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
65					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
66					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
67					winHeight = winHeight - ( paddingRow + paddingCol );
68				}
69
70				if (isPx) {
71					columnWidth = Math.ceil(widthAvailable / columnNum);
72					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
73				} else {
74					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
75				}
76				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
77				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
78				for (var i = 0, len = $items.length; i < len; i++) {
79					var $item = $($items[i]),
80						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
81						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
82						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
83
84
85					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
86						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
87					}
88
89					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
90						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
91					}
92
93					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
94						if (multiplier_w != null && multiplier_w[1] !== undefined) {
95							switch (parseInt(multiplier_w[1])) {
96								case (5):
97								case (4):
98								case (3):
99									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
100									multiplier_w[1] = 6;
101									break;
102								case (2):
103								case (1):
104									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
105									multiplier_w[1] = 3;
106									break;
107								default:
108									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
109									multiplier_w[1] = 12;
110									break;
111							}
112
113							if (multiplier_w[1] == 2.4) { // 5 columns
114								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
115								multiplier_w[1] = 6;
116							}
117						}
118					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
119						if (multiplier_w != null && multiplier_w[1] !== undefined) {
120							switch (parseInt(multiplier_w[1])) {
121								case (5):
122								case (4):
123								case (3):
124								case (2):
125								case (1):
126									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
127									multiplier_w[1] = 6;
128									break;
129								default:
130									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
131									multiplier_w[1] = 12;
132									break;
133							}
134
135							if (multiplier_w[1] == 2.4) { // 5 columns
136								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
137								multiplier_w[1] = 6;
138							}
139						}
140					} else if (widthAvailable < screenSmArray[index]) {
141						if (multiplier_w != null && multiplier_w[1] !== undefined) {
142							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
143							multiplier_w[1] = 12;
144							if (typeGridArray[index]) multiplier_h[1] = 12;
145						}
146					}
147					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
148						height;
149
150					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
151						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
152						if ( widthAvailable < screenSmArray[index] ) {
153							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
154						}
155					} else {
156						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
157					}
158
159					if (width >= widthAvailable) {
160						$item.css({
161							width: widthAvailable
162						});
163						if (typeGridArray[index]) {
164							$item.children().add($item.find('.backimg')).css({
165								height: height
166							});
167						}
168					} else {
169						$item.css({
170							width: width
171						});
172						if (typeGridArray[index]) {
173							$item.children().add($item.find('.backimg')).css({
174								height: height
175							});
176						}
177					}
178				}
179				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
180					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
181				} else {
182					return columnWidth;
183				}
184			},
185			init_isotope = function() {
186				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
187					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
188						isotopeId = isotopeSystem.attr('id'),
189						$layoutMode = layoutGridArray[i],
190						setIsotopeFirstRowTimeOut,
191					setIsotopeFirstRow = function(items){
192						var firstRow = true;
193						$(items).each(function(index, val){
194							var el = items[index].element,
195								el_top = items[index].position.y,
196								$el = $(el);
197							if ( index > 0 && el_top > 0 && firstRow ) {
198								firstRow = false;
199							} else if ( index == 0 && el_top == 0 ) {
200								firstRow = true;
201							}
202							if ( firstRow ) {
203								$el.removeClass('tmb-isotope-further-row');
204							} else {
205								$el.addClass('tmb-isotope-further-row');
206							}
207						});
208					};
209					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
210						//resizable: true,
211						itemSelector: $itemSelector,
212						layoutMode: $layoutMode,
213						transitionDuration: transitionDuration[i],
214						masonry: {
215							columnWidth: colWidth(i)
216						},
217						vertical: {
218							horizontalAlignment: 0.5,
219						},
220						sortBy: 'original-order',
221						isOriginLeft: isOriginLeft
222					})
223					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
224					.on('layoutComplete', function( event, items ){
225						if ( typeof items[0] !== 'undefined' ) {
226							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
227								setIsotopeFirstRow(items);
228							}
229						}
230					})
231					.on('arrangeComplete', function( event, items ){
232						if ( typeof items[0] !== 'undefined' ) {
233							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
234								clearRequestTimeout(setIsotopeFirstRowTimeOut);
235								setIsotopeFirstRowTimeOut = requestTimeout(function(){
236									setIsotopeFirstRow(items);
237								}, 100);
238							}
239						}
240					});
241					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
242						$(isotopeContainersArray[i]).infinitescroll({
243								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
244								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
245								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
246								animate: false,
247								behavior: 'local',
248								debug: false,
249								loading: {
250									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
251									speed: 0,
252									finished: undefined,
253									msg: $('#' + isotopeId + ' .loadmore-button'),
254								},
255								errorCallback: function() {
256									var isotope_system = $(this).closest('.isotope-system');
257									$('.loading-button', isotope_system).hide();
258									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
259								}
260							},
261							// append the new items to isotope on the infinitescroll callback function.
262							function(newElements, opts) {
263								var $isotope = $(this),
264									isotope_system = $isotope.closest('.isotope-system'),
265									isotopeId = isotope_system.attr('id'),
266									filters = new Array(),
267									$loading_button = isotope_system.find('.loading-button'),
268									$infinite_button = isotope_system.find('.loadmore-button'),
269									$numPages = $('a', $infinite_button).data('pages'),
270									$woo_results,
271									delay = 300;
272								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
273								if ($isotope.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
274									$infinite_button.show();
275								} else {
276									$infinite_button.hide();
277								}
278								$loading_button.hide();
279								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
280								$('> li', $isotope).remove();
281								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
282								$.each($(newElements), function (index, val) {
283									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
284										$woo_results = $(val);
285										delete newElements[index];
286									} else {
287										$(val).addClass('tmb-iso');
288										if ($(val).is("li")) {
289											filters.push($(val)[0]);
290										}
291									}
292									$(val).addClass('uncode-appended');
293								});
294								newElements = newElements.filter(function(x) {
295									return filters.indexOf(x) < 0
296								});
297								$.each($(filters), function(index, val) {
298									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
299								});
300								if ($woo_results && $woo_results.length > 0) {
301									var old_count = isotope_system.find('.woocommerce-result-count').text();
302									var new_count = $woo_results.find('.woocommerce-result-count').text();
303									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
304									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
305									function replaceMatch(match, p1, p2) {
306        								return old_start + '–' + new_end;
307									}
308									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
309									isotope_system.find('.woocommerce-result-count').text(new_count_text);
310								}
311								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
312								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
313									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
314									if (typeof getLightbox === 'object') {
315										getLightbox.refresh();
316									} else {
317										UNCODE.lightbox();
318									}
319								}
320								if ( typeof twttr !== 'undefined' )
321									twttr.widgets.load(isotopeContainersArray[i]);
322
323								requestTimeout(function() {
324									Waypoint.refreshAll();
325									$isotope.trigger('more-items-loaded');
326									$(window).trigger('more-items-loaded');
327									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
328									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
329										$(document).trigger('uncode-scrolltrigger-refresh');
330									}
331									fillIfNotScrollable($isotope);
332								}, 1000);
333
334							});
335						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
336							var $infinite_isotope = $(isotopeContainersArray[i]),
337								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
338							$infinite_isotope.infinitescroll('pause');
339							$infinite_button.on('click', function(event) {
340								event.preventDefault();
341								var $infinite_system = $(event.target).closest('.isotope-system'),
342								$infinite_isotope = $infinite_system.find('.isotope-container'),
343								isotopeId = $infinite_system.attr('id');
344								$(event.currentTarget).html(SiteParameters.loading);
345								$infinite_isotope.infinitescroll('resume');
346								$infinite_isotope.infinitescroll('retrieve');
347								$infinite_isotope.infinitescroll('pause');
348							});
349						}
350						(function ($c) {
351							requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
352						})($(isotopeContainersArray[i]));
353					}
354				}
355			},
356			fillIfNotScrollable = function ($container) {
357				if ($container.hasClass('isotope-infinite-button')) {
358					return
359				};
360				if (!$container.hasClass('isotope-infinite')) {
361					return
362				};
363				var infData = $container.data('infinitescroll');
364				if (!infData || !infData.options || !infData.options.state) {
365					return
366				};
367				var state = infData.options.state;
368				if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPau
368sed) {
369					return
370				};
371				var $loadMoreA = $container.closest('.isotope-system').find('.loadmore-button a');
372				var numPages = parseInt($loadMoreA.data('pages'), 10);
373				if (!numPages || state.currPage >= numPages) {
374					return
375				};
376				if (document.documentElement.scrollHeight > window.innerHeight + 1) {
377					return
378				};
379				console.log('fillIfNotScrollable');
380				$container.infinitescroll('retrieve');
381			},
382			onLayout = function(isotopeObj, startIndex, needsReload) {
383				var needsReload = needsReload ? true : false;
384
385				if (typeof UNCODE.bigText !== 'undefined') {
386					UNCODE.bigText();
387				}
388				isotopeObj.css('opacity', 1);
389				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
390
391				requestTimeout(function() {
392					if (startIndex > 0) {
393						reloadIsotope(isotopeObj);
394						if (SiteParameters.dynamic_srcset_active === '1') {
395							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
396							UNCODE.adaptive_srcset(isotopeObj);
397						}
398						// window.dispatchEvent(UNCODE.boxEvent);
399					} else if (needsReload) {
400						reloadIsotope(isotopeObj);
401					}
402
403					UNCODE.adaptive();
404					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
405						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
406					}
407					if (typeof MediaElement === "function") {
408						$(isotopeObj).find('audio,video').each(function() {
409							$(this).mediaelementplayer({
410	 							pauseOtherPlayers: false,
411							});
412						});
413					}
414					if ($(isotopeObj).find('.nested-carousel').length) {
415						if (typeof UNCODE.carousel !== 'undefined') {
416							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
417						}
418						requestTimeout(function() {
419							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
420						}, 200);
421					} else {
422						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
423					}
424					isotopeObj.trigger('isotope-layout-complete');
425
426				}, 100);
427
428			},
429			boxAnimation = function(items, startIndex, sequential, container) {
430				var $allItems = items.length - startIndex,
431					showed = 0,
432					index = 0;
433				if (container.closest('.owl-item').length == 1) return false;
434				$.each(items, function(index, val) {
435					var $this = $(val),
436						elInner = $('> .t-inside', val);
437					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
438						return;
439					}
440					if (val[0]) val = val[0];
441					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
442						new Waypoint({
443							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
444							element: val,
445							handler: function() {
446								var element = $('> .t-inside', this.element),
447									parent = $(this.element),
448									currentIndex = parent.index();
449								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
450									delayAttr = parseInt(element.attr('data-delay'));
451								if (isNaN(delayAttr)) delayAttr = 100;
452								delay -= showed;
453								var objTimeout = requestTimeout(function() {
454									element.removeClass('zoom-reverse').addClass('start_animation');
455									showed = parent.index();
456									if ( container.data('isotope') ) {
457										container.isotope('layout');
458									}
459								}, delay * delayAttr)
460								parent.data('objTimeout', objTimeout);
461								if (!UNCODE.isUnmodalOpen) {
462									this.destroy();
463								}
464							},
465							offset: '100%'
466						})
467					} else {
468						if (elInner.hasClass('force-anim')) {
469							elInner.addClass('start_animation');
470						} else {
471							elInner.css('opacity', 1);
472						}
473						container.isotope('layout');
474					}
475
476					index++;
477				});
478			},
479			reloadIsotope = function(isotopeObj) {
480				var isoIndex = $(isotopeObj).attr('data-iso-index');
481				var $layoutMode = ($(isotopeObj).data('layout'));
482				if ($layoutMode === undefined) {
483					$layoutMode = 'masonry';
484				}
485				if (isotopeObj.data('isotope')) {
486					isotopeObj.isotope({
487						itemSelector: $itemSelector,
488						layoutMode: $layoutMode,
489						transitionDuration: transitionDuration[isoIndex],
490						masonry: {
491							columnWidth: colWidth(isoIndex)
492						},
493						vertical: {
494							horizontalAlignment: 0.5,
495						},
496						sortBy: 'original-order',
497						isOriginLeft: isOriginLeft
498					});
499				}
500			}
501			;
502		if ($('.isotope-pagination').length > 0) {
503			$('.isotope-system').on('click', '.pagination a', function(evt) {
504				evt.preventDefault();
505
506				if (SiteParameters.index_pagination_disable_scroll !== '1') {
507					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
508						container = $(this).closest('.isotope-system'),
509						pagination_disable_scroll = container.attr('data-pagination-scroll'),
510						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
511					calc_scroll -= UNCODE.get_scroll_offset();
512
513					if ( pagination_disable_scroll !== 'disabled' ) {
514						var menu_container = $('.menu-sticky');
515						var menu = menu_container.find('.menu-container');
516
517						if (menu_container.length > 0 && menu.length > 0) {
518							calc_scroll = calc_scroll - menu.outerHeight();
519						}
520
521						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
522							delta = bodyTop - calc_scroll,
523							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
524						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
525
526						if (!UNCODE.isFullPage) {
527							if (scrollSpeed == 0) {
528								$('html, body').scrollTop(calc_scroll);
529							} else {
530								$('html, body').animate({
531									scrollTop: calc_scroll
532								}, {
533									easing: 'easeInOutQuad',
534									duration: scrollSpeed,
535									complete: function () {
536										UNCODE.scrolling = false;
537									}
538								});
539							}
540						}
541					}
542				}
543
544				loadIsotope($(this), true);
545			});
546		}
547		$filters.on('click', 'a.isotope-nav-link', function(evt) {
548			if ($(this).hasClass('no-isotope-filter')) {
549				return;
550			}
551			var $filter = $(this),
552				filterContainer = $filter.closest('.isotope-filters'),
553				filterValue = $filter.attr('data-filter'),
554				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
555				transitionDuration = container.data().isotope.options.transitionDuration,
556				delay = 300,
557				filterItems = [];
558
559			var filter_items = function(){
560				if (filterValue !== undefined) {
561					container.addClass('grid-filtering');
562					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
563						var parent = $(val).parent(),
564							objTimeout = parent.data('objTimeout');
565						if (objTimeout) {
566							$(val).removeClass('zoom-reverse').removeClass('start_animation')
567							clearRequestTimeout(objTimeout);
568						}
569						if (transitionDuration == 0) {
570							if ($(val).hasClass('animate_when_almost_visible')) {
571								$(val).addClass('zoom-reverse').removeClass('start_animation');
572							} else {
573								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
574							}
575						}
576					});
577					requestTimeout(function(){
578						if ( filterValue == '*' ) {
579							container.removeClass('isotope-filtered');
580						} else {
581							container.addClass('isotope-filtered');
582						}
583						container.isotope({
584							filter: function() {
585								var block = $(this),
586								filterable = (filterValue == '*') || block.hasClass(filterValue),
587								lightboxElements = $('[data-lbox^=ilightbox]', block);
588								if (filterable) {
589									if (lightboxElements.length) {
590										lightboxElements.removeClass('lb-disabled');
591										container.data('lbox', $(lightboxElements[0]).data('lbox'));
592									}
593									filterItems.push(block);
594								} else {
595									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
596								}
597								container.trigger('more-items-loaded');
598								$(window).trigger('more-items-loaded');
599								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
600								return filterable;
601							}
602						});
603						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
604
605					}, delay);
606
607					/** once filtered - start **/
608					container.isotope('once', 'arrangeComplete', function() {
609						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
610							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
611							if (typeof getLightbox === 'object') {
612								getLightbox.refresh();
613							} else {
614								UNCODE.lightbox();
615							}
616						}
617						if (transitionDuration == 0) {
618							requestTimeout(function() {
619								boxAnimation(filterItems, 0, false, container);
620							}, 100);
621						}
622						requestTimeout(function() {
623							Waypoint.refreshAll();
624							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
625								$(document).trigger('uncode-scrolltrigger-refresh');
626							}
627							container.removeClass('grid-filtering');
628						}, 2000);
629						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
630					});
631					/** once filtered - end **/
632				} else {
633					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
634						$.each(UNCODE.lightboxArray, function(index, val) {
635							UNCODE.lightboxArray[index].destroy();
636						});
637					}
638					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
639						var parent = $(val).parent(),
640							objTimeout = parent.data('objTimeout');
641						if (objTimeout) {
642							$(val).removeClass('zoom-reverse').removeClass('start_animation')
643							clearRequestTimeout(objTimeout);
644						}
645						if (transitionDuration == 0) {
646							if ($(val).hasClass('animate_when_almost_visible')) {
647								$(val).addClass('zoom-reverse').removeClass('start_animation');
648							} else {
649								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
650							}
651						}
652					});
653					container.parent().addClass('grid-loading');
654					loadIsotope($filter);
655				}
656			};
657
658			if (!$filter.hasClass('active')) {
659				/** Scroll top with filtering */
660				if (filterContainer.hasClass('filter-scroll')) {
661                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
662                    calc_scroll -= UNCODE.get_scroll_offset();
663
664					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
665						delta = bodyTop - calc_scroll,
666						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
667						filterTolerance = false,
668						filter_timeout;
669					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
670
671					if ( !UNCODE.isFullPage ) {
672						if (scrollSpeed == 0) {
673							$('html, body').scrollTop(calc_scroll);
674							UNCODE.scrolling = false;
675							filter_items();
676						} else {
677
678							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
679								filter_items();
680								filterTolerance = true;
681							}
682
683							$('html, body').animate({
684								scrollTop: calc_scroll
685							},{
686								easing: 'easeInOutQuad',
687								duration: scrollSpeed,
688								complete: function(){
689									UNCODE.scrolling = false;
690									if ( !filterTolerance ) {
691										filter_timeout = setTimeout(function(){
692											clearTimeout(filter_timeout);
693											filter_items();
694										}, 200);
695									}
696								}
697							});
698						}
699					}
700				} else {
701					filter_items();
702				}
703			}
704			evt.preventDefault();
705		});
706
707		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
708			var params = UNCODE.getURLParams(window.location);
709			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
710
711			UNCODE.lastURL = window.location.href;
712
713			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
714				return;
715			}
716
717			if (params.id === undefined) {
718				$.each($('.isotope-system'), function(index, val) {
719					loadIsotope($(val));
720				});
721			} else {
722				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
723					loadIsotope($('#' + params.id));
724				}
725			}
726		});
727
728		var loadIsotope = function($href, $paginating) {
729			var is_paginating = false;
730
731			if (undefined !== $paginating && $paginating) {
732				var is_paginating = $paginating;
733			}
734
735			var href = ($href.is("a") ? $href.attr('href') : location),
736				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
737				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
738				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
739				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
740				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
741				isotopeId = isotopeSystem.attr('id');
742			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
743				UNCODE.lastURL = href;
744				history.pushState({
745					myIsotope: true
746				}, document.title, href);
747			}
748			if (is_paginating) {
749				isotopeWrapper.addClass('grid-filtering');
750			}
751			$.ajax({
752				url: href
753			}).done(function(data) {
754				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
755					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
756					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
757				isotopeWrapper.addClass('isotope-reloaded');
758				requestTimeout(function() {
759					isotopeWrapper.removeClass('grid-loading');
760					isotopeWrapper.removeClass('isotope-reloaded');
761					isotopeWrapper.removeClass('grid-filtering');
762				}, 500);
763				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
764					var parent = $(val).parent(),
765						objTimeout = parent.data('objTimeout');
766					if (objTimeout) {
767						$(val).removeClass('zoom-reverse').removeClass('start_animation')
768						clearRequestTimeout(objTimeout);
769					}
770					if ($(val).hasClass('animate_when_almost_visible')) {
771						$(val).addClass('zoom-reverse').removeClass('start_animation');
772					} else {
773						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
774					}
775				});
776				requestTimeout(function() {
777					if (isotopeContainer.data('isotope')) {
778						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
779						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
780						UNCODE.adaptive();
781						if (SiteParameters.dynamic_srcset_active === '1') {
782							UNCODE.adaptive_srcset(isotopeContainer);
783						}
784						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
785							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
786							if (typeof getLightbox === 'object') {
787								getLightbox.refresh();
788							} else {
789								UNCODE.lightbox();
790							}
791						}
792					}
793					isotopeContainer.trigger('more-items-loaded');
794					$(window).trigger('more-items-loaded');
795					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
796				}, 300);
797				$('.pagination', isotopeFooter).remove();
798				isotopeFooter.append($resultPagination);
799
800				if (isotopeResultCount.length > 0) {
801					$('.woocommerce-result-count', isotopeResultCount).remove();
802					isotopeResultCount.append($resultCount);
803				}
804			});
805		};
806		$filters.each(function(i, buttonGroup) {
807			var $buttonGroup = $(buttonGroup);
808			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
809				$buttonGroup.find('.active').removeClass('active');
810				$(this).addClass('active');
811
812			});
813
814			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
815				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
816				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
817			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
818				e.preventDefault();
819				$cats_filters.slideToggle(400, 'easeInOutCirc');
820			});
821
822		});
823		window.addEventListener('boxResized', function(e) {
824			if (UNCODE.printDialogOpen !== false) {
825				return false;
826			}
827			$.each($('.isotope-layout'), function(index, val) {
828				var $layoutMode = ($(this).data('layout'));
829				if ($layoutMode === undefined) $layoutMode = 'masonry';
830				if ($(this).data('isotope')) {
831					$(this).isotope({
832						itemSelector: $itemSelector,
833						layoutMode: $layoutMode,
834						transitionDuration: transitionDuration[index],
835						masonry: {
836							columnWidth: colWidth(index)
837						},
838						vertical: {
839							horizontalAlignment: 0.5,
840						},
841						sortBy: 'original-order',
842						isOriginLeft: isOriginLeft
843					});
844					$(this).isotope('unbindResize');
845					if (SiteParameters.dynamic_srcset_active === '1') {
846						UNCODE.refresh_dynamic_srcset_size($(this));
847					}
848				}
849				$(this).find('.mejs-video,.mejs-audio').each(function() {
850					$(this).trigger('resize');
851				});
852			});
853		}, false);
854
855		init_isotope();
856	};
857}
858
859
860})(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.