function nextgen_lightbox_filter_selector($, selector){
if(nextgen_lightbox_settings&&nextgen_lightbox_settings.context){
var context=nextgen_lightbox_settings.context;
if(context=='all_images'){
selector=selector.add($('a > img').parent());
}
else if(context=='all_images_direct'){
selector=selector.add($('a[href] > img').parent()
.filter(function(){
var href=$(this).attr('href').toLowerCase();
var ext=href.substring(href.length - 3);
var ext2=href.substring(href.length - 4);
return (ext=='jpg'||ext=='gif'||ext=='png'||ext2=='tiff'||ext2=='jpeg'||ext2=='webp');
}));
}
else if(context=='nextgen_and_wp_images'){
selector=selector.add($('a > img[class*="wp-image-"]').parent());
}
selector=selector.not('.gallery_link');
selector=selector.not('.use_imagebrowser_effect');
}
return selector;
};
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}));
(s=>{function i(){f.hide(),k.onerror=k.onload=null,C&&C.abort(),l.empty()}function h(){!1===w.onError(m,u,w)?(f.hide(),A=!1):(w.titleShow=!1,w.width="auto",w.height="auto",l.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>'),E())}function a(){var n,t,e,a,o,d,c,r=m[u];if(i(),w=s.extend({},s.fn.fancybox.defaults,void 0===s(r).data("fancybox")?w:s(r).data("fancybox")),!1===(d=w.onStart(m,u,w)))A=!1;else{e=(w="object"==typeof d?s.extend(w,d):w).title||(r.nodeName?s(r).attr("title"):r.title)||"",r.nodeName&&!w.orig&&(w.orig=s(r).children("img:first").length?s(r).children("img:first"):s(r)),""===e&&w.orig&&w.titleFromAlt&&(e=w.orig.attr("alt"));let i={A:["href","class","title"],BR:[],EM:[],I:[],STRONG:[],B:[],U:[],P:["class"],DIV:["class","id"],SPAN:["class","id"]};if(c=e,(c=(new DOMParser).parseFromString(c,"text/html")).body.querySelectorAll("*").forEach(e=>{i[e.tagName]?[...e.attributes].forEach(t=>{i[e.tagName].includes(t.name)||e.removeAttribute(t.name)}):e.remove()}),e=c.body.innerHTML,n=w.href||(r.nodeName?s(r).attr("href"):r.href)||null,!/^(?:javascript)/i.test(n)&&"#"!=n||(n=null),w.type?(t=w.type,n=n||w.content):w.content?t="html":n&&(t=n.match(O)?"image":n.match(z)?"swf":s(r).hasClass("iframe")?"iframe":0===n.indexOf("#")?"inline":"ajax"),t)switch("inline"==t&&(r=n.substr(n.indexOf("#")),t=0<s(r).length?"inline":"ajax"),w.type=t,w.href=n,w.title=e,w.autoDimensions&&("html"==w.type||"inline"==w.type||"ajax"==w.type?(w.width="auto",w.height="auto"):w.autoDimensions=!1),w.modal&&(w.overlayShow=!0,w.hideOnOverlayClick=!1,w.hideOnContentClick=!1,w.enableEscapeButton=!1,w.showCloseButton=!1),w.padding=parseInt(w.padding,10),w.margin=parseInt(w.margin,10),l.css("padding",w.padding+w.margin),s(".fancybox-inline-tmp").off("fancybox-cancel").on("fancybox-change",function(){s(this).replaceWith(p.children())}),t){case"html":l.html(w.content),E();break;case"inline":!0===s(r).parent().is("#fancybox-content")?A=!1:(s('<div class="fancybox-inline-tmp" />').hide().insertBefore(s(r)).on("fancybox-cleanup",function(){s(this).replaceWith(p.children())}).on("fancybox-cancel",function(){s(this).replaceWith(l.children())}),s(r).appendTo(l),E());break;case"image":A=!1,s.fancybox.showActivity(),(k=new Image).onerror=function(){h()},k.onload=function(){A=!0,k.onerror=k.onload=null,w.width=k.width,w.height=k.height,s("<img />").attr({id:"fancybox-img",src:k.src,alt:w.title}).appendTo(l),P()},k.src=n;break;case"swf":w.scrolling="no",a='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w.width+'" height="'+w.height+'"><param name="movie" value="'+n+'"></param>',o="",s.each(w.swf,function(t,e){a+='<param name="'+t+'" value="'+e+'"></param>',o+=" "+t+'="'+e+'"'}),a+='<embed src="'+n+'" type="application/x-shockwave-flash" width="'+w.width+'" height="'+w.height+'"'+o+"></embed></object>",l.html(a),E();break;case"ajax":A=!1,s.fancybox.showActivity(),w.ajax.win=w.ajax.success,C=s.ajax(s.extend({},w.ajax,{url:n,data:w.ajax.data||{},error:function(t,e,i){0<t.status&&h()},success:function(t,e,i){if(200==("object"==typeof i?i:C).status){if("function"==typeof w.ajax.win){if(!1===(d=w.ajax.win(n,t,e,i)))return void f.hide();"string"!=typeof d&&"object"!=typeof d||(t=d)}l.html(t),E()}}}));break;case"iframe":P()}else h()}}function M(t){var e=t.offset();return e.top+=parseInt(t.css("paddingTop"),10)||0,e.left+=parseInt(t.css("paddingLeft"),10)||0,e.top+=parseInt(t.css("border-top-width"),10)||0,e.left+=parseInt(t.css("border-left-width"),10)||0,e.width=t.width(),e.height=t.height(),e}function L(){f.is(":visible")?(s("div",f).css("top",-40*j+"px"),j=(j+1)%12):clearInterval(e)}var l,f,n,o,t,p,d,c,r,g,e,b,y,u=0,w={},m=[],x=0,v={},I=[],C=null,k=new Image,O=/\.(jpg|gif|png|bmp|jpeg|webp)(.*)?$/i,z=/[^\.]\.(swf)\s*$/i,j=1,S=0,T="",A=!1,D=s.extend(s("<div/>")[0],{prop:0}),N=!1,E=function(){var t=w.width,e=w.height,t=-1<t.toString().indexOf("%")?parseInt((s(window).width()-2*w.margin)*parseFloat(t)/100,10)+"px":"auto"==t?"auto":t+"px",e=-1<e.toString().indexOf("%")?parseInt((s(window).height()-2*w.margin)*parseFloat(e)/100,10)+"px":"auto"==e?"auto":e+"px";l.wrapInner('<div style="width:'+t+";height:"+e+";overflow: "+("auto"==w.scrolling?"auto":"yes"==w.scrolling?"scroll":"hidden")+';position:relative;"></div>'),w.width=l.width(),w.height=l.height(),P()},P=function(){var t,e;f.hide(),o.is(":visible")&&!1===v.onCleanup(I,x,v)?(s.event.trigger("fancybox-cancel"),A=!1):(A=!0,s(p.add(n)).off(),s(window).off("resize.fb scroll.fb"),s(document).off("keydown.fb"),o.is(":visible")&&"outside"!==v.titlePosition&&o.css("height",o.height()),I=m,x=u,(v=w).overlayShow?(n.css({"background-color":v.overlayColor,opacity:v.overlayOpacity,cursor:v.hideOnOverlayClick?"pointer":"auto",height:s(document).height()}),n.is(":visible")||(N&&s("select:not(#fancybox-tmp select)").filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}),n.show())):n.hide(),y=q(),R(),o.is(":visible")?(s(d.add(r).add(g)).hide(),t=o.position(),b={top:t.top,left:t.left,width:o.width(),height:o.height()},e=b.width==y.width&&b.height==y.height,p.fadeTo(v.changeFade,.3,function(){function t(){p.html(l.contents()).fadeTo(v.changeFade,1,F)}s.event.trigger("fancybox-change"),p.empty().removeAttr("filter").css({"border-width":v.padding,width:y.width-2*v.padding,height:w.autoDimensions?"auto":y.height-S-2*v.padding}),e?t():(D.prop=0,s(D).animate({prop:1},{duration:v.changeSpeed,easing:v.easingChange,step:B,complete:t}))})):(o.removeAttr("style"),p.css("border-width",v.padding),"elastic"==v.transitionIn?(b=U(),p.html(l.contents()),o.show(),v.opacity&&(y.opacity=0),D.prop=0,s(D).animate({prop:1},{duration:v.speedIn,easing:v.easingIn,step:B,complete:F})):("inside"==v.titlePosition&&0<S&&c.show(),p.css({width:y.width-2*v.padding,height:w.autoDimensions?"auto":y.height-S-2*v.padding}).html(l.contents()),o.css(y).fadeIn("none"==v.transitionIn?0:v.speedIn,F))))},H=function(t){return!(!t||!t.length)&&("float"==v.titlePosition?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+t+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+v.titlePosition+'">'+t+"</div>")},R=function(){if((T=v.title||"",S=0,c.empty().removeAttr("style").removeClass(),!1!==v.titleShow)&&((T="function"==typeof v.titleFormat?v.titleFormat(T,I,x,v):H(T))&&""!==T))switch(c.addClass("fancybox-title-"+v.titlePosition).html(T).appendTo("body").show(),v.titlePosition){case"inside":c.css({width:y.width-2*v.padding,marginLeft:v.padding,marginRight:v.padding}),S=c.outerHeight(!0),c.appendTo(t),y.height+=S;break;case"over":c.css({marginLeft:v.padding,width:y.width-2*v.padding,bottom:v.padding}).appendTo(t);break;case"float":c.css("left",-1*parseInt((c.width()-y.width-40)/2,10)).appendTo(o);break;default:c.css({width:y.width-2*v.padding,paddingLeft:v.padding,paddingRight:v.padding}).appendTo(o)}c.hide()},K=function(){(v.enableEscapeButton||v.enableKeyboardNav)&&s(document).on("keydown.fb",function(t){27==t.keyCode&&v.enableEscapeButton?(t.preventDefault(),s.fancybox.close()):37!=t.keyCode&&39!=t.keyCode||!v.enableKeyboardNav||"INPUT"===t.target.tagName||"TEXTAREA"===t.target.tagName||"SELECT"===t.target.tagName||(t.preventDefault(),s.fancybox[37==t.keyCode?"prev":"next"]())}),v.showNavArrows?((v.cyclic&&1<I.length||0!==x)&&r.show(),(v.cyclic&&1<I.length||x!=I.length-1)&&g.show()):(r.hide(),g.hide())},F=function(){s.support.opacity||(p.get(0).style.removeProperty("filter"),o.get(0).style.removeProperty("filter")),w.autoDimensions&&p.css("height","auto"),o.css("height","auto"),T&&T.length&&c.show(),v.showCloseButton&&d.show(),K(),v.hideOnContentClick&&p.on("click",s.fancybox.close),v.hideOnOverlayClick&&n.on("click",s.fancybox.close),s(window).on("resize.fb",s.fancybox.resize),v.centerOnScroll&&s(window).on("scroll.fb",s.fancybox.center),"iframe"==v.type&&s('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0"  scrolling="'+w.scrolling+'" src="'+v.href+'"></iframe>').appendTo(p),o.show(),A=!1,s.fancybox.center(),v.onComplete(I,x,v),Q()},Q=function(){var t;I.length-1>x&&void 0!==(t=I[x+1].href)&&t.match(O)&&((new Image).src=t),0<x&&void 0!==(t=I[x-1].href)&&t.match(O)&&((new Image).src=t)},B=function(t){var e={width:parseInt(b.width+(y.width-b.width)*t,10),height:parseInt(b.height+(y.height-b.height)*t,10),top:parseInt(b.top+(y.top-b.top)*t,10),left:parseInt(b.left+(y.left-b.left)*t,10)};void 0!==y.opacity&&(e.opacity=t<.5?.5:t),o.css(e),p.css({width:e.width-2*v.padding,height:e.height-S*t-2*v.padding})},W=function(){return[s(window).width()-2*v.margin,s(window).height()-2*v.margin,s(document).scrollLeft()+v.margin,s(document).scrollTop()+v.margin]},q=function(){var t=W(),e={},i=v.autoScale,n=2*v.padding;return-1<v.width.toString().indexOf("%")?e.width=parseInt(t[0]*parseFloat(v.width)/100,10):e.width=v.width+n,-1<v.height.toString().indexOf("%")?e.height=parseInt(t[1]*parseFloat(v.height)/100,10):e.height=v.height+n,i&&(e.width>t[0]||e.height>t[1])&&("image"==w.type||"swf"==w.type?(i=v.width/v.height,e.width>t[0]&&(e.width=t[0],e.height=parseInt((e.width-n)/i+n,10)),e.height>t[1]&&(e.height=t[1],e.width=parseInt((e.height-n)*i+n,10))):(e.width=Math.min(e.width,t[0]),e.height=Math.min(e.height,t[1]))),e.top=parseInt(Math.max(t[3]-20,t[3]+.5*(t[1]-e.height-40)),10),e.left=parseInt(Math.max(t[2]-20,t[2]+.5*(t[0]-e.width-40)),10),e},U=function(){var t=!!w.orig&&s(w.orig);return t&&t.length?{width:(t=M(t)).width+2*v.padding,height:t.height+2*v.padding,top:t.top-v.padding-20,left:t.left-v.padding-20}:(t=W(),{width:2*v.padding,height:2*v.padding,top:parseInt(t[3]+.5*t[1],10),left:parseInt(t[2]+.5*t[0],10)})};s.fn.fancybox=function(t){return s(this).length&&s(this).data("fancybox",s.extend({},t,s.metadata?s(this).metadata():{})).off("click.fb").on("click.fb",function(t){t.preventDefault(),A||(A=!0,s(this).trigger("blur"),m=[],u=0,(t=s(this).attr("rel")||"")&&""!=t&&"nofollow"!==t?(m=s("a[rel="+t+"], area[rel="+t+"]"),u=m.index(this)):m.push(this),a())}),this},s.fancybox=function(t){var e;if(!A){if(A=!0,e=void 0!==arguments[1]?arguments[1]:{},m=[],u=parseInt(e.index,10)||0,Array.isArray(t)){for(var i=0,n=t.length;i<n;i++)"object"==typeof t[i]?s(t[i]).data("fancybox",s.extend({},e,t[i])):t[i]=s({}).data("fancybox",s.extend({content:t[i]},e));m=jQuery.merge(m,t)}else"object"==typeof t?s(t).data("fancybox",s.extend({},e,t)):t=s({}).data("fancybox",s.extend({content:t},e)),m.push(t);(u>m.length||u<0)&&(u=0),a()}},s.fancybox.showActivity=function(){clearInterval(e),f.show(),e=setInterval(L,66)},s.fancybox.hideActivity=function(){f.hide()},s.fancybox.next=function(){return s.fancybox.pos(x+1)},s.fancybox.prev=function(){return s.fancybox.pos(x-1)},s.fancybox.pos=function(t){A||(t=parseInt(t),m=I,-1<t&&t<I.length?(u=t,a()):v.cyclic&&1<I.length&&(u=t>=I.length?0:I.length-1,a()))},s.fancybox.cancel=function(){A||(A=!0,s.event.trigger("fancybox-cancel"),i(),w.onCancel(m,u,w),A=!1)},s.fancybox.close=function(){var t;function e(){n.fadeOut("fast"),c.empty().hide(),o.hide(),s.event.trigger("fancybox-cleanup"),p.empty(),v.onClosed(I,x,v),I=w=[],x=u=0,v=w={},A=!1}A||o.is(":hidden")||(A=!0,v&&!1===v.onCleanup(I,x,v)?A=!1:(i(),s(d.add(r).add(g)).hide(),s(p.add(n)).off(),s(window).off("resize.fb scroll.fb"),s(document).off("keydown.fb"),p.find("iframe").attr("src",N&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank"),"inside"!==v.titlePosition&&c.empty(),o.stop(),"elastic"==v.transitionOut?(b=U(),t=o.position(),y={top:t.top,left:t.left,width:o.width(),height:o.height()},v.opacity&&(y.opacity=1),c.empty().hide(),D.prop=1,s(D).animate({prop:0},{duration:v.speedOut,easing:v.easingOut,step:B,complete:e})):o.fadeOut("none"==v.transitionOut?0:v.speedOut,e)))},s.fancybox.resize=function(){n.is(":visible")&&n.css("height",s(document).height()),s.fancybox.center(!0)},s.fancybox.center=function(){var t,e;A||(e=!0===arguments[0]?1:0,t=W(),!e&&(o.width()>t[0]||o.height()>t[1]))||o.stop().animate({top:parseInt(Math.max(t[3]-20,t[3]+.5*(t[1]-p.height()-40)-v.padding)),left:parseInt(Math.max(t[2]-20,t[2]+.5*(t[0]-p.width()-40)-v.padding))},"number"==typeof arguments[0]?arguments[0]:200)},s.fancybox.init=function(){s("#fancybox-wrap").length||(s("body").append(l=s('<div id="fancybox-tmp"></div>'),f=s('<div id="fancybox-loading"><div></div></div>'),n=s('<div id="fancybox-overlay"></div>'),o=s('<div id="fancybox-wrap"></div>')),(t=s('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(o)).append(p=s('<div id="fancybox-content"></div>'),d=s('<a id="fancybox-close"></a>'),c=s('<div id="fancybox-title"></div>'),r=s('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),g=s('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')),d.on("click",s.fancybox.close),f.on("click",s.fancybox.cancel),r.on("click",function(t){t.preventDefault(),s.fancybox.prev()}),g.on("click",function(t){t.preventDefault(),s.fancybox.next()}),s.fn.mousewheel&&o.on("mousewheel.fb",function(t,e){A?t.preventDefault():0!=s(t.target).get(0).clientHeight&&s(t.target).get(0).scrollHeight!==s(t.target).get(0).clientHeight||(t.preventDefault(),s.fancybox[0<e?"prev":"next"]())}),s.support.opacity||o.addClass("fancybox-ie"),N&&(f.addClass("fancybox-ie6"),o.addClass("fancybox-ie6"),s('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(t)))},s.fn.fancybox.defaults={padding:10,margin:40,opacity:!1,modal:!1,cyclic:!1,scrolling:"auto",width:560,height:340,autoScale:!0,autoDimensions:!0,centerOnScroll:!1,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:!0,hideOnContentClick:!1,overlayShow:!0,overlayOpacity:.7,overlayColor:"#777",titleShow:!0,titlePosition:"float",titleFormat:null,titleFromAlt:!1,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:!0,showNavArrows:!0,enableEscapeButton:!0,enableKeyboardNav:!0,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}},jQuery(function(t){t.fancybox.init()})})(jQuery);
(function($){
"use strict";
window.NextGEN_TikTok={
extract_id: function(url){
if(!url) return null;
url=url.trim();
var patterns=[
/tiktok\.com\/@[^\/]+\/video\/(\d+)/i,
/tiktok\.com\/v\/(\d+)/i,
/tiktok\.com\/embed\/v2\/(\d+)/i,
/tiktok\.com\/.*[?&]v=(\d+)/i,
/\/video\/(\d+)/i,
/^(\d{15,25})$/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
if(url.match(/vm\.tiktok\.com|tiktok\.com\/t\//i)){
var idMatch=url.match(/(\d{15,25})/);
if(idMatch){
return idMatch[1];
}
return null;
}
return null;
},
create_player: function(videoUrl, containerClass, videoClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-tiktok-container";
var video=document.createElement("video");
video.className=videoClass||"ngg-tiktok-video";
video.controls=true;
video.autoplay=true;
video.playsInline=true;
video.muted=true;
video.loop=true;
video.preload="auto";
video.setAttribute("playsinline", "");
video.setAttribute("webkit-playsinline", "");
video.src=videoUrl;
video.addEventListener("loadedmetadata", function (){
var naturalWidth=video.videoWidth;
var naturalHeight=video.videoHeight;
if(naturalWidth&&naturalHeight){
var container=video.closest('.ngg-tiktok-container');
var displayWidth=naturalWidth;
var displayHeight=naturalHeight;
if(container){
var fancyboxContent=container.closest('#fancybox-content');
var tbWindow=container.closest('#TB_window');
var slImage=container.closest('.sl-image');
var shWrap=container.closest('#shWrap');
if(shWrap){
var wiH=window.innerHeight||0;
var dbH=document.body.clientHeight||0;
var deH=document.documentElement ? document.documentElement.clientHeight:0;
var wHeight;
if(wiH > 0){
wHeight=((wiH - dbH) > 1&&(wiH - dbH) < 30) ? dbH:wiH;
wHeight=((wHeight - deH) > 1&&(wHeight - deH) < 30) ? deH:wHeight;
}else{
wHeight=(deH > 0) ? deH:dbH;
}
if(document.getElementsByTagName("body")[0].className.match(/admin-bar/)
&& document.getElementById('wpadminbar')!==null){
wHeight=wHeight - document.getElementById('wpadminbar').offsetHeight;
}
var shHeight=wHeight - 50;
var deW=document.documentElement ? document.documentElement.clientWidth:0;
var dbW=window.innerWidth||document.body.clientWidth;
var wWidth=(deW > 1) ? deW:dbW;
if(displayHeight > shHeight){
displayWidth=displayWidth * (shHeight / displayHeight);
displayHeight=shHeight;
}
if(displayWidth > (wWidth - 16)){
displayHeight=displayHeight * ((wWidth - 16) / displayWidth);
displayWidth=wWidth - 16;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth="none";
video.style.maxHeight="none";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(fancyboxContent){
setTimeout(function(){
var contentRect=fancyboxContent.getBoundingClientRect();
if(contentRect.width > 10&&contentRect.height > 10){
var maxW=contentRect.width;
var maxH=contentRect.height;
if(displayWidth > maxW||displayHeight > maxH){
var ratio=displayWidth / displayHeight > maxW / maxH
? displayWidth / maxW
: displayHeight / maxH;
displayWidth=displayWidth / ratio;
displayHeight=displayHeight / ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}}, 50);
return;
}else if(tbWindow){
var pageWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
var pageHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var x=pageWidth - 150;
var y=pageHeight - 150;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
}}else if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
}}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(slImage){
var widthRatio=0.8;
var heightRatio=0.9;
var windowWidth=window.innerWidth;
var windowHeight=window.innerHeight;
var maxWidth=windowWidth * widthRatio;
var maxHeight=windowHeight * heightRatio;
if(displayWidth > maxWidth||displayHeight > maxHeight){
var ratio=displayWidth / displayHeight > maxWidth / maxHeight
? displayWidth / maxWidth
: displayHeight / maxHeight;
displayWidth /=ratio;
displayHeight /=ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth=maxWidth + "px";
video.style.maxHeight=maxHeight + "px";
}}
}});
video.addEventListener("canplay", function (){
video.play().catch(function (){});
});
container.appendChild(video);
return container;
},
handle_content: function(options){
var self=this;
var playUrl=options.playUrl;
var $targetContainer=$(options.container);
if(!playUrl) return null;
var tiktokContent=null;
var applyDimensions=function (el){
if(options.width){
var w=typeof options.width==="number" ? options.width + "px":options.width;
el.style.width=w;
var inner=el.querySelector("video, iframe, .ngg-tiktok-error-content");
if(inner) inner.style.width="100%";
}
if(options.height){
var h=typeof options.height==="number" ? options.height + "px":options.height;
el.style.height=h;
var inner=el.querySelector("video, iframe, .ngg-tiktok-error-content");
if(inner) inner.style.height="100%";
}};
if(playUrl){
var decodedUrl=playUrl;
try {
decodedUrl=decodeURIComponent(playUrl);
} catch (e){}
tiktokContent=self.create_player(decodedUrl, options.containerClass, options.videoClass);
if(tiktokContent){
applyDimensions(tiktokContent);
var video=tiktokContent.querySelector("video");
if(video){
video.onerror=function (){
$(tiktokContent).remove();
var errorMsg=self.create_error("Video failed to load", options.errorClass);
applyDimensions(errorMsg);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
};}
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(tiktokContent);
$targetContainer.append(tiktokContent);
}}else{
var errorMsg=self.create_error("Video not available", options.errorClass);
applyDimensions(errorMsg);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
tiktokContent=errorMsg;
}
return tiktokContent;
},
create_error: function(message, containerClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-tiktok-error";
container.innerHTML =
'<div class="ngg-tiktok-error-content">' +
'<span class="ngg-tiktok-error-icon">&#9888;</span>' +
'<span class="ngg-tiktok-error-text">' +
(message||"Video failed to load") +
"</span>" +
"</div>";
return container;
}};})(jQuery);
jQuery(function($){
var nextgen_fancybox_init=function(){
var selector=nextgen_lightbox_filter_selector($, $(".ngg-fancybox"));
window.addEventListener("click",
e=> {
let $target=$(e.target);
var $anchor=$target.is('a') ? $target:$target.parents('a').first();
if(!$anchor.is(selector)&&!$target.is(selector)){
return;
}
if($anchor.attr('data-dribbble-direct')==='true'){
return;
}
var imageId=$anchor.attr('data-image-id');
var isTikTokImage=false;
var tiktokData=null;
if(imageId&&window.ngg_tiktok_images&&window.ngg_tiktok_images[imageId]){
isTikTokImage=true;
tiktokData=window.ngg_tiktok_images[imageId];
}else if($anchor.attr('data-tiktok-play-url')||$anchor.attr('data-tiktok-share-url')){
isTikTokImage=true;
tiktokData={
playUrl: $anchor.attr('data-tiktok-play-url')||'',
shareUrl: $anchor.attr('data-tiktok-share-url')||'',
embedUrl: $anchor.attr('data-tiktok-embed-url')||''
};}
if(isTikTokImage&&tiktokData){
var $galleryContainer=$anchor.closest('[data-gallery-id]');
var galleryId=null;
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id')||$galleryContainer.data('gallery-id');
}else{
$galleryContainer=$anchor.closest('.ngg-galleryoverview, .ngg-imagebrowser, .ngg-slideshow');
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id') ||
$galleryContainer.data('gallery-id') ||
$galleryContainer.attr('data-nextgen-gallery-id') ||
$galleryContainer.data('nextgen-gallery-id');
}}
if(galleryId){
galleryId=String(galleryId);
}
var tiktokSettings={};
if(window.NggTikTokVideo&&typeof window.NggTikTokVideo.getTikTokSettings==='function'){
tiktokSettings=window.NggTikTokVideo.getTikTokSettings(galleryId);
}else{
if(window.ngg_tiktok_gallery_settings){
if(galleryId&&window.ngg_tiktok_gallery_settings['gallery_' + galleryId]){
tiktokSettings=window.ngg_tiktok_gallery_settings['gallery_' + galleryId];
}else if(window.ngg_tiktok_gallery_settings.global){
tiktokSettings=window.ngg_tiktok_gallery_settings.global;
}}
}
var linkSetting=String(tiktokSettings.link||'0');
if(linkSetting==='1'||linkSetting==='2'){
return;
}}
e.preventDefault();
$(selector).fancybox({
titlePosition: 'inside',
onComplete: function(selectedArray, selectedIndex, selectedOpts){
$("#fancybox-wrap").css("z-index", 10000);
var element=selectedArray[selectedIndex];
var $element=$(element);
var playUrl=$element.data("tiktok-play-url");
var shareUrl=$element.data("tiktok-share-url");
var videoUrl=$element.attr("data-video-url");
if(playUrl||shareUrl){
$("#fancybox-wrap").addClass("ngg-tiktok-mode");
NextGEN_TikTok.handle_content({
playUrl: playUrl,
shareUrl: shareUrl,
container: $("#fancybox-content"),
onBeforeAppend: function (){
$("#fancybox-img").hide();
},
});
}
else if(videoUrl&&window.NextGEN_Video&&window.NextGEN_Video.detect_platform(videoUrl)){
$("#fancybox-wrap").addClass("ngg-video-mode");
$("#fancybox-content .ngg-video-container, #fancybox-content .ngg-video-error").remove();
var galleryId=null;
var $galleryContainer=$element.closest('[data-gallery-id]');
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id')||$galleryContainer.data('gallery-id');
}
var videoSettings={};
if(window.ngg_video_gallery_settings){
if(galleryId&&window.ngg_video_gallery_settings['gallery_' + galleryId]){
videoSettings=window.ngg_video_gallery_settings['gallery_' + galleryId];
}}
window.NextGEN_Video.handle_content({
videoUrl: videoUrl,
container: $("#fancybox-content")[0],
settings: videoSettings,
containerClass: "ngg-video-container",
videoClass: "ngg-video-player",
errorClass: "ngg-video-error",
onBeforeAppend: function (){
$("#fancybox-img").hide();
},
});
}},
onCleanup: function (){
$("#fancybox-wrap").removeClass("ngg-tiktok-mode ngg-video-mode");
$("#fancybox-content .ngg-tiktok-container, #fancybox-content .ngg-tiktok-error").remove();
$("#fancybox-content .ngg-video-container, #fancybox-content .ngg-video-error").remove();
},
});
$target.trigger('click.fb');
e.stopPropagation();
},
true
)
};
$(window).on('refreshed', nextgen_fancybox_init);
nextgen_fancybox_init();
});
window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);
!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},s=i[t]=i[t]||[];return s.includes(e)||s.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let s=i.indexOf(e);return-1!=s&&i.splice(s,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let s=this._onceEvents&&this._onceEvents[t];for(let n of i){s&&s[n]&&(this.off(t,n),delete s[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t})),
function(t,e){"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,(function(t,e){let i=t.jQuery,s=t.console;function n(t,e,o){if(!(this instanceof n))return new n(t,e,o);let r=t;var h;("string"==typeof t&&(r=document.querySelectorAll(t)),r)?(this.elements=(h=r,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?[...h]:[h]),this.options={},"function"==typeof e?o=e:Object.assign(this.options,e),o&&this.on("always",o),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):s.error(`Bad element for imagesLoaded ${r||t}`)}n.prototype=Object.create(e.prototype),n.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const o=[1,9,11];n.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);let{nodeType:e}=t;if(!e||!o.includes(e))return;let i=t.querySelectorAll("img");for(let t of i)this.addImage(t);if("string"==typeof this.options.background){let e=t.querySelectorAll(this.options.background);for(let t of e)this.addElementBackgroundImages(t)}};const r=/url\((['"])?(.*?)\1\)/gi;function h(t){this.img=t}function d(t,e){this.url=t,this.element=e,this.img=new Image}return n.prototype.addElementBackgroundImages=function(t){let e=getComputedStyle(t);if(!e)return;let i=r.exec(e.backgroundImage);for(;null!==i;){let s=i&&i[2];s&&this.addBackground(s,t),i=r.exec(e.backgroundImage)}},n.prototype.addImage=function(t){let e=new h(t);this.images.push(e)},n.prototype.addBackground=function(t,e){let i=new d(t,e);this.images.push(i)},n.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();let t=(t,e,i)=>{setTimeout((()=>{this.progress(t,e,i)}))};this.images.forEach((function(e){e.once("progress",t),e.check()}))},n.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${i}`,t,e)},n.prototype.complete=function(){let t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){let t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t;let{parentNode:i}=this.img,s="PICTURE"===i.nodeName?i:this.img;this.emitEvent("progress",[this,s,e])},h.prototype.handleEvent=function(t){let e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(h.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},n.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&(i=e,i.fn.imagesLoaded=function(t,e){return new n(this,t,e).jqDeferred.promise(i(this))})},n.makeJQueryPlugin(),n}));
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(t,r),delete n[r]),r.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u>e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i],o=n+"MatchesSelector";if(t[o])return o}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var n=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&&"number"==typeof t.length;return e?n.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void o.push(t);e(t,n)&&o.push(t);for(var i=t.querySelectorAll(n),r=0;r<i.length;r++)o.push(i[r])}}),o},i.debounceMethod=function(t,e,i){i=i||100;var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var o=t.console;return i.htmlInit=function(e,n){i.docReady(function(){var r=i.toDashed(n),s="data-"+r,a=document.querySelectorAll("["+s+"]"),h=document.querySelectorAll(".js-"+r),u=i.makeArray(a).concat(i.makeArray(h)),d=s+"-options",l=t.jQuery;u.forEach(function(t){var i,r=t.getAttribute(s)||t.getAttribute(d);try{i=r&&JSON.parse(r)}catch(a){return void(o&&o.error("Error parsing "+s+" on "+t.className+": "+a))}var h=new e(t,i);l&&l.data(t,n,h)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function n(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var r=document.documentElement.style,s="string"==typeof r.transition?"transition":"WebkitTransition",a="string"==typeof r.transform?"transform":"WebkitTransform",h={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[s],u={transform:a,transition:s,transitionDuration:s+"Duration",transitionProperty:s+"Property",transitionDelay:s+"Delay"},d=n.prototype=Object.create(t.prototype);d.constructor=n,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var n=u[i]||i;e[n]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],r=parseFloat(n),s=parseFloat(o),a=this.layout.size;-1!=n.indexOf("%")&&(r=r/100*a.width),-1!=o.indexOf("%")&&(s=s/100*a.height),r=isNaN(r)?0:r,s=isNaN(s)?0:s,r-=e?a.paddingLeft:a.paddingRight,s-=i?a.paddingTop:a.paddingBottom,this.position.x=r,this.position.y=s},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",r=i?"left":"right",s=i?"right":"left",a=this.position.x+t[o];e[r]=this.getXValue(a),e[s]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",d=n?"bottom":"top",l=this.position.y+t[h];e[u]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=t==this.position.x&&e==this.position.y;if(this.setPosition(t,e),o&&!this.isTransitioning)return void this.layoutPosition();var r=t-i,s=e-n,a={};a.transform=this.getTranslate(r,s),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop");return t=i?t:-t,e=n?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+o(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(h,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,n=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[n],i(e.ingProperties)&&this.disableTransition(),n in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd){var o=e.onEnd[n];o.call(this),delete e.onEnd[n]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(h,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var f={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(f)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return s&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,n,o){"use strict";function r(t,e){var i=n.getQueryElement(t);if(!i)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,u&&(this.$element=u(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e);var o=++l;this.element.outlayerGUID=o,c[o]=this,this._create();var r=this._getOption("initLayout");r&&this.layout()}function s(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],n=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var o=m[n]||1;return i*o}var h=t.console,u=t.jQuery,d=function(){},l=0,c={};r.namespace="outlayer",r.Item=o,r.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var f=r.prototype;n.extend(f,e.prototype),f.option=function(t){n.extend(this.options,t)},f._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},r.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},f._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),n.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},f.reloadItems=function(){this.items=this._itemize(this.element.children)},f._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o<e.length;o++){var r=e[o],s=new i(r,this);n.push(s)}return n},f._filterFindItemElements=function(t){return n.filterFindElements(t,this.options.itemSelector)},f.getItemElements=function(){return this.items.map(function(t){return t.element})},f.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},f._init=f.layout,f._resetLayout=function(){this.getSize()},f.getSize=function(){this.size=i(this.element)},f._getMeasurement=function(t,e){var n,o=this.options[t];o?("string"==typeof o?n=this.element.querySelector(o):o instanceof HTMLElement&&(n=o),this[t]=n?i(n)[e]:o):this[t]=0},f.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},f._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},f._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var n=this._getItemLayoutPosition(t);n.item=t,n.isInstant=e||t.isLayoutInstant,i.push(n)},this),this._processLayoutQueue(i)}},f._getItemLayoutPosition=function(){return{x:0,y:0}},f._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},f.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},f._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},f._postLayout=function(){this.resizeContainer()},f.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},f._getContainerSize=d,f._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},f._emitCompleteOnItems=function(t,e){function i(){o.dispatchEvent(t+"Complete",null,[e])}function n(){s++,s==r&&i()}var o=this,r=e.length;if(!e||!r)return void i();var s=0;e.forEach(function(e){e.once(t,n)})},f.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),u)if(this.$element=this.$element||u(this.element),e){var o=u.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},f.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},f.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},f.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},f.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){n.removeFrom(this.stamps,t),this.unignore(t)},this)},f._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=n.makeArray(t)):void 0},f._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},f._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},f._manageStamp=d,f._getElementOffset=function(t){var e=t.getBoundingClientRect(),n=this._boundingRect,o=i(t),r={left:e.left-n.left-o.marginLeft,top:e.top-n.top-o.marginTop,right:n.right-e.right-o.marginRight,bottom:n.bottom-e.bottom-o.marginBottom};return r},f.handleEvent=n.handleEvent,f.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},f.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},f.onresize=function(){this.resize()},n.debounceMethod(r,"onresize",100),f.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},f.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},f.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},f.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},f.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},f.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},f.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},f.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},f.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},f.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},f.getItems=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},f.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),n.removeFrom(this.items,t)},this)},f.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete c[e],delete this.element.outlayerGUID,u&&u.removeData(this.element,this.constructor.namespace)},r.data=function(t){t=n.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&c[e]},r.create=function(t,e){var i=s(r);return i.defaults=n.extend({},r.defaults),n.extend(i.defaults,e),i.compatOptions=n.extend({},r.compatOptions),i.namespace=t,i.data=r.data,i.Item=s(o),n.htmlInit(i,t),u&&u.bridget&&u.bridget(t,i),i};var m={ms:1,s:1e3};return r.Item=o,r}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var n=i.prototype;return n._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},n.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var n=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,r=o/n,s=n-o%n,a=s&&1>s?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});
(function($, window){
'use strict';
window.NggTikTokVideo=window.NggTikTokVideo||{};
let linkHandlersInitialized=false;
const galleryIdCache=new Map();
const DEFAULT_DIMENSIONS={ width: 480, height: 854 };
const ASPECT_RATIO=9 / 16;
const MAX_DEPTH=15;
const INIT_DELAY=100;
NggTikTokVideo.getTikTokSettings=(galleryId)=> {
if(!window.ngg_tiktok_gallery_settings){
window.ngg_tiktok_gallery_settings={
global: {
link: '0',
link_target: '0'
}};}
const settings=window.ngg_tiktok_gallery_settings;
const galleryIdStr=galleryId ? String(galleryId):null;
if(galleryIdStr&&settings[`gallery_${galleryIdStr}`]){
const gallerySettings=settings[`gallery_${galleryIdStr}`];
if(gallerySettings&&(gallerySettings.link!==undefined||gallerySettings.link_target!==undefined)){
return {
link: String(gallerySettings.link ?? '0'),
link_target: String(gallerySettings.link_target ?? '0')
};}}
const globalSettings=settings.global||{};
return {
link: String(globalSettings.link||'0'),
link_target: String(globalSettings.link_target||'0')
};};
const findGalleryId=($anchor, imageId)=> {
const cacheKey=imageId||$anchor[0];
const cachedResult=galleryIdCache.get(cacheKey);
if(cachedResult){
return cachedResult;
}
let $galleryContainer=null;
let galleryId=null;
$galleryContainer=$anchor.closest('[data-gallery-id]');
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id')||$galleryContainer.data('gallery-id');
}
if(!galleryId){
$galleryContainer=$anchor.closest('.ngg-galleryoverview, .ngg-imagebrowser, .ngg-slideshow');
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id') ||
$galleryContainer.data('gallery-id') ||
$galleryContainer.attr('data-nextgen-gallery-id') ||
$galleryContainer.data('nextgen-gallery-id');
}}
if(!galleryId){
let $current=$anchor;
let depth=0;
while (depth < MAX_DEPTH&&$current.length){
if($current.is('[data-gallery-id]')){
galleryId=$current.attr('data-gallery-id')||$current.data('gallery-id');
$galleryContainer=$current;
break;
}
const $sibling=$current.siblings('[data-gallery-id]').first();
if($sibling.length){
galleryId=$sibling.attr('data-gallery-id')||$sibling.data('gallery-id');
$galleryContainer=$sibling;
break;
}
$current=$current.parent();
depth++;
}}
if(!galleryId&&imageId){
const $allContainers=$('[data-gallery-id]');
$allContainers.each(function(){
const $container=$(this);
if($container.find($anchor).length > 0){
galleryId=$container.attr('data-gallery-id')||$container.data('gallery-id');
$galleryContainer=$container;
return false;
}});
}
const result={
galleryId: galleryId ? String(galleryId):null,
$galleryContainer
};
galleryIdCache.set(cacheKey, result);
return result;
};
const getTikTokDataFromAnchor=($anchor, imageId)=> {
if(imageId&&window.ngg_tiktok_images?.[imageId]){
return window.ngg_tiktok_images[imageId];
}
const playUrl=$anchor.attr('data-tiktok-play-url');
const shareUrl=$anchor.attr('data-tiktok-share-url');
const embedUrl=$anchor.attr('data-tiktok-embed-url');
if(playUrl||shareUrl||embedUrl){
return {
playUrl: playUrl||'',
shareUrl: shareUrl||'',
embedUrl: embedUrl||''
};}
return null;
};
const handleTikTokLinkClick=(e)=> {
const anchor=e.target.closest('a[data-image-id]');
if(!anchor){
return;
}
const $anchor=$(anchor);
const imageId=$anchor.attr('data-image-id');
const tiktokData=getTikTokDataFromAnchor($anchor, imageId);
if(!tiktokData){
return;
}
const { galleryId }=findGalleryId($anchor, imageId);
const tiktokSettings=NggTikTokVideo.getTikTokSettings(galleryId);
const linkSetting=String(tiktokSettings.link||'0');
const linkTarget=String(tiktokSettings.link_target||'0');
if(linkSetting!=='1'&&linkSetting!=='2'){
return;
}
if(linkSetting==='1'&&!tiktokData.shareUrl){
return;
}
if(linkSetting==='2'&&!tiktokData.embedUrl&&!tiktokData.shareUrl){
return;
}
e.preventDefault();
e.stopPropagation();
const openNewTab=linkTarget==='1'||linkTarget==='_blank';
let targetUrl='';
if(linkSetting==='1'){
targetUrl=tiktokData.shareUrl||'';
}else if(linkSetting==='2'){
targetUrl=tiktokData.embedUrl||tiktokData.shareUrl||'';
}
if(targetUrl){
if(openNewTab){
window.open(targetUrl, '_blank', 'noopener,noreferrer');
}else{
window.location.href=targetUrl;
}}
};
NggTikTokVideo.initLinkHandlers=()=> {
if(linkHandlersInitialized){
return;
}
linkHandlersInitialized=true;
document.addEventListener('click', handleTikTokLinkClick, true);
};
NggTikTokVideo.isTikTokImage=(element)=> {
const $el=$(element);
const $anchor=$el.is('a') ? $el:$el.closest('a');
if($anchor.attr('data-ngg-tiktok-source')==='true'){
return true;
}
const imageId=$anchor.attr('data-image-id');
if(imageId&&window.ngg_tiktok_images?.[imageId]){
const $galleryContainer=$anchor.closest('[data-gallery-id]');
const galleryId=$galleryContainer.length ? $galleryContainer.attr('data-gallery-id'):null;
const settings=NggTikTokVideo.getTikTokSettings(galleryId);
return String(settings.link||'0')==='0';
}
return false;
};
NggTikTokVideo.getTikTokData=(element)=> {
const $el=$(element);
const $anchor=$el.is('a') ? $el:$el.closest('a');
const playUrl=$anchor.attr('data-ngg-tiktok-play-url');
const shareUrl=$anchor.attr('data-ngg-tiktok-share-url');
const embedUrl=$anchor.attr('data-ngg-tiktok-embed-url');
const tiktokId=$anchor.attr('data-ngg-tiktok-id');
if(playUrl||shareUrl||embedUrl){
return {
tiktokId: tiktokId||'',
playUrl: playUrl||'',
shareUrl: shareUrl||'',
embedUrl: embedUrl||'',
linkSetting: '0'
};}
const imageId=$anchor.attr('data-image-id');
if(imageId&&window.ngg_tiktok_images?.[imageId]){
return window.ngg_tiktok_images[imageId];
}
return null;
};
NggTikTokVideo.getVideoUrl=(tiktokData)=> {
if(!tiktokData){
return '';
}
if(tiktokData.playUrl?.length > 0){
return tiktokData.playUrl;
}
if(tiktokData.shareUrl?.length > 0){
return tiktokData.shareUrl;
}
return '';
};
NggTikTokVideo.getEmbedUrl=(tiktokData)=> {
if(!tiktokData){
return '';
}
if(tiktokData.embedUrl){
return tiktokData.embedUrl;
}
if(tiktokData.shareUrl){
const match=tiktokData.shareUrl.match(/video\/(\d+)/);
if(match?.[1]){
return `https://www.tiktok.com/embed/v2/${match[1]}`;
}}
return '';
};
const createErrorMessage=(message)=> {
return $('<div class="ngg-tiktok-error"></div>')
.text(message)
.css({
color: '#fff',
textAlign: 'center',
padding: '20px'
});
};
const createVideoElement=(videoUrl, autoplay, onReady, onError)=> {
const $video=$('<video></video>').attr({
src: videoUrl,
controls: true,
autoplay: autoplay,
playsinline: true,
preload: 'auto'
}).css({
width: '100%',
height: '100%',
objectFit: 'contain'
});
$video.on('loadeddata', ()=> {
onReady($video[0]);
});
$video.on('error', ()=> {
$video.remove();
onError(new Error('Video failed to load'));
});
return $video;
};
NggTikTokVideo.createPlayer=(options={})=> {
const {
tiktokData,
width=DEFAULT_DIMENSIONS.width,
height=DEFAULT_DIMENSIONS.height,
autoplay=true,
onReady=()=> {},
onError=()=> {}}=options;
const $container=$('<div class="ngg-tiktok-video-container"></div>').css({
position: 'relative',
width,
height,
maxWidth: '100%',
maxHeight: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
});
const videoUrl=NggTikTokVideo.getVideoUrl(tiktokData);
if(videoUrl&&videoUrl.includes('tiktokcdn.com')){
const $video=createVideoElement(videoUrl, autoplay, onReady, (error)=> {
$container.append(createErrorMessage('Video failed to load'));
onError(error);
});
$container.append($video);
}else{
$container.append(createErrorMessage('Video not available'));
onError(new Error('No video URL available'));
}
return $container;
};
NggTikTokVideo._createEmbedPlayer=($container, embedUrl, width, height, autoplay, onReady, onError)=> {
$container.empty();
if(!embedUrl){
$container.append(createErrorMessage('Video not available'));
onError(new Error('No embed URL available'));
return;
}
const url=autoplay
? `${embedUrl}${embedUrl.includes('?') ? '&':'?'}autoplay=1`
: embedUrl;
const $iframe=$('<iframe></iframe>').attr({
src: url,
frameborder: '0',
allowfullscreen: true,
allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
}).css({
width: '100%',
height: '100%',
border: 'none'
});
$iframe.on('load', ()=> {
onReady($iframe[0]);
});
$iframe.on('error', ()=> {
onError(new Error('Failed to load TikTok embed'));
});
$container.append($iframe);
};
NggTikTokVideo.replaceImageWithVideo=(imageElement, options={})=> {
const $image=$(imageElement);
const $anchor=$image.closest('a');
const tiktokData=options.tiktokData||NggTikTokVideo.getTikTokData($anchor);
if(!tiktokData){
return null;
}
const width=options.width||$image.width()||DEFAULT_DIMENSIONS.width;
const height=options.height||$image.height()||DEFAULT_DIMENSIONS.height;
const playerOptions={
...options,
tiktokData,
width,
height
};
const $player=NggTikTokVideo.createPlayer(playerOptions);
$image.replaceWith($player);
return $player;
};
NggTikTokVideo.createLightboxPlayer=(tiktokData, lightboxOptions={})=> {
const {
maxWidth=window.innerWidth * 0.8,
maxHeight=window.innerHeight * 0.9,
onReady,
onError
}=lightboxOptions;
let width, height;
if(maxHeight * ASPECT_RATIO <=maxWidth){
height=maxHeight;
width=height * ASPECT_RATIO;
}else{
width=maxWidth;
height=width / ASPECT_RATIO;
}
return NggTikTokVideo.createPlayer({
tiktokData,
width: Math.round(width),
height: Math.round(height),
autoplay: true,
onReady,
onError
});
};
NggTikTokVideo.destroyPlayer=($container)=> {
if(!$container?.length){
return;
}
const $video=$container.find('video');
if($video.length){
$video[0].pause();
$video.attr('src', '');
}
const $iframe=$container.find('iframe');
if($iframe.length){
$iframe.attr('src', '');
}
$container.remove();
};
$(()=> {
setTimeout(()=> {
NggTikTokVideo.initLinkHandlers();
}, INIT_DELAY);
});
})(jQuery, window);
(function($){
"use strict";
window.NextGEN_Video={
detect_platform: function(url){
if(!url) return null;
url=url.trim().toLowerCase();
if(url.match(/youtube\.com|youtu\.be|youtube-nocookie\.com/)){
return 'youtube';
}
if(url.match(/vimeo\.com/)){
return 'vimeo';
}
if(url.match(/dailymotion\.com|dai\.ly/)){
return 'dailymotion';
}
if(url.match(/twitch\.tv/)){
return 'twitch';
}
if(url.match(/videopress\.com|video\.wordpress\.com/)){
return 'videopress';
}
if(url.match(/wistia\.com|wistia\.net/)){
return 'wistia';
}
if(url.match(/\.(mp4|webm|ogg|ogv|mov|avi|wmv|flv|mkv)(\?|$)/i)){
return 'local';
}
return null;
},
extract_youtube_id: function(url){
if(!url) return null;
var patterns=[
/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube-nocookie\.com\/embed\/)([^&\n?#]+)/,
/youtube\.com\/.*[?&]v=([^&\n?#]+)/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
return null;
},
extract_vimeo_id: function(url){
if(!url) return null;
var patterns=[
/vimeo\.com\/(\d+)/,
/vimeo\.com\/.*\/(\d+)/,
/player\.vimeo\.com\/video\/(\d+)/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
return null;
},
extract_dailymotion_id: function(url){
if(!url) return null;
var patterns=[
/dailymotion\.com\/video\/([^/?]+)/,
/dai\.ly\/([^/?]+)/,
/dailymotion\.com\/embed\/video\/([^/?]+)/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
return null;
},
extract_twitch_id: function(url){
if(!url) return null;
var videoMatch=url.match(/twitch\.tv\/videos\/(\d+)/);
if(videoMatch&&videoMatch[1]){
return { videoId: videoMatch[1], type: 'video' };}
var clipMatch=url.match(/(?:twitch\.tv\/|clips\.twitch\.tv\/)([^/?]+)/);
if(clipMatch&&clipMatch[1]){
return { videoId: clipMatch[1], type: 'clip' };}
return null;
},
extract_videopress_id: function(url){
if(!url) return null;
var patterns=[
/videopress\.com\/v\/([^/?]+)/,
/video\.wordpress\.com\/v\/([^/?]+)/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
return null;
},
extract_wistia_id: function(url){
if(!url) return null;
var patterns=[
/wistia\.(?:com|net)\/medias\/([^/?]+)/,
/wistia\.(?:com|net)\/embed\/([^/?]+)/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
return null;
},
get_embed_url: function(platform, videoId, settings){
if(!platform||!videoId) return null;
settings=settings||{};
var autoplay=settings.autoplay_videos ? 1:0;
var controls=settings.show_video_controls!==false ? 1:0;
switch (platform){
case 'youtube':
var youtubeId=typeof videoId==='string' ? videoId:videoId.videoId;
return 'https://www.youtube.com/embed/' + youtubeId +
'?autoplay=' + autoplay +
'&controls=' + controls +
'&rel=0&modestbranding=1';
case 'vimeo':
var vimeoId=typeof videoId==='string' ? videoId:videoId.videoId;
return 'https://player.vimeo.com/video/' + vimeoId +
'?autoplay=' + autoplay +
'&controls=' + controls;
case 'dailymotion':
var dmId=typeof videoId==='string' ? videoId:videoId.videoId;
return 'https://www.dailymotion.com/embed/video/' + dmId +
'?autoplay=' + autoplay +
'&controls=' + controls;
case 'twitch':
var twitchData=typeof videoId==='object' ? videoId:{ videoId: videoId, type: 'video' };
if(twitchData.type==='clip'){
return 'https://clips.twitch.tv/embed?clip=' + twitchData.videoId +
'&autoplay=' + autoplay +
'&parent=' + window.location.hostname;
}else{
return 'https://player.twitch.tv/?video=v' + twitchData.videoId +
'&autoplay=' + autoplay +
'&parent=' + window.location.hostname;
}
case 'videopress':
var vpId=typeof videoId==='string' ? videoId:videoId.videoId;
return 'https://videopress.com/embed/' + vpId +
'?autoplay=' + autoplay +
'&controls=' + controls;
case 'wistia':
var wistiaId=typeof videoId==='string' ? videoId:videoId.videoId;
return 'https://fast.wistia.net/embed/iframe/' + wistiaId +
'?autoplay=' + autoplay +
'&controlsVisibleOnLoad=' + controls;
case 'local':
return typeof videoId==='string' ? videoId:null;
default:
return null;
}},
create_local_player: function(videoUrl, settings, containerClass, videoClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-video-container";
var video=document.createElement("video");
video.className=videoClass||"ngg-video-player";
video.controls=settings.show_video_controls!==false;
video.autoplay=settings.autoplay_videos===true;
video.playsInline=true;
video.preload="auto";
video.setAttribute("playsinline", "");
video.setAttribute("webkit-playsinline", "");
video.src=videoUrl;
video.addEventListener("error", function(e){
console.error("Video player error:", {
error: e,
videoUrl: videoUrl,
errorCode: video.error ? video.error.code:"unknown",
errorMessage: video.error ? video.error.message:"Unknown error"
});
});
video.addEventListener("loadedmetadata", function (){
var naturalWidth=video.videoWidth;
var naturalHeight=video.videoHeight;
if(naturalWidth&&naturalHeight){
var container=video.closest('.ngg-video-container');
var displayWidth=naturalWidth;
var displayHeight=naturalHeight;
if(container){
var fancyboxContent=container.closest('#fancybox-content');
var tbWindow=container.closest('#TB_window');
var slImage=container.closest('.sl-image');
var shWrap=container.closest('#shWrap');
if(shWrap){
var wiH=window.innerHeight||0;
var dbH=document.body.clientHeight||0;
var deH=document.documentElement ? document.documentElement.clientHeight:0;
var wHeight;
if(wiH > 0){
wHeight=((wiH - dbH) > 1&&(wiH - dbH) < 30) ? dbH:wiH;
wHeight=((wHeight - deH) > 1&&(wHeight - deH) < 30) ? deH:wHeight;
}else{
wHeight=(deH > 0) ? deH:dbH;
}
if(document.getElementsByTagName("body")[0].className.match(/admin-bar/)
&& document.getElementById('wpadminbar')!==null){
wHeight=wHeight - document.getElementById('wpadminbar').offsetHeight;
}
var shHeight=wHeight - 50;
var deW=document.documentElement ? document.documentElement.clientWidth:0;
var dbW=window.innerWidth||document.body.clientWidth;
var wWidth=(deW > 1) ? deW:dbW;
if(displayHeight > shHeight){
displayWidth=displayWidth * (shHeight / displayHeight);
displayHeight=shHeight;
}
if(displayWidth > (wWidth - 16)){
displayHeight=displayHeight * ((wWidth - 16) / displayWidth);
displayWidth=wWidth - 16;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth="none";
video.style.maxHeight="none";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(fancyboxContent){
setTimeout(function(){
var contentRect=fancyboxContent.getBoundingClientRect();
if(contentRect.width > 10&&contentRect.height > 10){
var maxW=contentRect.width;
var maxH=contentRect.height;
if(displayWidth > maxW||displayHeight > maxH){
var ratio=displayWidth / displayHeight > maxW / maxH
? displayWidth / maxW
: displayHeight / maxH;
displayWidth=displayWidth / ratio;
displayHeight=displayHeight / ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}}, 50);
return;
}else if(tbWindow){
var pageWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
var pageHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var x=pageWidth - 150;
var y=pageHeight - 150;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
}}else if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
}}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(slImage){
var widthRatio=0.8;
var heightRatio=0.9;
var windowWidth=window.innerWidth;
var windowHeight=window.innerHeight;
var maxWidth=windowWidth * widthRatio;
var maxHeight=windowHeight * heightRatio;
if(displayWidth > maxWidth||displayHeight > maxHeight){
var ratio=displayWidth / displayHeight > maxWidth / maxHeight
? displayWidth / maxWidth
: displayHeight / maxHeight;
displayWidth /=ratio;
displayHeight /=ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth=maxWidth + "px";
video.style.maxHeight=maxHeight + "px";
}}
}});
if(settings.autoplay_videos){
video.addEventListener("canplay", function (){
video.play().catch(function (error){
console.error("Video autoplay failed:", error);
});
});
}
container.appendChild(video);
return container;
},
create_embed_player: function(embedUrl, settings, containerClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-video-container";
var iframe=document.createElement("iframe");
iframe.src=embedUrl;
iframe.frameBorder="0";
iframe.allowFullscreen=true;
iframe.setAttribute("allow", "autoplay; encrypted-media");
iframe.style.width="100%";
iframe.style.height="100%";
iframe.style.border="none";
iframe.addEventListener("error", function(e){
console.error("Video iframe error:", {
error: e,
embedUrl: embedUrl
});
});
iframe.addEventListener("load", function(){
try {
var iframeDoc=iframe.contentDocument||iframe.contentWindow.document;
} catch (e){
if(e.name!=="SecurityError"){
console.error("Video iframe load error:", e);
}}
});
var aspectRatio=16 / 9;
var maxWidth=window.innerWidth * 0.9;
var maxHeight=window.innerHeight * 0.9;
var width=Math.min(maxWidth, 1080);
var height=width / aspectRatio;
if(height > maxHeight){
height=maxHeight;
width=height * aspectRatio;
}
container.style.width=width + "px";
container.style.height=height + "px";
container.style.maxWidth="100%";
container.style.maxHeight="90vh";
container.appendChild(iframe);
return container;
},
handle_content: function(options){
var self=this;
var videoUrl=options.videoUrl;
var $targetContainer=$(options.container);
var settings=options.settings||{};
if(!videoUrl){
console.error("Video URL is required");
return null;
}
try {
var platform=self.detect_platform(videoUrl);
if(!platform){
console.warn("Unrecognized video URL:", videoUrl);
return null;
}} catch (error){
console.error("Error detecting video platform:", error);
return null;
}
var videoContent=null;
var videoId=null;
switch (platform){
case 'youtube':
videoId=self.extract_youtube_id(videoUrl);
break;
case 'vimeo':
videoId=self.extract_vimeo_id(videoUrl);
break;
case 'dailymotion':
videoId=self.extract_dailymotion_id(videoUrl);
break;
case 'twitch':
videoId=self.extract_twitch_id(videoUrl);
break;
case 'videopress':
videoId=self.extract_videopress_id(videoUrl);
break;
case 'wistia':
videoId=self.extract_wistia_id(videoUrl);
break;
case 'local':
videoId=videoUrl;
break;
}
if(!videoId){
var errorMsg=self.create_error("Could not extract video ID from URL", options.errorClass);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
return errorMsg;
}
try {
if(platform==='local'){
videoContent=self.create_local_player(videoId, settings, options.containerClass, options.videoClass);
}else{
var embedUrl=self.get_embed_url(platform, videoId, settings);
if(embedUrl){
videoContent=self.create_embed_player(embedUrl, settings, options.containerClass);
}else{
var errorMsg=self.create_error("Could not generate embed URL", options.errorClass);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
return errorMsg;
}}
if(videoContent){
if(platform==='local'){
var video=videoContent.querySelector("video");
if(video){
video.onerror=function (){
$(videoContent).remove();
var errorMsg=self.create_error("Video failed to load", options.errorClass);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
};}}
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(videoContent);
$targetContainer.append(videoContent);
}} catch (error){
console.error("Error creating video player:", error);
var errorMsg=self.create_error("Video player creation failed", options.errorClass);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
return errorMsg;
}
return videoContent;
},
create_error: function(message, containerClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-video-error";
container.innerHTML =
'<div class="ngg-video-error-content">' +
'<span class="ngg-video-error-icon">&#9888;</span>' +
'<span class="ngg-video-error-text">' +
(message||"Video failed to load") +
"</span>" +
"</div>";
return container;
}};})(jQuery);
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):jQuery&&!jQuery.fn.hoverIntent&&e(jQuery)}(function(f){"use strict";function u(e){return"function"==typeof e}var i,r,v={interval:100,sensitivity:6,timeout:0},s=0,a=function(e){i=e.pageX,r=e.pageY},p=function(e,t,n,o){if(Math.sqrt((n.pX-i)*(n.pX-i)+(n.pY-r)*(n.pY-r))<o.sensitivity)return t.off(n.event,a),delete n.timeoutId,n.isActive=!0,e.pageX=i,e.pageY=r,delete n.pX,delete n.pY,o.over.apply(t[0],[e]);n.pX=i,n.pY=r,n.timeoutId=setTimeout(function(){p(e,t,n,o)},o.interval)};f.fn.hoverIntent=function(e,t,n){function o(e){var u=f.extend({},e),r=f(this),v=((t=r.data("hoverIntent"))||r.data("hoverIntent",t={}),t[i]),t=(v||(t[i]=v={id:i}),v.timeoutId&&(v.timeoutId=clearTimeout(v.timeoutId)),v.event="mousemove.hoverIntent.hoverIntent"+i);"mouseenter"===e.type?v.isActive||(v.pX=u.pageX,v.pY=u.pageY,r.off(t,a).on(t,a),v.timeoutId=setTimeout(function(){p(u,r,v,d)},d.interval)):v.isActive&&(r.off(t,a),v.timeoutId=setTimeout(function(){var e,t,n,o,i;e=u,t=r,n=v,o=d.out,(i=t.data("hoverIntent"))&&delete i[n.id],o.apply(t[0],[e])},d.timeout))}var i=s++,d=f.extend({},v);f.isPlainObject(e)?(d=f.extend(d,e),u(d.out)||(d.out=d.over)):d=u(t)?f.extend(d,{over:e,out:t,selector:n}):f.extend(d,{over:e,out:e,selector:t});return this.on({"mouseenter.hoverIntent":o,"mouseleave.hoverIntent":o},d.selector)}});
(function($){
"use strict";
let instanceCounter=0;
$.maxmegamenu=function(menu, options){
const plugin=this;
const $menu=$(menu);
const $wrap=$menu.parent();
const $toggle_bar=$menu.siblings(".mega-menu-toggle");
const menuId=$menu.attr("id");
const instanceId=menuId + '-' + (++instanceCounter);
const docEventNamespace='.megamenu-' + instanceId;
const items_with_submenus=$([
"li.mega-menu-megamenu.mega-menu-item-has-children",
"li.mega-menu-flyout.mega-menu-item-has-children",
"li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item-has-children",
"li.mega-menu-flyout li.mega-menu-item-has-children"
].join(","), $menu);
const collapse_children_parents=$("li.mega-menu-megamenu li.mega-menu-item-has-children.mega-collapse-children > a.mega-menu-link", $menu);
const tab_key="Tab";
const escape_key="Escape";
const enter_key="Enter";
const space_key=" ";
const left_arrow_key="ArrowLeft";
const up_arrow_key="ArrowUp";
const right_arrow_key="ArrowRight";
const down_arrow_key="ArrowDown";
const defaults={
event:                $menu.attr("data-event"),
effect:               $menu.attr("data-effect"),
effect_speed:         parseInt($menu.attr("data-effect-speed")),
effect_mobile:        $menu.attr("data-effect-mobile"),
effect_speed_mobile:  parseInt($menu.attr("data-effect-speed-mobile")),
panel_width:          $menu.attr("data-panel-width"),
panel_inner_width:    $menu.attr("data-panel-inner-width"),
mobile_force_width:   $menu.attr("data-mobile-force-width"),
mobile_overlay:       $menu.attr("data-mobile-overlay"),
mobile_state:         $menu.attr("data-mobile-state"),
mobile_direction:     $menu.attr("data-mobile-direction"),
second_click:         $menu.attr("data-second-click"),
vertical_behaviour:   $menu.attr("data-vertical-behaviour"),
document_click:       $menu.attr("data-document-click"),
breakpoint:           $menu.attr("data-breakpoint"),
unbind_events:        $menu.attr("data-unbind"),
hover_intent_timeout: $menu.attr("data-hover-intent-timeout") ?? 300,
hover_intent_interval: $menu.attr("data-hover-intent-interval") ?? 100
};
plugin.settings={};
let html_body_class_timeout;
plugin.addAnimatingClass=function(element){
if(plugin.settings.effect==="disabled"){
return;
}
$(".mega-animating", $wrap).removeClass("mega-animating");
const timeout=plugin.settings.effect_speed + parseInt(plugin.settings.hover_intent_timeout, 10);
element.addClass("mega-animating");
setTimeout(function(){
element.removeClass("mega-animating");
}, timeout);
};
plugin.hideAllPanels=function(){
$(".mega-toggle-on > a.mega-menu-link", $menu).each(function(){
plugin.hidePanel($(this), false);
});
};
plugin.expandMobileSubMenus=function(){
if(plugin.settings.mobile_direction!=='vertical'){
return;
}
$(".mega-menu-item-has-children.mega-expand-on-mobile > a.mega-menu-link", $menu).each(function(){
plugin.showPanel($(this), true);
});
if(plugin.settings.mobile_state==='expand_all'){
$(".mega-menu-item-has-children:not(.mega-toggle-on) > a.mega-menu-link", $menu).each(function(){
plugin.showPanel($(this), true);
});
}
if(plugin.settings.mobile_state==='expand_active'){
const activeItemSelectors=[
"li.mega-current-menu-ancestor.mega-menu-item-has-children > a.mega-menu-link",
"li.mega-current-menu-item.mega-menu-item-has-children > a.mega-menu-link",
"li.mega-current-menu-parent.mega-menu-item-has-children > a.mega-menu-link",
"li.mega-current_page_ancestor.mega-menu-item-has-children > a.mega-menu-link",
"li.mega-current_page_item.mega-menu-item-has-children > a.mega-menu-link"
];
$menu.find(activeItemSelectors.join(', ')).each(function(){
plugin.showPanel($(this), true);
});
}};
plugin.hideSiblingPanels=function(anchor, immediate){
anchor.parent().parent().find(".mega-toggle-on").children("a.mega-menu-link").each(function(){
plugin.hidePanel($(this), immediate);
});
};
plugin.isDesktopView=function(){
const width=Math.max(document.documentElement.clientWidth||0, window.innerWidth||0);
return width > plugin.settings.breakpoint;
};
plugin.isMobileView=function(){
return !plugin.isDesktopView();
};
plugin.isHorizontalMobileSubmenuMode=function(){
return plugin.isMobileView()&&plugin.isMobileOffCanvas()&&plugin.settings.mobile_direction==="horizontal";
};
plugin.getFocusableItemsInSubmenu=function($submenu, include_back_link=true){
let $focusable=$submenu.children("li.mega-menu-item:visible").find("> a.mega-menu-link, > .mega-search span[role=button]");
if(!include_back_link){
$focusable=$focusable.not(".mega-mobile-back-link");
}
return $focusable;
};
plugin.focusFirstItemInOpenedSubmenu=function($item){
if(! plugin.isHorizontalMobileSubmenuMode()||! $wrap.hasClass("mega-keyboard-navigation")){
return;
}
const $submenu=$item.children("ul.mega-sub-menu");
if(!$submenu.length){
return;
}
const $firstFocusable=plugin.getFocusableItemsInSubmenu($submenu, false).first();
if($firstFocusable.length){
$firstFocusable.trigger("focus");
}};
plugin.deferFocusFirstItemInOpenedSubmenu=function($item){
const delay=Math.min(120, parseInt(plugin.settings.effect_speed_mobile, 10)||0);
setTimeout(function(){
plugin.focusFirstItemInOpenedSubmenu($item);
setTimeout(function(){
const focusedInSubmenu=$item.find("ul.mega-sub-menu").has(document.activeElement).length!==0;
if(!focusedInSubmenu){
plugin.focusFirstItemInOpenedSubmenu($item);
}}, 40);
}, delay);
};
plugin.showPanel=function(anchor, immediate){
if(typeof anchor==='number'||(typeof anchor==='string'&&anchor.trim()!==''&&!isNaN(anchor)) ){
anchor=$("li.mega-menu-item-" + anchor, $menu).find("a.mega-menu-link").first();
}else if(anchor.is("li.mega-menu-item")){
anchor=anchor.find("a.mega-menu-link").first();
}
const $item=anchor.parent();
const isDesktop=plugin.isDesktopView();
const isMobile = !isDesktop;
$item.triggerHandler("before_open_panel");
$item.find("[aria-expanded]").first().attr("aria-expanded", "true");
$(".mega-animating", $wrap).removeClass("mega-animating");
if(isMobile&&$item.hasClass("mega-hide-sub-menu-on-mobile")){
return;
}
if(isDesktop&&($menu.hasClass("mega-menu-horizontal")||$menu.hasClass("mega-menu-vertical"))&&!$item.hasClass("mega-collapse-children")){
plugin.hideSiblingPanels(anchor, true);
}
if((isMobile&&$wrap.hasClass("mega-keyboard-navigation"))||plugin.settings.vertical_behaviour==="accordion"){
plugin.hideSiblingPanels(anchor, false);
}
plugin.calculateDynamicSubmenuWidths(anchor);
if(plugin.shouldUseSlideAnimation(anchor, immediate)){
const speed=isMobile ? plugin.settings.effect_speed_mobile:plugin.settings.effect_speed;
anchor.siblings(".mega-sub-menu").css("display", "none").animate({"height":"show", "paddingTop":"show", "paddingBottom":"show", "minHeight":"show"}, speed, function(){
$(this).css("display", "");
});
}
$item.addClass("mega-toggle-on").triggerHandler("open_panel");
plugin.deferFocusFirstItemInOpenedSubmenu($item);
};
plugin.shouldUseSlideAnimation=function(anchor, immediate){
if(immediate===true){
return false;
}
if(anchor.parent().hasClass("mega-collapse-children")){
return true;
}
const isDesktop=plugin.isDesktopView();
if(isDesktop&&plugin.settings.effect==="slide"){
return true;
}
if(!isDesktop){
if(plugin.settings.effect_mobile==="slide"){
return true;
}
if(plugin.isMobileOffCanvas()){
return plugin.settings.mobile_direction!=="horizontal";
}}
return false;
};
plugin.hidePanel=function(anchor, immediate){
if(typeof anchor==='number'||(typeof anchor==='string'&&anchor.trim()!==''&&!isNaN(anchor)) ){
anchor=$("li.mega-menu-item-" + anchor, $menu).find("a.mega-menu-link").first();
}else if(anchor.is("li.mega-menu-item")){
anchor=anchor.find("a.mega-menu-link").first();
}
const $item=anchor.parent();
const $submenu=anchor.siblings(".mega-sub-menu");
const isMobile=plugin.isMobileView();
$item.triggerHandler("before_close_panel");
$item.find("[aria-expanded]").first().attr("aria-expanded", "false");
if(plugin.shouldUseSlideAnimation(anchor)){
const speed=isMobile ? plugin.settings.effect_speed_mobile:plugin.settings.effect_speed;
$submenu.animate({"height":"hide", "paddingTop":"hide", "paddingBottom":"hide", "minHeight":"hide"}, speed, function(){
$submenu.css("display", "");
$item.removeClass("mega-toggle-on").triggerHandler("close_panel");
});
return;
}
if(immediate){
$submenu.css("display", "none").delay(plugin.settings.effect_speed).queue(function(){
$(this).css("display", "").dequeue();
});
}
$submenu.find(".widget_media_video video").each(function(){
if(this.player){
this.player.pause();
}});
$item.removeClass("mega-toggle-on").triggerHandler("close_panel");
plugin.addAnimatingClass($item);
};
plugin.calculateDynamicSubmenuWidths=function(anchor){
const $item=anchor.parent();
const $submenu=anchor.siblings(".mega-sub-menu");
const isDesktop=plugin.isDesktopView();
const isTopLevelMegamenu=$item.hasClass("mega-menu-megamenu")&&$item.parent().hasClass("max-mega-menu");
if(isTopLevelMegamenu&&plugin.settings.panel_width){
if(isDesktop){
const submenu_offset=$menu.offset();
if(plugin.settings.panel_width==='100vw'){
const target_offset=$('body').offset();
$submenu.css({
left: (target_offset.left - submenu_offset.left) + "px"
});
}else{
const $panel_width_el=$(plugin.settings.panel_width);
if($panel_width_el.length > 0){
$submenu.css({
width: $panel_width_el.outerWidth(),
left: ($panel_width_el.offset().left - submenu_offset.left) + "px"
});
}}
}else{
$submenu.css({
width: "",
left: ""
});
}}
if(isTopLevelMegamenu&&plugin.settings.panel_inner_width){
const $panel_inner_width_el=$(plugin.settings.panel_inner_width);
if($panel_inner_width_el.length > 0){
const target_width=parseInt($panel_inner_width_el.width(), 10);
$submenu.css({
"paddingLeft": "",
"paddingRight": ""
});
const submenu_width=parseInt($submenu.innerWidth(), 10);
if(isDesktop&&target_width > 0&&target_width < submenu_width){
$submenu.css({
"paddingLeft": (submenu_width - target_width) / 2 + "px",
"paddingRight": (submenu_width - target_width) / 2 + "px"
});
}}
}};
plugin.bindClickEvents=function(){
plugin.unbindClickEvents();
let dragging=false;
$(document).on({
["touchmove" + docEventNamespace]: function(){ dragging=true; },
["touchstart" + docEventNamespace]: function(){ dragging=false; }});
$(document).on("click" + docEventNamespace + " touchend" + docEventNamespace, function(e){
if(!dragging&&plugin.settings.document_click==="collapse"&&! $(e.target).closest(".mega-menu-wrap").length){
plugin.hideAllPanels();
plugin.hideMobileMenu();
}
dragging=false;
});
const clickable_parents=$("> a.mega-menu-link", items_with_submenus).add(collapse_children_parents);
clickable_parents.on("touchend.megamenu", function(e){
if(plugin.settings.event==="hover_intent"){
plugin.unbindHoverIntentEvents();
}
if(plugin.settings.event==="hover"){
plugin.unbindHoverEvents();
}});
clickable_parents.on("click.megamenu", function(e){
if($(e.target).hasClass('mega-indicator')){
return;
}
if(plugin.isDesktopView()&&$(this).parent().hasClass("mega-toggle-on")&&$(this).closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
if(plugin.settings.second_click==="go"){
return;
}else{
e.preventDefault();
return;
}}
if(dragging){
return;
}
if(plugin.isMobileView()&&$(this).parent().hasClass("mega-hide-sub-menu-on-mobile")){
return;
}
if((plugin.settings.second_click==="go"||$(this).parent().hasClass("mega-click-click-go"))&&$(this).attr("href")!==undefined){
if(!$(this).parent().hasClass("mega-toggle-on")){
e.preventDefault();
plugin.showPanel($(this));
}}else{
e.preventDefault();
if($(this).parent().hasClass("mega-toggle-on")){
plugin.hidePanel($(this), false);
}else{
plugin.showPanel($(this));
}}
});
if(plugin.settings.second_click==="disabled"){
clickable_parents.off("click.megamenu");
}
$(".mega-close-after-click:not(.mega-menu-item-has-children) > a.mega-menu-link", $menu).on("click.megamenu", function(){
plugin.hideAllPanels();
plugin.hideMobileMenu();
});
$("button.mega-close", $wrap).on("click.megamenu", function(e){
plugin.hideMobileMenu();
});
};
plugin.bindHoverEvents=function(){
items_with_submenus.on({
"mouseenter.megamenu":function(){
plugin.unbindClickEvents();
if(! $(this).hasClass("mega-toggle-on")){
plugin.showPanel($(this).children("a.mega-menu-link"));
}},
"mouseleave.megamenu":function(){
if($(this).hasClass("mega-toggle-on")&&! $(this).hasClass("mega-disable-collapse")&&! $(this).parent().parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel($(this).children("a.mega-menu-link"), false);
}}
});
};
plugin.bindHoverIntentEvents=function(){
items_with_submenus.hoverIntent({
over: function (){
plugin.unbindClickEvents();
if(! $(this).hasClass("mega-toggle-on")){
plugin.showPanel($(this).children("a.mega-menu-link"));
}},
out: function (){
if($(this).hasClass("mega-toggle-on")&&! $(this).hasClass("mega-disable-collapse")&&! $(this).parent().parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel($(this).children("a.mega-menu-link"), false);
}},
timeout: plugin.settings.hover_intent_timeout,
interval: plugin.settings.hover_intent_interval
});
};
plugin.isMobileOffCanvas=function(){
return plugin.settings.effect_mobile==='slide_left'||plugin.settings.effect_mobile==='slide_right';
};
plugin.shouldGoToNextTopLevelItem=function(key){
return(( key===right_arrow_key&&plugin.isDesktopView())||(key===down_arrow_key&&plugin.isMobileView()) )&&$menu.hasClass("mega-menu-horizontal");
};
plugin.shouldGoToPreviousTopLevelItem=function(key){
return(( key===left_arrow_key&&plugin.isDesktopView())||(key===up_arrow_key&&plugin.isMobileView()) )&&$menu.hasClass("mega-menu-horizontal");
};
plugin.bindKeyboardEvents=function(){
const $firstFocusable=$menu.find("a.mega-menu-link").first();
const $lastFocusable=$wrap.find("button.mega-close").first();
const isMobileOffCanvasHorizontal=function(){
return plugin.isHorizontalMobileSubmenuMode();
};
const getActiveHorizontalSubmenuBackLink=function(){
const $activeSubmenu=$("li.mega-toggle-on > ul.mega-sub-menu", $menu).last();
return $activeSubmenu.find("> li.mega-mobile-back:visible > a.mega-menu-link.mega-mobile-back-link").first();
};
const shouldTrapFocusInCurrentSubMenu=function(key){
return isMobileOffCanvasHorizontal()&&(key===up_arrow_key||key===down_arrow_key);
};
const togglePanelForAnchor=function(anchor){
if(!anchor||!anchor.length){
return;
}
if(anchor.parent().hasClass("mega-toggle-on")&&! anchor.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel(anchor);
}else{
plugin.showPanel(anchor);
}};
const closeNearestOpenPanelAndRefocus=function(){
const focused_menu_item=$menu[0].contains(document.activeElement) ? $(document.activeElement):$();
const nearest_parent_of_focused_item_li=focused_menu_item.closest(".mega-toggle-on");
const nearest_parent_of_focused_item_a=$("> a.mega-menu-link", nearest_parent_of_focused_item_li);
if(nearest_parent_of_focused_item_a.length){
plugin.hidePanel(nearest_parent_of_focused_item_a);
nearest_parent_of_focused_item_a.trigger("focus");
return true;
}
return false;
};
$lastFocusable.on('keydown.megamenu', function(e){
const key=e.key;
if(plugin.isMobileView()&&plugin.isMobileOffCanvas()&&key===tab_key&&! e.shiftKey){
e.preventDefault();
if(isMobileOffCanvasHorizontal()){
const $backLink=getActiveHorizontalSubmenuBackLink();
if($backLink.length){
$backLink.trigger('focus');
return;
}}
$firstFocusable.trigger('focus');
}
if(plugin.isMobileView()&&plugin.isMobileOffCanvas()&&key===tab_key&&e.shiftKey&&isMobileOffCanvasHorizontal()){
const $activeSubmenu=$("li.mega-toggle-on > ul.mega-sub-menu", $menu).last();
const $focusableWithoutBack=plugin.getFocusableItemsInSubmenu($activeSubmenu, false);
const $lastFocusableInSubmenu=$focusableWithoutBack.last();
if($lastFocusableInSubmenu.length){
e.preventDefault();
$lastFocusableInSubmenu.trigger('focus');
}}
});
$firstFocusable.on('keydown.megamenu', function(e){
const key=e.key;
if(plugin.isMobileView()&&plugin.isMobileOffCanvas()&&key===tab_key&&e.shiftKey){
e.preventDefault();
$lastFocusable.trigger('focus');
}});
$wrap.on("keyup.megamenu", ".max-mega-menu, .mega-menu-toggle", function(e){
const key=e.key;
const active_link=$(e.target);
if(key===tab_key){
$wrap.addClass("mega-keyboard-navigation");
plugin.bindClickEvents();
if(plugin.isDesktopView()&&active_link.is(".mega-menu-link")&&active_link.parent().parent().hasClass('max-mega-menu')){
plugin.hideAllPanels();
}}
});
$wrap.on("keydown.megamenu", "a.mega-menu-link, .mega-indicator, .mega-menu-toggle-block, .mega-menu-toggle-animated-block button, button.mega-close", function(e){
if(! $wrap.hasClass("mega-keyboard-navigation")){
return;
}
const key=e.key;
const active_link=$(e.target);
if(isMobileOffCanvasHorizontal()&&key===tab_key&&!e.shiftKey){
const $submenu=active_link.closest("ul.mega-sub-menu");
if($submenu.length!==0){
const $focusableWithoutBack=plugin.getFocusableItemsInSubmenu($submenu, false);
if($focusableWithoutBack.length!==0&&active_link.is($focusableWithoutBack.last())){
e.preventDefault();
$lastFocusable.trigger("focus");
return;
}}
}
if(isMobileOffCanvasHorizontal()&&key===tab_key&&e.shiftKey){
const $submenu=active_link.closest("ul.mega-sub-menu");
if($submenu.length!==0&&active_link.hasClass("mega-mobile-back-link")){
e.preventDefault();
$lastFocusable.trigger("focus");
return;
}
if($submenu.length!==0){
const $focusableWithoutBack=plugin.getFocusableItemsInSubmenu($submenu, false);
const $firstFocusableInSubmenu=$focusableWithoutBack.first();
const $backLink=$submenu.find("> li.mega-mobile-back:visible > a.mega-menu-link.mega-mobile-back-link").first();
if($firstFocusableInSubmenu.length!==0&&$backLink.length!==0&&active_link.is($firstFocusableInSubmenu)){
e.preventDefault();
$backLink.trigger("focus");
return;
}}
}
if(key===space_key&&active_link.is(".mega-menu-link")){
e.preventDefault();
if(active_link.parent().is(items_with_submenus)){
togglePanelForAnchor(active_link);
}}
if(key===space_key&&active_link.is(".mega-indicator")){
e.preventDefault();
togglePanelForAnchor(active_link.parent());
}
if(key===escape_key){
const submenu_open=$(".mega-toggle-on", $menu).length!==0;
if(submenu_open&&closeNearestOpenPanelAndRefocus()){
return;
}
if(plugin.isMobileView()&&! submenu_open){
plugin.hideMobileMenu();
}}
if(key===space_key||key===enter_key){
if(active_link.is(".mega-menu-toggle-block button, .mega-menu-toggle-animated-block button")){
e.preventDefault();
if($toggle_bar.hasClass("mega-menu-open")){
plugin.hideMobileMenu();
}else{
plugin.showMobileMenu();
html_body_class_timeout=setTimeout(function(){
$menu.find("a.mega-menu-link").first().trigger('focus');
}, plugin.settings.effect_speed_mobile);
}}
}
if(key===enter_key){
if(active_link.is(".mega-indicator")){
togglePanelForAnchor(active_link.parent());
return;
}
if(active_link.parent().is(items_with_submenus)){
if(plugin.isMobileView()&&active_link.parent().is(".mega-hide-sub-menu-on-mobile")){
return;
}
if(active_link.is("[href]")===false){
togglePanelForAnchor(active_link);
return;
}
if(active_link.parent().hasClass("mega-toggle-on")&&! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
return;
}else{
e.preventDefault();
plugin.showPanel(active_link);
}}
}
if(shouldTrapFocusInCurrentSubMenu(key)){
const focused_item=$menu[0].contains(document.activeElement) ? $(document.activeElement):$();
if(focused_item.length===0){
e.preventDefault();
$("> li.mega-menu-item:visible", $menu).find("> a.mega-menu-link, .mega-search span[role=button]").first().trigger('focus');
return;
}
let next_item_to_focus=focused_item.parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first();
if(next_item_to_focus.length===0&&focused_item.closest(".mega-menu-megamenu").length!==0){
const all_li_parents=focused_item.parentsUntil(".mega-menu-megamenu");
if(focused_item.is(all_li_parents.find("a.mega-menu-link").last())){
next_item_to_focus=all_li_parents.find(".mega-back-button:visible > a.mega-menu-link").first();
}}
if(next_item_to_focus.length===0){
next_item_to_focus=focused_item.parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first();
}
if(next_item_to_focus.length!==0){
e.preventDefault();
next_item_to_focus.trigger('focus');
}}
if(plugin.shouldGoToNextTopLevelItem(key)){
e.preventDefault();
const $focused_next=$(document.activeElement);
let next_top_level_item=$("> .mega-toggle-on", $menu).nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first();
if(next_top_level_item.length===0){
next_top_level_item=$focused_next.parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first();
}
if(next_top_level_item.length===0){
next_top_level_item=$focused_next.parent().parent().parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first();
}
plugin.hideAllPanels();
next_top_level_item.trigger('focus');
}
if(plugin.shouldGoToPreviousTopLevelItem(key)){
e.preventDefault();
const $focused_prev=$(document.activeElement);
let prev_top_level_item=$("> .mega-toggle-on", $menu).prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last();
if(prev_top_level_item.length===0){
prev_top_level_item=$focused_prev.parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last();
}
if(prev_top_level_item.length===0){
prev_top_level_item=$focused_prev.parent().parent().parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last();
}
plugin.hideAllPanels();
prev_top_level_item.trigger('focus');
}});
$wrap.on("focusout.megamenu", function(e){
if($wrap.hasClass("mega-keyboard-navigation")){
setTimeout(function(){
const menu_has_focus=$wrap[0].contains(document.activeElement);
if(! menu_has_focus){
$wrap.removeClass("mega-keyboard-navigation");
plugin.hideAllPanels();
plugin.hideMobileMenu();
}}, 10);
}});
};
plugin.unbindAllEvents=function(){
$(document).off(docEventNamespace);
$("ul.mega-sub-menu, li.mega-menu-item, li.mega-menu-row, li.mega-menu-column, a.mega-menu-link, .mega-indicator", $menu).off();
};
plugin.unbindClickEvents=function(){
if($wrap.hasClass('mega-keyboard-navigation')){
return;
}
$(document).off(docEventNamespace);
$("> a.mega-menu-link", items_with_submenus).not(collapse_children_parents).off("click.megamenu touchend.megamenu");
};
plugin.unbindHoverEvents=function(){
items_with_submenus.off("mouseenter.megamenu mouseleave.megamenu");
};
plugin.unbindHoverIntentEvents=function(){
items_with_submenus.off("mouseenter mouseleave").removeProp("hoverIntent_t").removeProp("hoverIntent_s");
};
plugin.unbindKeyboardEvents=function(){
$wrap.off("keyup.megamenu keydown.megamenu focusout.megamenu");
};
plugin.unbindMegaMenuEvents=function(){
if(plugin.settings.event==="hover_intent"){
plugin.unbindHoverIntentEvents();
}
if(plugin.settings.event==="hover"){
plugin.unbindHoverEvents();
}
plugin.unbindClickEvents();
plugin.unbindKeyboardEvents();
};
plugin.bindMegaMenuEvents=function(){
plugin.unbindMegaMenuEvents();
const isDesktop=plugin.isDesktopView();
if(isDesktop&&plugin.settings.event==="hover_intent"){
plugin.bindHoverIntentEvents();
}
if(isDesktop&&plugin.settings.event==="hover"){
plugin.bindHoverEvents();
}
plugin.bindClickEvents();
plugin.bindKeyboardEvents();
};
plugin.checkWidth=function(){
if(plugin.isMobileView()&&$menu.data("view")==="desktop"){
plugin.switchToMobile();
}
if(plugin.isDesktopView()&&$menu.data("view")==="mobile"){
plugin.switchToDesktop();
}
plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu));
};
plugin.reverseRightAlignedItems=function(){
if(! $("body").hasClass("rtl")&&$menu.hasClass("mega-menu-horizontal")&&$menu.css("display")!=='flex'){
$menu.append($menu.children("li.mega-item-align-right").get().reverse());
}};
plugin.addClearClassesToMobileItems=function(){
$(".mega-menu-row", $menu).each(function(){
$("> .mega-sub-menu > .mega-menu-column:not(.mega-hide-on-mobile)", $(this)).filter(":even").addClass("mega-menu-clear");
});
};
plugin.initDesktop=function(){
$menu.data("view", "desktop");
plugin.bindMegaMenuEvents();
plugin.initIndicators();
};
plugin.initMobile=function(){
plugin.switchToMobile();
};
plugin.switchToDesktop=function(){
$menu.data("view", "desktop");
plugin.bindMegaMenuEvents();
plugin.reverseRightAlignedItems();
plugin.hideAllPanels();
plugin.hideMobileMenu(true);
$menu.removeAttr('role');
$menu.removeAttr('aria-modal');
$menu.removeAttr('aria-hidden');
};
plugin.switchToMobile=function(){
$menu.data("view", "mobile");
if(plugin.isMobileOffCanvas()&&$toggle_bar.is(":visible")){
$menu.attr('role', 'dialog');
$menu.attr('aria-modal', 'true');
$menu.attr('aria-hidden', 'true');
}
plugin.bindMegaMenuEvents();
plugin.initIndicators();
plugin.reverseRightAlignedItems();
plugin.addClearClassesToMobileItems();
plugin.hideAllPanels();
plugin.expandMobileSubMenus();
};
plugin.initToggleBar=function(){
$toggle_bar.on("click", function(e){
if($(e.target).is(".mega-menu-toggle, .mega-menu-toggle-custom-block *, .mega-menu-toggle-block, .mega-menu-toggle-animated-block, .mega-menu-toggle-animated-block *, .mega-toggle-blocks-left, .mega-toggle-blocks-center, .mega-toggle-blocks-right, .mega-toggle-label, .mega-toggle-label span")){
e.preventDefault();
if($(this).hasClass("mega-menu-open")){
plugin.hideMobileMenu();
}else{
plugin.showMobileMenu();
}}
});
};
plugin.initIndicators=function(){
$menu.off('click.megamenu', '.mega-indicator');
$menu.on('click.megamenu', '.mega-indicator', function(e){
e.preventDefault();
e.stopPropagation();
if($(this).closest(".mega-menu-item").hasClass("mega-toggle-on")){
if(! $(this).closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")||plugin.isMobileView()){
plugin.hidePanel($(this).parent(), false);
}}else{
plugin.showPanel($(this).parent(), false);
}});
};
plugin.hideMobileMenu=function(force=false){
if(! $toggle_bar.is(":visible")&&! force){
return;
}
$menu.attr("aria-hidden", "true");
clearTimeout(html_body_class_timeout);
html_body_class_timeout=setTimeout(function(){
$("body").removeClass(menuId + "-mobile-open");
$("html").removeClass(menuId + "-off-canvas-open");
}, plugin.settings.effect_speed_mobile);
if($wrap.hasClass("mega-keyboard-navigation")){
$(".mega-menu-toggle-block button, button.mega-toggle-animated", $toggle_bar).first().trigger('focus');
}
$(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "false");
if(plugin.settings.effect_mobile==="slide"&&! force){
$menu.animate({"height":"hide"}, plugin.settings.effect_speed_mobile, function(){
$menu.css({
width: "",
left: "",
display: ""
});
$toggle_bar.removeClass("mega-menu-open");
});
}else{
$menu.css({
width: "",
left: "",
display: ""
});
$toggle_bar.removeClass("mega-menu-open");
}
$menu.triggerHandler("mmm:hideMobileMenu");
};
plugin.showMobileMenu=function(){
if(! $toggle_bar.is(":visible")){
return;
}
clearTimeout(html_body_class_timeout);
$("body").addClass(menuId + "-mobile-open");
plugin.expandMobileSubMenus();
if(plugin.isMobileOffCanvas()){
$("html").addClass(menuId + "-off-canvas-open");
}
if(plugin.settings.effect_mobile==="slide"){
$menu.animate({"height":"show"}, plugin.settings.effect_speed_mobile, function(){
$(this).css("display", "");
});
}
$(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "true");
$toggle_bar.addClass("mega-menu-open");
plugin.toggleBarForceWidth();
$menu.attr("aria-hidden", "false");
$menu.triggerHandler("mmm:showMobileMenu");
};
plugin.toggleBarForceWidth=function(){
const $force_width_el=$(plugin.settings.mobile_force_width);
if($force_width_el.length&&(plugin.settings.effect_mobile==="slide"||plugin.settings.effect_mobile==="disabled") ){
const submenu_offset=$toggle_bar.offset();
const target_offset=$force_width_el.offset();
$menu.css({
width: $force_width_el.outerWidth(),
left: (target_offset.left - submenu_offset.left) + "px"
});
}};
plugin.doConsoleChecks=function(){
if(plugin.settings.mobile_force_width!=="false"&&! $(plugin.settings.mobile_force_width).length&&(plugin.settings.effect_mobile==="slide"||plugin.settings.effect_mobile==="disabled") ){
console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Mobile Force Width element (' + plugin.settings.mobile_force_width + ') not found');
}
const cssWidthRegex=/^((\d+(\.\d+)?(px|%|em|rem|vw|vh|ch|ex|cm|mm|in|pt|pc))|auto)$/i;
if(plugin.settings.panel_width!==undefined&&! cssWidthRegex.test(plugin.settings.panel_width)&&! $(plugin.settings.panel_width).length){
console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Panel Width (Outer) element (' + plugin.settings.panel_width + ') not found');
}
if(plugin.settings.panel_inner_width!==undefined&&! cssWidthRegex.test(plugin.settings.panel_inner_width)&&! $(plugin.settings.panel_inner_width).length){
console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Panel Width (Inner) element (' + plugin.settings.panel_inner_width + ') not found');
}};
plugin.init=function(){
$menu.triggerHandler("before_mega_menu_init");
plugin.settings=$.extend({}, defaults, options);
if(window.console){
plugin.doConsoleChecks();
}
$menu.removeClass("mega-no-js");
plugin.initToggleBar();
if(plugin.settings.unbind_events==="true"){
plugin.unbindAllEvents();
}
if(document.readyState==='complete'){
plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu));
}else{
$(window).on("load", function(){
plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu));
});
}
if(plugin.isDesktopView()){
plugin.initDesktop();
}else{
plugin.initMobile();
}
$(window).on("resize", function(){
plugin.checkWidth();
});
$menu.triggerHandler("after_mega_menu_init");
};
plugin.init();
};
$.fn.maxmegamenu=function(options){
return this.each(function(){
if(undefined===$(this).data("maxmegamenu")){
const plugin=new $.maxmegamenu(this, options);
$(this).data("maxmegamenu", plugin);
}});
};
$(function(){
$(".max-mega-menu").maxmegamenu();
});
}(jQuery));
(function($){
"use strict";
$(function(){
$('body').on('edd_cart_item_added', function(event, data){
$('.mega-menu-edd-cart-total').html(data.total);
$('.mega-menu-edd-cart-count').html(data.cart_quantity);
});
});
$(".max-mega-menu").on("after_mega_menu_init", function(){
$('li.mega-menu-megamenu').on('open_panel', function(){
var placeholder=$(this).closest(".mega-menu-megamenu").find(".widget_maxmegamenu_image_swap img.mega-placeholder");
var default_src=placeholder.attr('data-default-src');
var default_alt=placeholder.attr('data-default-alt');
placeholder.attr('src', default_src);
placeholder.attr('alt', default_alt);
$('.mega-sub-menu [data-image-swap-url]', $(this)).not(['data-preloaded']).each(function(){
$('<img/>')[0].src=$(this).attr('data-image-swap-url');
$(this).attr('data-preloaded', 'true');
});
});
if(typeof $.fn.hoverIntent!=="function"){
return;
}
$('.mega-sub-menu [data-image-swap-url]').hoverIntent({
over: function (){
var placeholder=$(this).closest(".mega-menu-megamenu").find(".widget_maxmegamenu_image_swap img.mega-placeholder");
var new_src=$(this).attr('data-image-swap-url');
var new_alt=$(this).is("[data-image-swap-alt]") ? $(this).attr('data-image-swap-alt'):"";
placeholder.attr('src', new_src);
placeholder.attr('alt', new_alt);
},
out: function(){}});
});
})(jQuery);
(function($){
"use strict";
var menuSupportsSideToSide=function($menu){
return $menu.attr("data-mobile-direction")==="horizontal" &&
$menu.attr("data-effect-mobile").indexOf("slide_")===0;
};
var getMenuItemTitle=function($item){
var $link=$item.children("a.mega-menu-link").first();
var clone=$link.clone();
clone.find(".mega-indicator").remove();
return $.trim(clone.text());
};
var getBackLabel=function($menu, parentTitle){
var template=$menu.attr("data-mobile-back-text")||"Back to {parent_title}";
var safeParentTitle=parentTitle||"";
if(template.indexOf("{parent_title}")!==-1){
return template.split("{parent_title}").join(safeParentTitle);
}
return template;
};
var addBackLinks=function($menu){
$("li.mega-menu-item-has-children > ul.mega-sub-menu", $menu).each(function(){
if($("> li.mega-mobile-back", this).length){
return;
}
var $submenu=$(this);
var $item=$submenu.parent("li.mega-menu-item-has-children");
var title=getMenuItemTitle($item);
var backLabel=getBackLabel($menu, title);
var backHtml="<li class='mega-menu-item mega-mobile-back'><a href='#' class='mega-menu-link mega-mobile-back-link'>" + backLabel + "</a></li>";
$submenu.prepend(backHtml);
});
};
$(".max-mega-menu").on("after_mega_menu_init", function(){
var $menu=$(this);
if(!menuSupportsSideToSide($menu)){
return;
}
addBackLinks($menu);
$menu.on("click.megamenu", ".mega-mobile-back-link", function(e){
var menuPlugin;
var $submenu;
var $parentItem;
var $parentLink;
e.preventDefault();
e.stopPropagation();
$submenu=$(this).closest("ul.mega-sub-menu");
$parentItem=$submenu.parent("li.mega-menu-item-has-children");
$parentLink=$parentItem.children("a.mega-menu-link").first();
menuPlugin=$menu.data("maxmegamenu");
if(menuPlugin&&typeof menuPlugin.hidePanel==="function"){
menuPlugin.hidePanel($parentLink, false);
}else{
$parentItem.removeClass("mega-toggle-on");
}
$parentLink.trigger("focus");
});
});
})(jQuery);
(function($){
"use strict";
$.maxmegamenu_searchbox=function(form, options){
var plugin=this;
var form=$(form);
var $menu=form.parents('.max-mega-menu');
var $wrap=$menu.parent();
var breakpoint=$menu.attr('data-breakpoint');
var input=$('input[type=text]', form);
var icon=$('.search-icon', form);
plugin.isDesktopView=function(){
return Math.max(window.outerWidth, $(window).width()) >=breakpoint;
};
plugin.monitorView=function(){
if(typeof $menu.data("view")==='undefined'){
if(plugin.isDesktopView()){
$menu.data("view", "desktop");
}else{
$menu.data("view", "mobile");
}}
plugin.checkWidth();
$(window).on('resize', function(){
plugin.checkWidth();
});
};
plugin.checkWidth=function(){
var expanding_search=$("li.mega-menu-item .mega-search.expand-to-left input[type=text], li.mega-menu-item .mega-search.expand-to-right input[type=text]", $menu);
if($menu.data("view")==="mobile"){
var placeholder=expanding_search.attr('data-placeholder');
expanding_search.attr('placeholder', placeholder);
expanding_search.attr('aria-hidden', 'false');
}
if($menu.data("view")==="desktop"){
expanding_search.attr('placeholder', '');
expanding_search.attr('aria-hidden', 'true');
}};
plugin.close_search=function(moveFocus=true){
$menu.triggerHandler("mmm:closeSearch");
input.val("");
input.attr('placeholder', '');
input.attr('tabindex', '-1');
input.attr('aria-hidden', 'true');
form.removeClass('mega-search-open');
form.addClass('mega-search-closed');
icon.attr('aria-expanded', 'false');
if(moveFocus){
icon.trigger("focus");
}}
plugin.open_search=function(){
$menu.triggerHandler("mmm:openSearch");
input.attr('placeholder', input.attr('data-placeholder'));
input.attr('tabindex', '0');
input.attr('aria-hidden', 'false');
form.removeClass('mega-search-closed');
form.addClass('mega-search-open');
icon.attr('aria-expanded', 'true');
input.trigger("focus");
}
plugin.detect_background_click=function(){
var dragging=false;
$(document).on({
"touchmove": function(e){ dragging=true; },
"touchstart": function(e){ dragging=false; }});
$(document).on("click touchend", function(e){
if(form.parent().hasClass('mega-static')){
return;
}
if(! dragging&&! $(e.target).closest(".max-mega-menu li").length&&! $(e.target).closest(".mega-menu-toggle").length){
plugin.close_search(false);
}
dragging=false;
});
}
plugin.init_replacements_search=function(){
if($menu.data("view")==="mobile"){
input.attr('tabindex', '0');
$(".search-icon", $menu).on('click', function(e){
$(this).parents(".mega-search").submit();
});
}
if($menu.data("view")==="desktop"){
input.on('blur', function(e){
if($menu.parent().hasClass("mega-keyboard-navigation")&&input.val()==''&&! form.parent().hasClass('mega-static')&&form.hasClass('mega-search-open')){
plugin.close_search();
}});
icon.on('keypress click', function(e){
var enter_key=13;
var space_key=32;
if(e.which===enter_key||e.which===space_key||e.type==='click'){
e.preventDefault();
if(form.parent().hasClass('mega-static')){
form.submit();
return;
}
if(input.val()!=''){
form.submit();
return;
}
if(form.hasClass('mega-search-open')){
plugin.close_search();
return;
}
if(form.hasClass('mega-search-closed')){
plugin.open_search();
return;
}};});
icon.on('blur', function(){
if(! form.parent().hasClass('mega-static')&&form.hasClass('mega-search-open')&&$wrap.hasClass('mega-keyboard-navigation')){
setTimeout(function(){
if(form.find(":focus").length==0){
plugin.close_search(false);
}}, 100);
}});
$menu.on('keydown', function(e){
var escape_key=27;
if(e.which===escape_key){
if(! form.parent().hasClass('mega-static')&&form.hasClass('mega-search-open')){
plugin.close_search();
return;
}}
});
}};
plugin.monitorView();
plugin.init_replacements_search();
plugin.detect_background_click();
};
$.fn.maxmegamenu_searchbox=function(options){
return this.each(function(){
if(undefined===$(this).data('maxmegamenu_searchbox')){
var plugin=new $.maxmegamenu_searchbox(this, options);
$(this).data('maxmegamenu_searchbox', plugin);
}});
};
$(".max-mega-menu").on("after_mega_menu_init", function(){
$(".mega-search", this).maxmegamenu_searchbox();
});
})(jQuery);
(function($){
"use strict";
$.maxmegamenu_toggle_searchbox=function(form, options){
var plugin=this;
var form=$(form);
var $wrap=form.parents('.mega-menu-wrap');
var input=$("input[type=text]", form);
var icon=$(".search-icon", form);
plugin.open_search=function(){
input.attr('placeholder', input.attr('data-placeholder'));
form.removeClass('mega-search-closed');
form.addClass('mega-search-open');
}
plugin.close_search=function(){
input.attr('placeholder', '');
form.removeClass('mega-search-open');
form.addClass('mega-search-closed');
}
plugin.init_toggle_search=function(){
input.val("");
input.on('focus', function(e){
if(! form.parent().hasClass('mega-static')&&form.hasClass('mega-search-closed')&&$wrap.hasClass('mega-keyboard-navigation')){
plugin.open_search();
}});
input.on('blur', function(e){
if(! form.parent().hasClass('mega-static')&&form.hasClass('mega-search-open')&&$wrap.hasClass('mega-keyboard-navigation')){
plugin.close_search();
}});
icon.on('click', function(e){
if(form.hasClass('static')){
if(input.attr('required')=='required'&&input.val()==""){
return;
}else{
form.submit();
}}else if(form.hasClass('mega-search-closed')){
input.focus();
plugin.open_search();
}else if(input.val()==''){
plugin.close_search();
}else{
form.submit();
}});
};
plugin.init_toggle_search();
};
$.fn.maxmegamenu_toggle_searchbox=function(options){
return this.each(function(){
if(undefined===$(this).data('maxmegamenu_toggle_searchbox')){
var plugin=new $.maxmegamenu_toggle_searchbox(this, options);
$(this).data('maxmegamenu_toggle_searchbox', plugin);
}});
};
$(function(){
$(".mega-menu-toggle .mega-search").maxmegamenu_toggle_searchbox();
});
})(jQuery);
(function($){
"use strict";
$.maxmegamenu_sticky=function(menu, options){
var plugin=this;
var $menu=$(menu);
var $wrap=$menu.parent();
var breakpoint=$menu.attr('data-breakpoint');
var sticky_on_mobile=$menu.attr('data-sticky-mobile');
var sticky_on_desktop=$menu.attr('data-sticky-desktop');
var sticky_expand=$menu.attr('data-sticky-expand');
var sticky_expand_mobile=$menu.attr('data-sticky-expand-mobile');
var sticky_offset=isNaN(parseInt($menu.attr('data-sticky-offset'))) ? 0:parseInt($menu.attr('data-sticky-offset'));
var sticky_hide_until_scroll_up=$menu.attr('data-sticky-hide');
var sticky_hide_until_scroll_up_tolerance=isNaN(parseInt($menu.attr('data-sticky-hide-tolerance'))) ? 0:parseInt($menu.attr('data-sticky-hide-tolerance'));
var sticky_hide_until_scroll_up_offset=isNaN(parseInt($menu.attr('data-sticky-hide-offset'))) ? 0:parseInt($menu.attr('data-sticky-hide-offset'));
var sticky_transition=$menu.attr('data-sticky-transition');
var sticky_menu_offset_top;
var sticky_menu_offset_left;
var sticky_menu_width;
var sticky_menu_width_round_up;
var sticky_menu_height;
var is_stuck=false;
var admin_bar_height=0;
var last_scroll_top=0;
var saved_scroll_top=0;
var is_vertical=$menu.hasClass('mega-menu-vertical')||$menu.hasClass('mega-menu-accordion');
plugin.isDesktopView=function(){
var width=Math.max(document.documentElement.clientWidth||0, window.innerWidth||0);
return width > breakpoint;
};
var sticky_hide_until_scroll_up_enabled=function(){
return $menu.hasClass('mega-menu-horizontal')&&sticky_hide_until_scroll_up=="true";
}
var sticky_enabled=function(){
if(plugin.isDesktopView()){
return sticky_on_desktop==='true';
}else{
return sticky_on_mobile==='true';
}
return false;
};
plugin.calculate_menu_position=function(){
sticky_menu_offset_top=$wrap.offset().top;
if($('body').hasClass('admin-bar')&&$("#wpadminbar").is(":visible")&&$("#wpadminbar").css('top')=='0px'&&$("#wpadminbar").css('position')=='fixed'){
admin_bar_height=$('#wpadminbar').height();
sticky_menu_offset_top=sticky_menu_offset_top - admin_bar_height;
}
if(sticky_offset < 0){
sticky_menu_offset_top=sticky_menu_offset_top + sticky_offset;
}else{
sticky_menu_offset_top=sticky_menu_offset_top - sticky_offset;
}
sticky_menu_offset_left=$menu.parent().offset().left;
sticky_menu_width=window.getComputedStyle($wrap[0]).width;
sticky_menu_width_round_up=Math.ceil(parseFloat(sticky_menu_width));
sticky_menu_height=$wrap.height();
};
plugin.stick_menu=function(){
is_stuck=true;
var total_offset=parseInt(admin_bar_height, 10) + parseInt(sticky_offset, 10);
if(sticky_offset < 0){
total_offset=parseInt(admin_bar_height, 10);
}
var placeholder=$("<div />").addClass("mega-sticky-wrapper").css({
'height':sticky_menu_height + 'px',
'position' :'static'
});
$wrap.addClass('mega-sticky').wrap(placeholder).css({
'margin-top':total_offset + 'px'
});
$("body").addClass($menu.attr("id") + "-mega-sticky");
$menu.css({
'max-width':sticky_menu_width_round_up + 'px'
});
if(sticky_menu_offset_left > 0){
$menu.css({
'margin-left':sticky_menu_offset_left + 'px'
});
}
if(is_vertical||sticky_expand==='false'){
$wrap.css({
'margin-left':'0',
'margin-right':'0',
'width':sticky_menu_width_round_up + 'px',
'left':sticky_menu_offset_left + 'px'
});
$menu.css({
'margin-left':'0'
});
}
if($(window).width() <=breakpoint){
$wrap.css({
'width':sticky_menu_width_round_up + 'px'
});
if(sticky_expand_mobile==='true'){
$wrap.css({
'margin-left':'',
'margin-right':'',
'width':'',
'left':''
});
$menu.css({
'max-width':'',
'margin-left':'',
'width':'',
'left':''
});
}}
$wrap.delay(0).queue(function(next){
$(this).addClass('mega-stuck');
next();
});
};
plugin.unstick_menu=function(doing_resize){
doing_resize=doing_resize||false;
is_stuck=false;
$wrap.removeClass('mega-sticky').removeClass('mega-hide').css({
'margin':'',
'width':'',
'left': ''
});
$("body").removeClass($menu.attr("id") + "-mega-sticky");
if(! doing_resize){
$wrap.delay(0).queue(function(next){
$(this).removeClass('mega-stuck');
next();
});
}
$menu.css({
'margin-left':'',
'max-width':'',
'left':'',
'width':''
});
if($(window).width() <=breakpoint){
$menu.data('maxmegamenu').toggleBarForceWidth();
}
if(sticky_transition=='true'&&! doing_resize){
var delay=250;
}else{
var delay=0;
}
$wrap.delay(delay).queue(function(next){
$(this).unwrap();
next();
});
};
plugin.mega_sticky_on_scroll=function(){
if(! sticky_enabled()){
return;
}
var scroll_top=$(window).scrollTop();
if(scroll_top > sticky_menu_offset_top){
if(!is_stuck){
plugin.stick_menu();
}}else{
if(is_stuck){
plugin.unstick_menu();
}}
};
var mega_hide_on_scroll_up=function(){
if(sticky_hide_until_scroll_up_enabled()){
if($menu.data("view")==="mobile"&&$('.mega-menu-toggle', $wrap).hasClass('mega-menu-open')){
return;
}
var scroll_top=$(window).scrollTop();
if(scroll_top < sticky_hide_until_scroll_up_offset){
$wrap.removeClass('mega-hide');
$("body").removeClass($menu.attr("id") + "-mega-hide");
}
saved_scroll_top=last_scroll_top;
if(scroll_top < last_scroll_top){
if(saved_scroll_top - scroll_top > sticky_hide_until_scroll_up_tolerance){
$wrap.removeClass('mega-hide');
$("body").removeClass($menu.attr("id") + "-mega-hide");
}}else{
if(is_stuck&&scroll_top - saved_scroll_top > sticky_hide_until_scroll_up_tolerance){
$wrap.addClass('mega-hide');
$("body").addClass($menu.attr("id") + "-mega-hide");
}}
last_scroll_top=scroll_top;
}}
plugin.mega_sticky_on_resize=function(){
if($('input', $wrap).is(':focus')){
return;
}
if(sticky_enabled()){
if(is_stuck){
plugin.unstick_menu(true);
plugin.calculate_menu_position();
plugin.stick_menu();
}else{
plugin.calculate_menu_position();
plugin.mega_sticky_on_scroll();
}}else{
if(is_stuck){
plugin.unstick_menu();
}}
};
plugin.init=function(){
plugin.calculate_menu_position();
plugin.mega_sticky_on_scroll();
$('.mega-menu-accordion li.mega-menu-item').on('open_panel', function(){
plugin.calculate_menu_position();
});
var $window=$(window);
$window.scroll(function(){
plugin.mega_sticky_on_scroll();
mega_hide_on_scroll_up();
});
var windowWidth=$window.width();
var resizeTimer;
$window.on('resize', function(){
clearTimeout(resizeTimer);
resizeTimer=setTimeout(function(){
windowWidth=$window.width();
plugin.mega_sticky_on_resize();
}, 100);
});
};
plugin.init();
};
$.fn.maxmegamenu_sticky=function(options){
return this.each(function(){
if(undefined===$(this).data('maxmegamenu_sticky')){
var plugin=new $.maxmegamenu_sticky(this, options);
$(this).data('maxmegamenu_sticky', plugin);
}});
};
$(window).on('load', function (e){
$(".max-mega-menu[data-sticky-enabled]").maxmegamenu_sticky();
});
})(jQuery);
(function($){
$(function(){
var calculate_tabbed_sub_menu_widths=function(menu_item){
var menu=menu_item.parents('.max-mega-menu');
if($(menu.attr('data-panel-inner-width')).length > 0){
if(menu.data("view")==="desktop"){
$('> ul.mega-sub-menu', menu_item).each(function(){
var tab_content=$(this);
var parent_submenu_content_width=parseInt(tab_content.width());
var parent_submenu_left_padding=parseInt(tab_content.css('paddingLeft'));
var tabs_width=$(this).find('a.mega-menu-link').first().outerWidth();
$('> li.mega-menu-item > ul.mega-sub-menu', $(this)).each(function(){
$(this).css('width', parent_submenu_content_width - tabs_width + 'px');
$(this).css('left', parent_submenu_left_padding + tabs_width + 'px');
});
});
}else{
$('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function(){
$(this).css('width', '');
$(this).css('left', '');
});
}}
}
var calculate_tabbed_sub_menu_heights=function(menu_item){
var menu=menu_item.parents('.max-mega-menu');
var max_height=0;
if(menu.data("view")==="desktop"){
$('> ul.mega-sub-menu', menu_item).css('minHeight', '');
$('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function(){
var tab_content=$(this);
var this_height=parseInt(tab_content.css('height'));
if(this_height > max_height){
max_height=this_height;
}});
var border_top_width=parseInt($('> ul.mega-sub-menu', menu_item).css('borderTopWidth'),10);
var border_bottom_width=parseInt($('> ul.mega-sub-menu', menu_item).css('borderBottomWidth'),10);
$('> ul.mega-sub-menu', menu_item).css('minHeight', max_height + border_bottom_width + border_top_width);
}else{
$('> ul.mega-sub-menu', menu_item).css('minHeight', '');
}}
var $window=$(window);
var windowWidth=$window.width();
$window.on('resize', function(){
if($window.width()!=windowWidth){
calculate_tabbed_sub_menu_widths($('li.mega-menu-tabbed'));
calculate_tabbed_sub_menu_heights($('li.mega-menu-tabbed'));
}});
$('li.mega-menu-tabbed, li.mega-menu-tabbed li.mega-collapse-children').on('open_panel', function(){
var menu=$(this).parents('.max-mega-menu');
var menu_item=$(this).closest(".mega-menu-tabbed");
calculate_tabbed_sub_menu_widths(menu_item);
$("> ul.mega-sub-menu", $(this)).promise().done(function(){
calculate_tabbed_sub_menu_heights(menu_item);
});
if(menu.data('view')=='desktop'){
if($('> ul.mega-sub-menu > li.mega-menu-item-has-children.mega-toggle-on', menu_item).length==0){
if($('> ul.mega-sub-menu > li.mega-current-menu-item:visible', menu_item).length){
$('> ul.mega-sub-menu > li.mega-current-menu-item:visible', menu_item).first().addClass('mega-toggle-on');
}else if($('> ul.mega-sub-menu > li.mega-current-menu-ancestor:visible', menu_item).length){
$('> ul.mega-sub-menu > li.mega-current-menu-ancestor:visible', menu_item).first().addClass('mega-toggle-on');
}
if($('> ul.mega-sub-menu > li.mega-toggle-on', menu_item).length==0){
$('> ul.mega-sub-menu > li.mega-menu-item-has-children:visible', menu_item).first().addClass('mega-toggle-on');
}}
$('li.mega-menu-tabbed', menu).on('close_panel', function(){
$('li.mega-menu-tabbed .mega-toggle-on', menu).removeClass('mega-toggle-on');
});
}
$('li.mega-menu-tabbed li.mega-collapse-children').on('close_panel', function(){
var menu_item=$(this).closest('.mega-menu-tabbed');
$("> ul.mega-sub-menu", $(this)).promise().done(function(){
calculate_tabbed_sub_menu_heights(menu_item);
});
});
});
});
})(jQuery);