(function($){
"use strict";
UNCODE.isotopeLayout=function(){
if($('.isotope-layout').length > 0){
var isotopeContainersArray=[],
typeGridArray=[],
layoutGridArray=[],
screenLgArray=[],
screenMdArray=[],
screenSmArray=[],
transitionDuration=[],
$filterItems=[],
$filters=$('.isotope-system .isotope-filters'),
$itemSelector='.tmb-iso',
$items,
itemMargin,
correctionFactor=0,
firstLoad=true,
isOriginLeft=$('body').hasClass('rtl') ? false:true;
$('[class*="isotope-container"]').each(function(index){
var _this=$(this);
var isoData=_this.data(),
$data_lg,
$data_md,
$data_sm;
_this.children('.tmb').addClass('tmb-iso');
if(isoData.lg!==undefined) $data_lg=_this.attr('data-lg');
else $data_lg='1000';
if(isoData.md!==undefined) $data_md=_this.attr('data-md');
else $data_md='600';
if(isoData.sm!==undefined) $data_sm=_this.attr('data-sm');
else $data_sm='480';
screenLgArray.push($data_lg);
screenMdArray.push($data_md);
screenSmArray.push($data_sm);
transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0:'0.5s');
if(isoData.type=='metro') typeGridArray.push(true);
else typeGridArray.push(false);
if(isoData.layout!==undefined) layoutGridArray.push(isoData.layout);
else layoutGridArray.push('masonry');
isotopeContainersArray.push(_this);
_this.attr('data-iso-index', index);
});
var colWidth=function(index){
$(isotopeContainersArray[index]).width('');
var isPx=$(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
widthAvailable=$(isotopeContainersArray[index]).width(),
columnNum=12,
columnWidth=0,
data_vp_height=$(isotopeContainersArray[index]).attr('data-vp-height'),
consider_menu=$(isotopeContainersArray[index]).attr('data-vp-menu'),
winHeight=UNCODE.wheight - UNCODE.adminBarHeight,
$rowContainer,
paddingRow,
$colContainer,
paddingCol;
if(consider_menu)
winHeight=winHeight - UNCODE.menuHeight;
if(data_vp_height==='1'){
$rowContainer=$(isotopeContainersArray[index]).parents('.row-parent').eq(0),
paddingRow=parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
$colContainer=$(isotopeContainersArray[index]).parents('.uncell').eq(0),
paddingCol=parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
winHeight=winHeight -(paddingRow + paddingCol);
}
if(isPx){
columnWidth=Math.ceil(widthAvailable / columnNum);
$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
}else{
columnWidth=($('html.firefox').length) ? Math.floor(widthAvailable / columnNum):widthAvailable / columnNum;
}
$items=$(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
itemMargin=parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
for (var i=0, len=$items.length; i < len; i++){
var $item=$($items[i]),
multiplier_w=$item.attr('class').match(/tmb-iso-w(\d{0,2})/),
multiplier_h=$item.attr('class').match(/tmb-iso-h(\d{0,3})/),
multiplier_fixed=multiplier_h!==null ? multiplier_h[1]:1;
if(multiplier_w!=null&&multiplier_w[1]!==undefined&&multiplier_w[1]==15){
multiplier_w[1]=2.4;
}
if(multiplier_h!=null&&multiplier_h[1]!==undefined&&multiplier_h[1]==15){
multiplier_h[1]=2.4;
}
if(widthAvailable >=screenMdArray[index]&&widthAvailable < screenLgArray[index]){
if(multiplier_w!=null&&multiplier_w[1]!==undefined){
switch (parseInt(multiplier_w[1])){
case (5):
case (4):
case (3):
if(typeGridArray[index]) multiplier_h[1]=(6 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=6;
break;
case (2):
case (1):
if(typeGridArray[index]) multiplier_h[1]=(3 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=3;
break;
default:
if(typeGridArray[index]) multiplier_h[1]=(12 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=12;
break;
}
if(multiplier_w[1]==2.4){
if(typeGridArray[index]) multiplier_h[1]=(6 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=6;
}}
}else if(widthAvailable >=screenSmArray[index]&&widthAvailable < screenMdArray[index]){
if(multiplier_w!=null&&multiplier_w[1]!==undefined){
switch (parseInt(multiplier_w[1])){
case (5):
case (4):
case (3):
case (2):
case (1):
if(typeGridArray[index]) multiplier_h[1]=(6 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=6;
break;
default:
if(typeGridArray[index]) multiplier_h[1]=(12 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=12;
break;
}
if(multiplier_w[1]==2.4){
if(typeGridArray[index]) multiplier_h[1]=(6 * multiplier_h[1]) / multiplier_w[1];
multiplier_w[1]=6;
}}
}else if(widthAvailable < screenSmArray[index]){
if(multiplier_w!=null&&multiplier_w[1]!==undefined){
multiplier_w[1]=12;
if(typeGridArray[index]) multiplier_h[1]=12;
}}
var width=multiplier_w ? Math.floor(columnWidth * multiplier_w[1]):columnWidth,
height;
if(data_vp_height==='1'&&typeof multiplier_h[1]!=='undefined'){
height=multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed)) - itemMargin:columnWidth;
if(widthAvailable < screenSmArray[index]){
height=Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
}}else{
height=multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin:columnWidth;
}
if(width >=widthAvailable){
$item.css({
width: widthAvailable
});
if(typeGridArray[index]){
$item.children().add($item.find('.backimg')).css({
height: height
});
}}else{
$item.css({
width: width
});
if(typeGridArray[index]){
$item.children().add($item.find('.backimg')).css({
height: height
});
}}
}
if(multiplier_w!=null&&multiplier_w[1]!==undefined&&multiplier_w[1]==2.4){
return columnWidth / 60;
}else{
return columnWidth;
}},
init_isotope=function(){
for (var i=0, len=isotopeContainersArray.length; i < len; i++){
var isotopeSystem=$(isotopeContainersArray[i]).closest($('.isotope-system')),
isotopeId=isotopeSystem.attr('id'),
$layoutMode=layoutGridArray[i],
setIsotopeFirstRowTimeOut,
setIsotopeFirstRow=function(items){
var firstRow=true;
$(items).each(function(index, val){
var el=items[index].element,
el_top=items[index].position.y,
$el=$(el);
if(index > 0&&el_top > 0&&firstRow){
firstRow=false;
}else if(index==0&&el_top==0){
firstRow=true;
}
if(firstRow){
$el.removeClass('tmb-isotope-further-row');
}else{
$el.addClass('tmb-isotope-further-row');
}});
};
$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
itemSelector: $itemSelector,
layoutMode: $layoutMode,
transitionDuration: transitionDuration[i],
masonry: {
columnWidth: colWidth(i)
},
vertical: {
horizontalAlignment: 0.5,
},
sortBy: 'original-order',
isOriginLeft: isOriginLeft
})
.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
.on('layoutComplete', function(event, items){
if(typeof items[0]!=='undefined'){
if($(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length){
setIsotopeFirstRow(items);
}}
})
.on('arrangeComplete', function(event, items){
if(typeof items[0]!=='undefined'){
if($(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length){
clearRequestTimeout(setIsotopeFirstRowTimeOut);
setIsotopeFirstRowTimeOut=requestTimeout(function(){
setIsotopeFirstRow(items);
}, 100);
}}
});
if($(isotopeContainersArray[i]).hasClass('isotope-infinite')&&$.fn.infinitescroll){
$(isotopeContainersArray[i]).infinitescroll({
navSelector: '#' + isotopeId + ' .loadmore-button',
nextSelector: '#' + isotopeId + ' .loadmore-button a',
itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default',
animate: false,
behavior: 'local',
debug: false,
loading: {
selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
speed: 0,
finished: undefined,
msg: $('#' + isotopeId + ' .loadmore-button'),
},
errorCallback: function(){
var isotope_system=$(this).closest('.isotope-system');
$('.loading-button', isotope_system).hide();
$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
}},
function(newElements, opts){
var $isotope=$(this),
isotope_system=$isotope.closest('.isotope-system'),
isotopeId=isotope_system.attr('id'),
filters=new Array(),
$loading_button=isotope_system.find('.loading-button'),
$infinite_button=isotope_system.find('.loadmore-button'),
$numPages=$('a', $infinite_button).data('pages'),
$woo_results,
delay=300;
$('a', $infinite_button).html($('a', $infinite_button).data('label'));
$infinite_button.show();
$loading_button.hide();
if($numPages!=undefined&&opts.state.currPage==$numPages) $infinite_button.hide();
$('> li', $isotope).remove();
$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
$.each($(newElements), function (index, val){
if($(val).hasClass('woocommerce-result-count-wrapper')){
$woo_results=$(val);
delete newElements[index];
}else{
$(val).addClass('tmb-iso');
if($(val).is("li")){
filters.push($(val)[0]);
}}
$(val).addClass('uncode-appended');
});
newElements=newElements.filter(function(x){
return filters.indexOf(x) < 0
});
$.each($(filters), function(index, val){
if($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length==0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
});
if($woo_results&&$woo_results.length > 0){
var old_count=isotope_system.find('.woocommerce-result-count').text();
var new_count=$woo_results.find('.woocommerce-result-count').text();
var old_start=old_count.match(/(\d+)–(\d+)/)[1];
var new_end=new_count.match(/(\d+)–(\d+)/)[2];
function replaceMatch(match, p1, p2){
return old_start + '–' + new_end;
}
var new_count_text=old_count.replace(/(\d+)–(\d+)/, replaceMatch);
isotope_system.find('.woocommerce-result-count').text(new_count_text);
}
$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
if(typeof UNCODE.lightbox!=='undefined'&&!SiteParameters.lbox_enhanced){
var getLightbox=UNCODE.lightboxArray['ilightbox_' + isotopeId];
if(typeof getLightbox==='object'){
getLightbox.refresh();
}else{
UNCODE.lightbox();
}}
if(typeof twttr!=='undefined')
twttr.widgets.load(isotopeContainersArray[i]);
requestTimeout(function(){
Waypoint.refreshAll();
$isotope.trigger('more-items-loaded');
$(window).trigger('more-items-loaded');
window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
if(typeof ScrollTrigger!=='undefined'&&ScrollTrigger!==null){
$(document).trigger('uncode-scrolltrigger-refresh');
}}, 1000);
});
if($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')){
var $infinite_isotope=$(isotopeContainersArray[i]),
$infinite_button=$infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
$infinite_isotope.infinitescroll('pause');
$infinite_button.on('click', function(event){
event.preventDefault();
var $infinite_system=$(event.target).closest('.isotope-system'),
$infinite_isotope=$infinite_system.find('.isotope-container'),
isotopeId=$infinite_system.attr('id');
$(event.currentTarget).html(SiteParameters.loading);
$infinite_isotope.infinitescroll('resume');
$infinite_isotope.infinitescroll('retrieve');
$infinite_isotope.infinitescroll('pause');
});
}}
}},
onLayout=function(isotopeObj, startIndex, needsReload){
var needsReload=needsReload ? true:false;
if(typeof UNCODE.bigText!=='undefined'){
UNCODE.bigText();
}
isotopeObj.css('opacity', 1);
isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
requestTimeout(function(){
if(startIndex > 0){
reloadIsotope(isotopeObj);
if(SiteParameters.dynamic_srcset_active==='1'){
UNCODE.refresh_dynamic_srcset_size(isotopeObj);
UNCODE.adaptive_srcset(isotopeObj);
}}else if(needsReload){
reloadIsotope(isotopeObj);
}
UNCODE.adaptive();
if(SiteParameters.dynamic_srcset_active==='1'&&startIndex===0){
UNCODE.refresh_dynamic_srcset_size(isotopeObj);
}
if(typeof MediaElement==="function"){
$(isotopeObj).find('audio,video').each(function(){
$(this).mediaelementplayer({
pauseOtherPlayers: false,
});
});
}
if($(isotopeObj).find('.nested-carousel').length){
if(typeof UNCODE.carousel!=='undefined'){
UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
}
requestTimeout(function(){
boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
}, 200);
}else{
boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
}
isotopeObj.trigger('isotope-layout-complete');
}, 100);
},
boxAnimation=function(items, startIndex, sequential, container){
var $allItems=items.length - startIndex,
showed=0,
index=0;
if(container.closest('.owl-item').length==1) return false;
$.each(items, function(index, val){
var $this=$(val),
elInner=$('> .t-inside', val);
if(UNCODE.isUnmodalOpen&&!val.closest('#unmodal-content')){
return;
}
if(val[0]) val=val[0];
if(elInner.hasClass('animate_when_almost_visible')&&!elInner.hasClass('force-anim')){
new Waypoint({
context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content'):window,
element: val,
handler: function(){
var element=$('> .t-inside', this.element),
parent=$(this.element),
currentIndex=parent.index();
var delay=(!sequential) ? index:((startIndex!==0) ? currentIndex - $allItems:currentIndex),
delayAttr=parseInt(element.attr('data-delay'));
if(isNaN(delayAttr)) delayAttr=100;
delay -=showed;
var objTimeout=requestTimeout(function(){
element.removeClass('zoom-reverse').addClass('start_animation');
showed=parent.index();
if(container.data('isotope')){
container.isotope('layout');
}}, delay * delayAttr)
parent.data('objTimeout', objTimeout);
if(!UNCODE.isUnmodalOpen){
this.destroy();
}},
offset: '100%'
})
}else{
if(elInner.hasClass('force-anim')){
elInner.addClass('start_animation');
}else{
elInner.css('opacity', 1);
}
container.isotope('layout');
}
index++;
});
},
reloadIsotope=function(isotopeObj){
var isoIndex=$(isotopeObj).attr('data-iso-index');
var $layoutMode=($(isotopeObj).data('layout'));
if($layoutMode===undefined){
$layoutMode='masonry';
}
if(isotopeObj.data('isotope')){
isotopeObj.isotope({
itemSelector: $itemSelector,
layoutMode: $layoutMode,
transitionDuration: transitionDuration[isoIndex],
masonry: {
columnWidth: colWidth(isoIndex)
},
vertical: {
horizontalAlignment: 0.5,
},
sortBy: 'original-order',
isOriginLeft: isOriginLeft
});
}}
;
if($('.isotope-pagination').length > 0){
$('.isotope-system').on('click', '.pagination a', function(evt){
evt.preventDefault();
if(SiteParameters.index_pagination_disable_scroll!=='1'){
var filterContainer=$(this).closest('.isotope-system').find('.isotope-filters'),
container=$(this).closest('.isotope-system'),
pagination_disable_scroll=container.attr('data-pagination-scroll'),
calc_scroll=SiteParameters.index_pagination_scroll_to!=false ? eval(SiteParameters.index_pagination_scroll_to):container.closest('.row-parent').offset().top;
calc_scroll -=UNCODE.get_scroll_offset();
if(pagination_disable_scroll!=='disabled'){
var menu_container=$('.menu-sticky');
var menu=menu_container.find('.menu-container');
if(menu_container.length > 0&&menu.length > 0){
calc_scroll=calc_scroll - menu.outerHeight();
}
var bodyTop=document.documentElement['scrollTop']||document.body['scrollTop'],
delta=bodyTop - calc_scroll,
scrollSpeed=(SiteParameters.constant_scroll=='on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed):SiteParameters.scroll_speed;
if(scrollSpeed < 1000&&SiteParameters.constant_scroll=='on') scrollSpeed=1000;
if(!UNCODE.isFullPage){
if(scrollSpeed==0){
$('html, body').scrollTop(calc_scroll);
}else{
$('html, body').animate({
scrollTop: calc_scroll
}, {
easing: 'easeInOutQuad',
duration: scrollSpeed,
complete: function (){
UNCODE.scrolling=false;
}});
}}
}}
loadIsotope($(this), true);
});
}
$filters.on('click', 'a.isotope-nav-link', function(evt){
if($(this).hasClass('no-isotope-filter')){
return;
}
var $filter=$(this),
filterContainer=$filter.closest('.isotope-filters'),
filterValue=$filter.attr('data-filter'),
container=$filter.closest('.isotope-system').find($('.isotope-layout')),
transitionDuration=container.data().isotope.options.transitionDuration,
delay=300,
filterItems=[];
var filter_items=function(){
if(filterValue!==undefined){
container.addClass('grid-filtering');
$.each($('> .tmb-iso > .t-inside', container), function(index, val){
var parent=$(val).parent(),
objTimeout=parent.data('objTimeout');
if(objTimeout){
$(val).removeClass('zoom-reverse').removeClass('start_animation')
clearRequestTimeout(objTimeout);
}
if(transitionDuration==0){
if($(val).hasClass('animate_when_almost_visible')){
$(val).addClass('zoom-reverse').removeClass('start_animation');
}else{
$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
}}
});
requestTimeout(function(){
if(filterValue=='*'){
container.removeClass('isotope-filtered');
}else{
container.addClass('isotope-filtered');
}
container.isotope({
filter: function(){
var block=$(this),
filterable=(filterValue=='*')||block.hasClass(filterValue),
lightboxElements=$('[data-lbox^=ilightbox]', block);
if(filterable){
if(lightboxElements.length){
lightboxElements.removeClass('lb-disabled');
container.data('lbox', $(lightboxElements[0]).data('lbox'));
}
filterItems.push(block);
}else{
if(lightboxElements.length) lightboxElements.addClass('lb-disabled');
}
container.trigger('more-items-loaded');
$(window).trigger('more-items-loaded');
window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
return filterable;
}});
$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
}, delay);
container.isotope('once', 'arrangeComplete', function(){
if(typeof UNCODE.lightbox!=='undefined'&&!SiteParameters.lbox_enhanced){
var getLightbox=UNCODE.lightboxArray[container.data('lbox')];
if(typeof getLightbox==='object'){
getLightbox.refresh();
}else{
UNCODE.lightbox();
}}
if(transitionDuration==0){
requestTimeout(function(){
boxAnimation(filterItems, 0, false, container);
}, 100);
}
requestTimeout(function(){
Waypoint.refreshAll();
if(typeof ScrollTrigger!=='undefined'&&ScrollTrigger!==null){
$(document).trigger('uncode-scrolltrigger-refresh');
}
container.removeClass('grid-filtering');
}, 2000);
});
}else{
if(typeof UNCODE.lightbox!=='undefined'&&!SiteParameters.lbox_enhanced){
$.each(UNCODE.lightboxArray, function(index, val){
UNCODE.lightboxArray[index].destroy();
});
}
$.each($('> .tmb-iso > .t-inside', container), function(index, val){
var parent=$(val).parent(),
objTimeout=parent.data('objTimeout');
if(objTimeout){
$(val).removeClass('zoom-reverse').removeClass('start_animation')
clearRequestTimeout(objTimeout);
}
if(transitionDuration==0){
if($(val).hasClass('animate_when_almost_visible')){
$(val).addClass('zoom-reverse').removeClass('start_animation');
}else{
$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
}}
});
container.parent().addClass('grid-loading');
loadIsotope($filter);
}};
if(!$filter.hasClass('active')){
if(filterContainer.hasClass('filter-scroll')){
var calc_scroll=SiteParameters.index_pagination_scroll_to!=false ? eval(SiteParameters.index_pagination_scroll_to):container.closest('.row-parent').offset().top;
calc_scroll -=UNCODE.get_scroll_offset();
var bodyTop=document.documentElement['scrollTop']||document.body['scrollTop'],
delta=bodyTop - calc_scroll,
scrollSpeed=(SiteParameters.constant_scroll=='on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed):SiteParameters.scroll_speed,
filterTolerance=false,
filter_timeout;
if(scrollSpeed < 1000&&SiteParameters.constant_scroll=='on') scrollSpeed=1000;
if(!UNCODE.isFullPage){
if(scrollSpeed==0){
$('html, body').scrollTop(calc_scroll);
UNCODE.scrolling=false;
filter_items();
}else{
if(bodyTop <=(calc_scroll+20)&&bodyTop >=(calc_scroll-20)){
filter_items();
filterTolerance=true;
}
$('html, body').animate({
scrollTop: calc_scroll
},{
easing: 'easeInOutQuad',
duration: scrollSpeed,
complete: function(){
UNCODE.scrolling=false;
if(!filterTolerance){
filter_timeout=setTimeout(function(){
clearTimeout(filter_timeout);
filter_items();
}, 200);
}}
});
}}
}else{
filter_items();
}}
evt.preventDefault();
});
$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e){
var params=UNCODE.getURLParams(window.location);
var old_params=UNCODE.getURLParams(UNCODE.lastURL, true);
UNCODE.lastURL=window.location.href;
if(UNCODE.hasEqualURLParams(params, old_params)||($.isEmptyObject(params)&&$.isEmptyObject(old_params))||params.form!==undefined){
return;
}
if(params.id===undefined){
$.each($('.isotope-system'), function(index, val){
loadIsotope($(val));
});
}else{
if(!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)){
loadIsotope($('#' + params.id));
}}
});
var loadIsotope=function($href, $paginating){
var is_paginating=false;
if(undefined!==$paginating&&$paginating){
var is_paginating=$paginating;
}
var href=($href.is("a") ? $href.attr('href'):location),
isotopeSystem=($href.is("a") ? $href.closest($('.isotope-system')):$href),
isotopeWrapper=isotopeSystem.find($('.isotope-wrapper')),
isotopeFooter=isotopeSystem.find($('.isotope-footer-inner')),
isotopeResultCount=isotopeSystem.find($('.woocommerce-result-count-wrapper')),
isotopeContainer=isotopeSystem.find($('.isotope-layout')),
isotopeId=isotopeSystem.attr('id');
if($href.is("a")&&! isotopeSystem.hasClass('un-no-history')){
UNCODE.lastURL=href;
history.pushState({
myIsotope: true
}, document.title, href);
}
if(is_paginating){
isotopeWrapper.addClass('grid-filtering');
}
$.ajax({
url: href
}).done(function(data){
var $resultItems=$(data).find('#' + isotopeId + ' .isotope-layout').html(),
$resultPagination=$(data).find('#' + isotopeId + ' .pagination')[0],
$resultCount=$(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
isotopeWrapper.addClass('isotope-reloaded');
requestTimeout(function(){
isotopeWrapper.removeClass('grid-loading');
isotopeWrapper.removeClass('isotope-reloaded');
isotopeWrapper.removeClass('grid-filtering');
}, 500);
$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val){
var parent=$(val).parent(),
objTimeout=parent.data('objTimeout');
if(objTimeout){
$(val).removeClass('zoom-reverse').removeClass('start_animation')
clearRequestTimeout(objTimeout);
}
if($(val).hasClass('animate_when_almost_visible')){
$(val).addClass('zoom-reverse').removeClass('start_animation');
}else{
$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
}});
requestTimeout(function(){
if(isotopeContainer.data('isotope')){
isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
UNCODE.adaptive();
if(SiteParameters.dynamic_srcset_active==='1'){
UNCODE.adaptive_srcset(isotopeContainer);
}
if(typeof UNCODE.lightbox!=='undefined'&&!SiteParameters.lbox_enhanced){
var getLightbox=UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
if(typeof getLightbox==='object'){
getLightbox.refresh();
}else{
UNCODE.lightbox();
}}
}
isotopeContainer.trigger('more-items-loaded');
$(window).trigger('more-items-loaded');
window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
}, 300);
$('.pagination', isotopeFooter).remove();
isotopeFooter.append($resultPagination);
if(isotopeResultCount.length > 0){
$('.woocommerce-result-count', isotopeResultCount).remove();
isotopeResultCount.append($resultCount);
}});
};
$filters.each(function(i, buttonGroup){
var $buttonGroup=$(buttonGroup);
$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function(){
$buttonGroup.find('.active').removeClass('active');
$(this).addClass('active');
});
var $cats_mobile_trigger=$('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
$cats_mobile_toggle=$('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
$cats_filters=$('.menu-smart--filter-cats', $buttonGroup);
$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e){
e.preventDefault();
$cats_filters.slideToggle(400, 'easeInOutCirc');
});
});
window.addEventListener('boxResized', function(e){
if(UNCODE.printDialogOpen!==false){
return false;
}
$.each($('.isotope-layout'), function(index, val){
var $layoutMode=($(this).data('layout'));
if($layoutMode===undefined) $layoutMode='masonry';
if($(this).data('isotope')){
$(this).isotope({
itemSelector: $itemSelector,
layoutMode: $layoutMode,
transitionDuration: transitionDuration[index],
masonry: {
columnWidth: colWidth(index)
},
vertical: {
horizontalAlignment: 0.5,
},
sortBy: 'original-order',
isOriginLeft: isOriginLeft
});
$(this).isotope('unbindResize');
if(SiteParameters.dynamic_srcset_active==='1'){
UNCODE.refresh_dynamic_srcset_size($(this));
}}
$(this).find('.mejs-video,.mejs-audio').each(function(){
$(this).trigger('resize');
});
});
}, false);
init_isotope();
};}})(jQuery);