/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",(function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}),!1);
function colormagInit(){var e=function(){jQuery("#cm-masthead .search-form-top").removeClass("show"),jQuery("#cm-content").removeClass("backdrop")};jQuery(document).off("click.colormag",".search-top").on("click.colormag",".search-top",(function(){jQuery(this).next("#cm-masthead .search-form-top").toggleClass("show"),jQuery("#cm-content").toggleClass("backdrop"),setTimeout((function(){jQuery("#cm-masthead .search-form-top input").focus()}),200),function(){var e=jQuery(".cm-desktop-row .search-form-top.show, .cm-mobile-row .search-form-top.show");if(e.length){e.css({right:"",left:""});var t=e[0].getBoundingClientRect(),i=window.innerWidth;t.right>i?(e.css({right:0,left:"auto"}),e.css({"--arrow-right":"10px"})):t.left<0&&(e.css({left:0,right:"auto"}),e.css({"--arrow-left":"10px"}))}}(),jQuery(document).off("keyup.colormag").on("keyup.colormag",(function(t){27===t.keyCode&&jQuery("#cm-masthead .search-form-top").hasClass("show")&&e()})),jQuery(document).off("click.outEvent.colormag").on("click.outEvent.colormag",(function(t){t.target.closest(".cm-top-search")||(e(),jQuery(document).off("click.outEvent.colormag"))}))})),jQuery("#scroll-up").hide(),jQuery(window).off("scroll.colormag").on("scroll.colormag",(function(){jQuery(this).scrollTop()>1e3?jQuery("#scroll-up").fadeIn():jQuery("#scroll-up").fadeOut()})),jQuery("a#scroll-up").off("click.colormag").on("click.colormag",(function(){return jQuery("body,html").animate({scrollTop:0},800),!1})),jQuery(".cm-menu-primary-container .menu-item-has-children"),jQuery(".cm-submenu-toggle").off("click.colormag").on("click.colormag",(function(){jQuery(this).parent(".menu-item-has-children").children("ul.sub-menu").first().slideToggle("1000")})),jQuery(document).off("click.colormag","#cm-primary-nav ul li.menu-item-has-children > a").on("click.colormag","#cm-primary-nav ul li.menu-item-has-children > a",(function(e){var t=jQuery(this).parent(".menu-item-has-children");!t.hasClass("focus")&&jQuery(window).width()<=768&&(t.addClass("focus"),e.preventDefault(),t.children(".sub-menu").css({display:"block"}))}));let t,i=document.getElementsByClassName("cm-header-builder");function o(){if(window.matchMedia("(max-width: 768px)").matches&&jQuery("#cm-masthead .sticky-wrapper, .cm-header-bottom-row .sticky-wrapper, #cm-masthead .headroom").length>=1){var e=jQuery(window).height()-88,t=jQuery("#cm-primary-nav").find("ul").first();t.css("max-height",e),t.addClass("menu-scrollbar")}}if(t=i.length>0?".cm-header-bottom-row":".cm-primary-nav","complete"===document.readyState?o():jQuery(window).off("load.colormag").on("load.colormag",o),jQuery(document).ready((function(){const e=jQuery(".cm-footer-builder.cm-sticky-footer");if(e.length){const t=e.outerHeight();e.css({position:"sticky",bottom:"0",width:"100%","z-index":"99"}),jQuery("body").css("padding-bottom",t+"px"),e.css("transition","transform 0.3s ease-in-out");let i=0;jQuery(window).off("scroll.colormag").on("scroll.colormag",(function(){const t=jQuery(this).scrollTop();t>i?e.css("transform","translateY(0)"):e.css("transform","translateY(100%)"),i=t}))}})),void 0!==jQuery.fn.magnificPopup&&(jQuery(".image-popup").magnificPopup({type:"image"}),jQuery(".image-popup-blog").magnificPopup({type:"image"}),jQuery(".gallery").find('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"], a[href*=".ico"]').magnificPopup({type:"image",gallery:{enabled:!0}}),jQuery(".colormag-ticker-news-popup-link").magnificPopup({type:"ajax",callbacks:{parseAjax:function(e){var t=jQuery.magnificPopup.instance,i=jQuery(t.currItem.el[0]).data("fragment");e.data=jQuery(e.data).find(i)}}})),void 0!==jQuery.fn.fitVids&&jQuery(".fitvids-video").fitVids(),"undefined"!=typeof colormag_new_news_ticker_settings){let e=colormag_new_news_ticker_settings.ticker_slide_effect,t=colormag_new_news_ticker_settings.ticker_news_duration,i=colormag_new_news_ticker_settings.ticker_news_speed;jQuery("#cm-breaking-news-ticker").breakingNews({effect:e,scrollSpeed:i,delayTimer:t})}if(void 0!==jQuery.fn.newsTicker){if("undefined"!=typeof colormag_ticker_settings){var r=colormag_ticker_settings.breaking_news_slide_effect,a=parseInt(colormag_ticker_settings.breaking_news_duration,10),s=parseInt(colormag_ticker_settings.breaking_news_speed,10);jQuery(".newsticker").newsTicker({row_height:20,max_rows:1,direction:r,speed:s,duration:a,autostart:1,pauseOnHover:1,start:function(){jQuery(".newsticker").css("visibility","visible")}})}var c=jQuery(".cm-breaking-news");jQuery(c).each((function(){!function(e,t,i,o,r,a,s){jQuery(e).newsTicker({row_height:a,max_rows:s,duration:r,direction:o,prevButton:jQuery(t),nextButton:jQuery(i),start:function(){jQuery(".cm-breaking-news-slider-widget").css({visibility:"visible"})}})}(jQuery(this).children(".cm-breaking-news-slider-widget"),jQuery(this).children(".cm-slide-up"),jQuery(this).children(".cm-slide-down"),jQuery(this).children(".cm-breaking-news-slider-widget").data("direction"),jQuery(this).children(".cm-breaking-news-slider-widget").data("duration"),jQuery(this).children(".cm-breaking-news-slider-widget").data("rowheight"),jQuery(this).children(".cm-breaking-news-slider-widget").data("maxrows"))}))}var n,l,d,u,m,h,g,y,p,f,v,w,j;void 0!==jQuery.fn.sticky&&((b=jQuery("#wpadminbar")).length?jQuery(t).sticky({topSpacing:b.height(),zIndex:999}):jQuery(t).sticky({topSpacing:0,zIndex:999}));if(jQuery(".wp-block-search__input").attr("placeholder","Search posts"),void 0!==jQuery.fn.headroom){var Q=jQuery(t).offset().top,b=jQuery("#wpadminbar"),k=jQuery(t).width();b.length&&(Q=b.height()+jQuery(t).offset().top),jQuery(t).headroom({offset:Q,tolerance:0,onPin:function(){b.length?jQuery(t).css({top:b.height(),position:"fixed",width:k,"z-index":999}):jQuery(t).css({top:0,position:"fixed","z-index":999,width:k})},onTop:function(){jQuery(t).css({top:0,position:"relative"})}})}if(void 0!==jQuery.fn.bxSlider){var x=jQuery(".cm-featured-category-slider ");jQuery(x).each((function(){!function(e,t,i,o,r,a){jQuery(e).bxSlider({mode:t,speed:i,auto:r,pause:o,autoHover:a,adaptiveHeight:!0,nextText:'<div class="cm-category-slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1 1 0 0 1-.08.39 1 1 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></div>',prevText:'<div class="cm-category-slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1 1 0 0 0 .08.39 1 1 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>',pager:!1,tickerHover:!0,onSliderLoad:function(){jQuery(".cm-slider-area-rotate").css("visibility","visible"),jQuery(".cm-slider-area-rotate").css("height","auto")}})}(jQuery(this).children(".cm-slider-area-rotate"),jQuery(this).children(".cm-slider-area-rotate").data("mode"),jQuery(this).children(".cm-slider-area-rotate").data("speed"),jQuery(this).children(".cm-slider-area-rotate").data("pause"),jQuery(this).children(".cm-slider-area-rotate").data("auto"),jQuery(this).children(".cm-slider-area-rotate").data("hover"))}));var _=jQuery(".cm-posts");jQuery(_).each((function(){!function(e,t,i,o,r){jQuery(e).bxSlider({minSlides:1,maxSlides:2,slideWidth:390,slideMargin:20,speed:t,pause:i,auto:o,autoHover:r,adaptiveHeight:!0,nextText:'<div class="slide-next"><i class="fa fa-angle-right"></i></div>',prevText:'<div class="slide-prev"><i class="fa fa-angle-left"></i></div>',pager:!1,captions:!1,onSliderLoad:function(){jQuery(".cm-featured-posts--style-5 .cm-highlighted-post").css("visibility","visible"),jQuery(".cm-featured-posts--style-5 .cm-highlighted-post").css("height","auto")}})}(jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("speed"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("pause"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("auto"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("hover"))}));var S=jQuery(".cm-thumbnail-slider-news");jQuery(S).each((function(){!function(e,t,i,o,r,a,s){jQuery(e).bxSlider({mode:i,speed:o,pause:r,auto:a,pagerCustom:t,autoHover:s,controls:!1,nextText:"",prevText:"",nextSelector:"",prevSelector:"",captions:!1,onSliderLoad:function(){jQuery(".thumbnail-big-sliders").css("visibility","visible"),jQuery(".thumbnail-big-sliders").css("height","auto")}})}(jQuery(this).children(".thumbnail-big-sliders"),jQuery(this).children(".cm-thumbnail-slider"),jQuery(this).children(".thumbnail-big-sliders").data("mode"),jQuery(this).children(".thumbnail-big-sliders").data("speed"),jQuery(this).children(".thumbnail-big-sliders").data("pause"),jQuery(this).children(".thumbnail-big-sliders").data("auto"),jQuery(this).children(".thumbnail-big-sliders").data("hover"))}));var L=jQuery(".cm-featured-posts--style-7");jQuery(L).each((function(){!function(e,t){jQuery(e).bxSlider({minSlides:5,maxSlides:8,slideWidth:150,slideMargin:12,ticker:!0,speed:t,tickerHover:!0,useCSS:!1,onSliderLoad:function(){jQuery(".cm-image-ticker-news").css("visibility","visible"),jQuery(".cm-image-ticker-news").css("height","auto")}})}(jQuery(this).children(".cm-image-ticker-news"),jQuery(this).children(".cm-image-ticker-news").data("speed"))})),jQuery(".blog .gallery-images, .archive .gallery-images, .search .gallery-images, .single-post .gallery-images").bxSlider({mode:"fade",speed:1500,auto:!0,pause:3e3,adaptiveHeight:!0,nextText:"",prevText:"",nextSelector:".slide-next",prevSelector:".slide-prev",pager:!1}),jQuery(window).off("load.colormag colormagAjaxSinglePostLoaded.colormag").on("load.colormag colormagAjaxSinglePostLoaded.colormag",(function(){jQuery(".related-post-carousel").bxSlider({minSlides:1,maxSlides:2,auto:!0,slideWidth:390,slideMargin:20,moveSlides:1,shrinkItems:!0,speed:3e3,autoHover:!0,nextText:'<div class="slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1 1 0 0 1-.08.39 1 1 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></i></div>',prevText:'<div class="slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1 1 0 0 0 .08.39 1 1 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>',pager:!1,captions:!1,onSliderLoad:function(){jQuery(".related-post-carousel").css("visibility","visible"),jQuery(".related-post-carousel").css("height","auto")}})}))}if(void 0!==jQuery.fn.easytabs&&jQuery(".cm-tabbed-widget").easytabs(),void 0!==jQuery.fn.theiaStickySidebar&&"undefined"!=typeof ResizeSensor){var C=jQuery("#sticky-wrapper").outerHeight();null===C&&(C=0),jQuery("#cm-primary, #cm-secondary, #cm-tertiary").theiaStickySidebar({additionalMarginTop:40+C})}function T(e){e.find(".player-frame").each((function(){var e=jQuery(this),t=jQuery('[data-id="'+e.attr("id")+'"]');e.addVideoEvent("play",(function(e,i,o){t.removeClass("is-paused").addClass("is-playing")})),e.addVideoEvent("pause",(function(e,i,o){t.removeClass("is-playing").addClass("is-paused")})),e.addVideoEvent("finish",(function(e,i,o){t.removeClass("is-paused is-playing")}))}))}if(jQuery(".video-player").each((function(e){var t=jQuery(this),i="video-playlist-item-"+e,o=jQuery(this).find(".player-frame");t.attr("id",i),o.video(),T(t),o.addVideoEvent("ready",(function(){o.css("visibility","visible").fadeIn()})),t.off("click.colormag",".video-playlist-item").on("click.colormag",".video-playlist-item",(function(){var e=jQuery(this),i=e.data("id"),o=jQuery("#"+i),r=e.data("src");t.find(".player-frame").each((function(){jQuery(this).pauseVideo().hide()})),o.length?o.playVideo():(t.find(".video-frame").append('<iframe id="'+i+'" class="player-frame" src="'+r+'" frameborder="0" width="100%" height="434" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),(o=jQuery("#"+i)).video(),o.addVideoEvent("ready",(function(e,t,i){o.playVideo()}))),o.css("visibility","visible").fadeIn(),T(t)}))})),void 0!==jQuery.fn.prognroll&&jQuery("body").prognroll({height:5,color:colormag_progress_bar_indicator_color.bg_color,custom:!1}),"undefined"!=typeof google&&"undefined"!=typeof colormag_google_maps_widget_settings){n=parseFloat(colormag_google_maps_widget_settings.longitude),l=parseFloat(colormag_google_maps_widget_settings.latitude),d=parseInt(colormag_google_maps_widget_settings.zoom_size),u={lat:l,lng:n},m=new google.maps.Map(document.getElementById("GoogleMaps"),{zoom:d,center:u}),new google.maps.Marker({position:u,map:m}),jQuery("#GoogleMaps").css({height:colormag_google_maps_widget_settings.height})}f=jQuery(".share-buttons #facebook")[0],v=jQuery(".share-buttons #twitter")[0],w=jQuery(".share-buttons #pinterest")[0],j=jQuery(".share-buttons #email")[0],f&&jQuery(f).off("click.colormag").on("click.colormag",(function(e){return e.preventDefault(),(h=window.open("https://www.facebook.com/sharer/sharer.php?u="+document.URL+"&p[title]="+document.title,"facebook-popup","height=350,width=600")).focus&&h.focus(),!1})),v&&jQuery(v).off("click.colormag").on("click.colormag",(function(e){return e.preventDefault(),(g=window.open("https://twitter.com/share?text="+document.title+"&url="+document.URL,"twitter-popup","height=350,width=600")).focus&&g.focus(),!1})),w&&jQuery(w).off("click.colormag").on("click.colormag",(function(e){e.preventDefault();var t=jQuery(".cm-posts .cm-featured-image img").attr("src")?jQuery(".cm-posts .cm-featured-image img").attr("src"):"";return(y=window.open("https://pinterest.com/pin/create/button/?url="+document.URL+"&media="+t+"&description="+document.title,"pinterest-popup","height=350,width=600")).focus&&y.focus(),!1})),j&&jQuery(j).off("click.colormag").on("click.colormag",(function(e){e.preventDefault();var t=document.URL,i=document.title,o="mailto:?subject="+encodeURIComponent(i)+"&body="+encodeURIComponent(t);return(p=window.open(o,"email-popup","height=350,width=600")).focus&&p.focus(),!1}))}function initEssentialFunctions(){jQuery("#scroll-up").hide(),jQuery(window).on("scroll.colormag",(function(){jQuery(this).scrollTop()>1e3?jQuery("#scroll-up").fadeIn():jQuery("#scroll-up").fadeOut()})),jQuery("a#scroll-up").on("click.colormag",(function(){return jQuery("body,html").animate({scrollTop:0},800),!1}));const e=document.getElementById("cm-color-switch-checkbox");if(e&&e.addEventListener("change",handleColorSwitchChange),jQuery(".cm-submenu-toggle").on("click.colormag",(function(){jQuery(this).parent(".menu-item-has-children").children("ul.sub-menu").first().slideToggle("1000")})),jQuery(document).on("click.colormag","#cm-primary-nav ul li.menu-item-has-children > a",(function(e){var t=jQuery(this).parent(".menu-item-has-children");!t.hasClass("focus")&&jQuery(window).width()<=768&&(t.addClass("focus"),e.preventDefault(),t.children(".sub-menu").css({display:"block"}))})),void 0!==jQuery.fn.bxSlider){var t=jQuery(".cm-featured-category-slider ");jQuery(t).each((function(){!function(e,t,i,o,r,a){jQuery(e).bxSlider({mode:t,speed:i,auto:r,pause:o,autoHover:a,adaptiveHeight:!0,nextText:'<div class="cm-category-slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1 1 0 0 1-.08.39 1 1 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></div>',prevText:'<div class="cm-category-slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1 1 0 0 0 .08.39 1 1 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>',pager:!1,tickerHover:!0,onSliderLoad:function(){jQuery(".cm-slider-area-rotate").css("visibility","visible"),jQuery(".cm-slider-area-rotate").css("height","auto")}})}(jQuery(this).children(".cm-slider-area-rotate"),jQuery(this).children(".cm-slider-area-rotate").data("mode"),jQuery(this).children(".cm-slider-area-rotate").data("speed"),jQuery(this).children(".cm-slider-area-rotate").data("pause"),jQuery(this).children(".cm-slider-area-rotate").data("auto"),jQuery(this).children(".cm-slider-area-rotate").data("hover"))}));var i=jQuery(".cm-posts");jQuery(i).each((function(){!function(e,t,i,o,r){jQuery(e).bxSlider({minSlides:1,maxSlides:2,slideWidth:390,slideMargin:20,speed:t,pause:i,auto:o,autoHover:r,adaptiveHeight:!0,nextText:'<div class="slide-next"><i class="fa fa-angle-right"></i></div>',prevText:'<div class="slide-prev"><i class="fa fa-angle-left"></i></div>',pager:!1,captions:!1,onSliderLoad:function(){jQuery(".cm-featured-posts--style-5 .cm-highlighted-post").css("visibility","visible"),jQuery(".cm-featured-posts--style-5 .cm-highlighted-post").css("height","auto")}})}(jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("speed"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("pause"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("auto"),jQuery(this).children(".cm-featured-posts--style-5 .cm-highlighted-post").data("hover"))}));var o=jQuery(".cm-thumbnail-slider-news");jQuery(o).each((function(){!function(e,t,i,o,r,a,s){jQuery(e).bxSlider({mode:i,speed:o,pause:r,auto:a,pagerCustom:t,autoHover:s,controls:!1,nextText:"",prevText:"",nextSelector:"",prevSelector:"",captions:!1,onSliderLoad:function(){jQuery(".thumbnail-big-sliders").css("visibility","visible"),jQuery(".thumbnail-big-sliders").css("height","auto")}})}(jQuery(this).children(".thumbnail-big-sliders"),jQuery(this).children(".cm-thumbnail-slider"),jQuery(this).children(".thumbnail-big-sliders").data("mode"),jQuery(this).children(".thumbnail-big-sliders").data("speed"),jQuery(this).children(".thumbnail-big-sliders").data("pause"),jQuery(this).children(".thumbnail-big-sliders").data("auto"),jQuery(this).children(".thumbnail-big-sliders").data("hover"))}));var r=jQuery(".cm-featured-posts--style-7");jQuery(r).each((function(){!function(e,t){jQuery(e).bxSlider({minSlides:5,maxSlides:8,slideWidth:150,slideMargin:12,ticker:!0,speed:t,tickerHover:!0,useCSS:!1,onSliderLoad:function(){jQuery(".cm-image-ticker-news").css("visibility","visible"),jQuery(".cm-image-ticker-news").css("height","auto")}})}(jQuery(this).children(".cm-image-ticker-news"),jQuery(this).children(".cm-image-ticker-news").data("speed"))})),jQuery(".blog .gallery-images, .archive .gallery-images, .search .gallery-images, .single-post .gallery-images").bxSlider({mode:"fade",speed:1500,auto:!0,pause:3e3,adaptiveHeight:!0,nextText:"",prevText:"",nextSelector:".slide-next",prevSelector:".slide-prev",pager:!1}),jQuery(window).off("load.colormag colormagAjaxSinglePostLoaded.colormag").on("load.colormag colormagAjaxSinglePostLoaded.colormag",(function(){jQuery(".related-post-carousel").bxSlider({minSlides:1,maxSlides:2,auto:!0,slideWidth:390,slideMargin:20,moveSlides:1,shrinkItems:!0,speed:3e3,autoHover:!0,nextText:'<div class="slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1 1 0 0 1-.08.39 1 1 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></i></div>',prevText:'<div class="slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1 1 0 0 0 .08.39 1 1 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>',pager:!1,captions:!1,onSliderLoad:function(){jQuery(".related-post-carousel").css("visibility","visible"),jQuery(".related-post-carousel").css("height","auto")}})}))}var a=function(){jQuery("#cm-masthead .search-form-top").removeClass("show"),jQuery("#cm-content").removeClass("backdrop")};if(jQuery(document).on("click.colormag",".search-top",(function(){jQuery(this).next("#cm-masthead .search-form-top").toggleClass("show"),jQuery("#cm-content").toggleClass("backdrop"),setTimeout((function(){jQuery("#cm-masthead .search-form-top input").focus()}),200),function(){var e=jQuery(".cm-desktop-row .search-form-top.show, .cm-mobile-row .search-form-top.show");if(e.length){e.css({right:"",left:""});var t=e[0].getBoundingClientRect(),i=window.innerWidth;t.right>i?(e.css({right:0,left:"auto"}),e.css({"--arrow-right":"10px"})):t.left<0&&(e.css({left:0,right:"auto"}),e.css({"--arrow-left":"10px"}))}}(),jQuery(document).off("keyup.colormag").on("keyup.colormag",(function(e){27===e.keyCode&&jQuery("#cm-masthead .search-form-top").hasClass("show")&&a()})),jQuery(document).off("click.outEvent.colormag").on("click.outEvent.colormag",(function(e){e.target.closest(".cm-top-search")||(a(),jQuery(document).off("click.outEvent.colormag"))}))})),"undefined"!=typeof colormag_new_news_ticker_settings){let e=colormag_new_news_ticker_settings.ticker_slide_effect,t=colormag_new_news_ticker_settings.ticker_news_duration,i=colormag_new_news_ticker_settings.ticker_news_speed;jQuery("#cm-breaking-news-ticker").breakingNews({effect:e,scrollSpeed:i,delayTimer:t})}if(void 0!==jQuery.fn.newsTicker){if("undefined"!=typeof colormag_ticker_settings){var s=colormag_ticker_settings.breaking_news_slide_effect,c=parseInt(colormag_ticker_settings.breaking_news_duration,10),n=parseInt(colormag_ticker_settings.breaking_news_speed,10);jQuery(".newsticker").newsTicker({row_height:20,max_rows:1,direction:s,speed:n,duration:c,autostart:1,pauseOnHover:1,start:function(){jQuery(".newsticker").css("visibility","visible")}})}var l=jQuery(".cm-breaking-news");jQuery(l).each((function(){!function(e,t,i,o,r,a,s){jQuery(e).newsTicker({row_height:a,max_rows:s,duration:r,direction:o,prevButton:jQuery(t),nextButton:jQuery(i),start:function(){jQuery(".cm-breaking-news-slider-widget").css({visibility:"visible"})}})}(jQuery(this).children(".cm-breaking-news-slider-widget"),jQuery(this).children(".cm-slide-up"),jQuery(this).children(".cm-slide-down"),jQuery(this).children(".cm-breaking-news-slider-widget").data("direction"),jQuery(this).children(".cm-breaking-news-slider-widget").data("duration"),jQuery(this).children(".cm-breaking-news-slider-widget").data("rowheight"),jQuery(this).children(".cm-breaking-news-slider-widget").data("maxrows"))}))}}function reinitializeDarkMode(){const e=document.getElementById("cm-color-switch-checkbox");if(e){e.removeEventListener("change",handleColorSwitchChange),e.addEventListener("change",handleColorSwitchChange);const t=document.body.classList.contains("dark-skin");e.checked=!t}}function handleColorSwitchChange(){const e=document.getElementById("cm-color-switch-checkbox");e&&(localStorage.removeItem("colorSwitcherState"),localStorage.setItem("colorSwitcherState",e.checked),e.checked?document.body.classList.remove("dark-skin"):document.body.classList.add("dark-skin"))}jQuery(document).ready((function(){"undefined"!=typeof elementorFrontend||"undefined"!=typeof elementor||document.body.classList.contains("elementor-editor-active")||document.body.classList.contains("elementor-page")?initEssentialFunctions():colormagInit()})),function(){var e,t,i="",o="",r=!1;function a(){r="undefined"!=typeof elementorFrontend||"undefined"!=typeof elementor||document.body.classList.contains("elementor-editor-active")||document.body.classList.contains("elementor-page")}function s(){if(!r){var e=document.querySelector(".cm-header-builder"),t=document.querySelector("#cm-masthead"),a=document.querySelector("#cm-color-switch-checkbox");if(e){var s=e.innerHTML;s!==i&&(i=s,"function"==typeof colormagInit&&colormagInit(),reinitializeDarkMode())}if(t){var c=t.innerHTML;c!==o&&(o=c,"function"==typeof colormagInit&&colormagInit(),reinitializeDarkMode())}a&&(a.hasAttribute("data-dark-mode-initialized")||(a.setAttribute("data-dark-mode-initialized","true"),reinitializeDarkMode()))}}a(),"undefined"!=typeof wp&&wp.customize&&!r&&(wp.customize.bind("preview-ready",(function(){a(),r||(e=setInterval(s,500))})),wp.customize.bind("preview-url",(function(){e&&clearInterval(e),a(),r||(e=setInterval(s,500))})),wp.customize.bind("change",(function(){a(),r||setTimeout(s,200)})),wp.customize.bind("section",(function(){a(),r||setTimeout(s,300)}))),"undefined"!=typeof MutationObserver&&(t=new MutationObserver((function(e){if(!r){var t=!1;e.forEach((function(e){if("childList"===e.type||"attributes"===e.type){var i=e.target;i&&(i.classList.contains("cm-header-builder")||i.classList.contains("cm-desktop-row")||i.classList.contains("cm-mobile-row")||i.classList.contains("cm-top-search")||i.classList.contains("cm-color-switch-checkbox")||i.closest(".cm-header-builder")||i.closest("#cm-masthead")||i.closest(".cm-top-search")||i.closest('[id*="color-switch"]')||i.closest('[class*="color-switch"]'))&&(t=!0),e.addedNodes&&e.addedNodes.forEach((function(e){1===e.nodeType&&(e.classList.contains("cm-header-builder")||e.classList.contains("cm-desktop-row")||e.classList.contains("cm-mobile-row")||e.classList.contains("cm-top-search")||e.classList.contains("cm-color-switch-checkbox")||e.closest(".cm-header-builder")||e.closest("#cm-masthead")||e.closest(".cm-top-search")||e.closest('[id*="color-switch"]')||e.closest('[class*="color-switch"]'))&&(t=!0)}))}})),t&&setTimeout((function(){"function"==typeof colormagInit&&colormagInit(),reinitializeDarkMode()}),200)}})),jQuery(document).ready((function(){var e=document.querySelector(".cm-header-builder"),i=document.querySelector("#cm-masthead"),o=document.querySelector(".cm-top-search"),r=document.querySelector("#cm-color-switch-checkbox");e&&t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-position"]}),i&&t.observe(i,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-position"]}),o&&t.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-position"]}),r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-position","checked"]})}))),window.addEventListener("resize",(function(){a(),r||setTimeout(s,200)})),window.addEventListener("orientationchange",(function(){a(),r||setTimeout(s,300)})),document.addEventListener("click",(function(e){a(),r||!e.target.closest(".cm-header-builder")&&!e.target.closest("#cm-masthead")||setTimeout(s,200)}),!0)}(),jQuery((function(){var e=jQuery("#related-posts-wrapper-flyout");function t(){jQuery("#cm-primary").outerHeight();var t=jQuery(this).scrollTop()+jQuery(this).height();t>jQuery(document).height()-t?e.addClass("flyout"):e.removeClass("flyout")}jQuery(window).off("scroll.colormag").on("scroll.colormag",t),jQuery("#flyout-related-post-close").off("click.colormag").on("click.colormag",(function(){e.removeClass("flyout"),jQuery(window).off("scroll.colormag",t)}))})),jQuery(".wp-block-group__inner-container h2").wrap('<div class="block-title"></div>'),jQuery(".wp-block-heading").wrap('<div class="block-title"></div>'),document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("cm-color-switch-checkbox");let t=colormag_color_switcher.colormag_switcher;void 0===t&&(t="white"),null==e&&localStorage.removeItem("hasRunColor");let i=localStorage.getItem("hasRunColor");"false"!==i&&null!=i||("dark"===t?localStorage.setItem("colorSwitcherState","false"):localStorage.setItem("colorSwitcherState","true"));const o=localStorage.getItem("colorSwitcherState");"true"===o?document.body.classList.remove("dark-skin"):document.body.classList.add("dark-skin"),null!==e&&(localStorage.setItem("hasRunColor","true"),e.checked="true"===o,e.addEventListener("change",(function(){localStorage.removeItem("colorSwitcherState"),localStorage.setItem("colorSwitcherState",e.checked),e.checked?document.body.classList.remove("dark-skin"):document.body.classList.add("dark-skin")})))})),function(e){"use strict";e(document).ready((function(){function t(){e(".cm-header-off-canvas").removeClass("active"),e(".cm-off-canvas-overlay").removeClass("active"),e("body").removeClass("off-canvas-open"),e(".cm-off-canvas-toggle").attr("aria-expanded","false")}e(".cm-off-canvas-toggle").off("click.colormag").on("click.colormag",(function(t){t.preventDefault(),e(".cm-header-off-canvas").toggleClass("active"),e(".cm-off-canvas-overlay").toggleClass("active"),e("body").toggleClass("off-canvas-open"),e(".cm-header-off-canvas").hasClass("active")?e(".cm-off-canvas-toggle").attr("aria-expanded","true"):e(".cm-off-canvas-toggle").attr("aria-expanded","false")})),e(".cm-off-canvas-close, .cm-off-canvas-overlay").off("click.colormag").on("click.colormag",(function(e){e.preventDefault(),t()})),e(document).off("keyup.colormag").on("keyup.colormag",(function(e){"Escape"===e.key&&t()}))}))}(jQuery);
jQuery(document).ready((function(){var t=jQuery(".tg-ajax-btn-wrapper");jQuery(t).each((function(){!function(t,r,a,e,o,n,d,i,u,g){var l=1,s=colormag_script_vars.no_more_posts,c=r,y=e,h=a,j=o,Q=n,_=d,p=i;jQuery(t).on("click",(function(){l++,jQuery(g).show(),jQuery(t).attr("disabled",!0);var r={action:"get_ajax_results",tg_nonce:colormag_load_more.tg_nonce,tg_pagenumber:l,tg_category:c,tg_number:y,tg_random:h,tg_child_category:j,tg_tag:Q,tg_author:_,tg_type:p};return jQuery.post(colormag_load_more.ajax_url,r,(function(r){var a=jQuery(r);a.length?(jQuery(u).append(a),jQuery(g).hide(),jQuery(t).attr("disabled",!1)):(jQuery(g).hide(),jQuery(t).attr("disabled",!0),jQuery(t).html("<span>"+s+"</span>"))})),!1}))}("#"+jQuery(this).children(".tg-front-post-load-more").attr("id"),jQuery(this).children(".tg-front-post-load-more").data("category"),jQuery(this).children(".tg-front-post-load-more").data("random"),jQuery(this).children(".tg-front-post-load-more").data("number"),jQuery(this).children(".tg-front-post-load-more").data("child_category"),jQuery(this).children(".tg-front-post-load-more").data("tag"),jQuery(this).children(".tg-front-post-load-more").data("author"),jQuery(this).children(".tg-front-post-load-more").data("type"),"#"+jQuery(this).children(".tg-append-ajax-datas").attr("id"),"#"+jQuery(this).find(".waiting").attr("id"))}))}));
!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";
$.maxmegamenu=function(menu, options){
var plugin=this;
var $menu=$(menu);
var $wrap=$(menu).parent();
var $toggle_bar=$menu.siblings(".mega-menu-toggle");
var html_body_class_timeout;
var 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"),
hover_intent_interval: $menu.attr("data-hover-intent-interval")
};
plugin.settings={};
var 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", $menu);
var collapse_children_parents=$("li.mega-menu-megamenu li.mega-menu-item-has-children.mega-collapse-children > a.mega-menu-link", $menu);
plugin.addAnimatingClass=function(element){
if(plugin.settings.effect==="disabled"){
return;
}
$(".mega-animating").removeClass("mega-animating");
var 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(){
var width=Math.max(document.documentElement.clientWidth||0, window.innerWidth||0);
return width > plugin.settings.breakpoint;
};
plugin.isMobileView=function(){
return !plugin.isDesktopView();
};
plugin.showPanel=function(anchor, immediate){
if($.isNumeric(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();
}
anchor.parent().triggerHandler("before_open_panel");
anchor.parent().find("[aria-expanded]").first().attr("aria-expanded", "true");
$(".mega-animating").removeClass("mega-animating");
if(plugin.isMobileView()&&anchor.parent().hasClass("mega-hide-sub-menu-on-mobile")){
return;
}
if(plugin.isDesktopView()&&($menu.hasClass("mega-menu-horizontal")||$menu.hasClass("mega-menu-vertical"))&&!anchor.parent().hasClass("mega-collapse-children")){
plugin.hideSiblingPanels(anchor, true);
}
if((plugin.isMobileView()&&$wrap.hasClass("mega-keyboard-navigation"))||plugin.settings.vertical_behaviour==="accordion"){
plugin.hideSiblingPanels(anchor, false);
}
plugin.calculateDynamicSubmenuWidths(anchor);
if(plugin.shouldUseSlideAnimation(anchor, immediate)){
var speed=plugin.isMobileView() ? 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", "");
});
}
anchor.parent().addClass("mega-toggle-on").triggerHandler("open_panel");
};
plugin.shouldUseSlideAnimation=function(anchor, immediate){
if(immediate==true){
return false;
}
if(anchor.parent().hasClass("mega-collapse-children")){
return true;
}
if(plugin.isDesktopView()&&plugin.settings.effect==="slide"){
return true;
}
if(plugin.isMobileView()){
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($.isNumeric(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();
}
anchor.parent().triggerHandler("before_close_panel");
anchor.parent().find("[aria-expanded]").first().attr("aria-expanded", "false");
if(plugin.shouldUseSlideAnimation(anchor)){
var speed=plugin.isMobileView() ? plugin.settings.effect_speed_mobile:plugin.settings.effect_speed;
anchor.siblings(".mega-sub-menu").animate({"height":"hide", "paddingTop":"hide", "paddingBottom":"hide", "minHeight":"hide"}, speed, function(){
anchor.siblings(".mega-sub-menu").css("display", "");
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
});
return;
}
if(immediate){
anchor.siblings(".mega-sub-menu").css("display", "none").delay(plugin.settings.effect_speed).queue(function(){
$(this).css("display", "").dequeue();
});
}
anchor.siblings(".mega-sub-menu").find(".widget_media_video video").each(function(){
this.player.pause();
});
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
plugin.addAnimatingClass(anchor.parent());
};
plugin.calculateDynamicSubmenuWidths=function(anchor){
if(anchor.parent().hasClass("mega-menu-megamenu")&&anchor.parent().parent().hasClass("max-mega-menu")&&plugin.settings.panel_width){
if(plugin.isDesktopView()){
var submenu_offset=$menu.offset();
var target_offset=$(plugin.settings.panel_width).offset();
if(plugin.settings.panel_width=='100vw'){
target_offset=$('body').offset();
anchor.siblings(".mega-sub-menu").css({
left: (target_offset.left - submenu_offset.left) + "px"
});
}else if($(plugin.settings.panel_width).length > 0){
anchor.siblings(".mega-sub-menu").css({
width: $(plugin.settings.panel_width).outerWidth(),
left: (target_offset.left - submenu_offset.left) + "px"
});
}}else{
anchor.siblings(".mega-sub-menu").css({
width: "",
left: ""
});
}}
if(anchor.parent().hasClass("mega-menu-megamenu")&&anchor.parent().parent().hasClass("max-mega-menu")&&plugin.settings.panel_inner_width&&$(plugin.settings.panel_inner_width).length > 0){
var target_width=0;
if($(plugin.settings.panel_inner_width).length){
target_width=parseInt($(plugin.settings.panel_inner_width).width(), 10);
}else{
target_width=parseInt(plugin.settings.panel_inner_width, 10);
}
anchor.siblings(".mega-sub-menu").css({
"paddingLeft": "",
"paddingRight": ""
});
var submenu_width=parseInt(anchor.siblings(".mega-sub-menu").innerWidth(), 10);
if(plugin.isDesktopView()&&target_width > 0&&target_width < submenu_width){
anchor.siblings(".mega-sub-menu").css({
"paddingLeft": (submenu_width - target_width) / 2 + "px",
"paddingRight": (submenu_width - target_width) / 2 + "px"
});
}}
};
plugin.bindClickEvents=function(){
if($wrap.data('has-click-events')===true){
return;
}
$wrap.data('has-click-events', true);
var dragging=false;
$(document).on({
"touchmove": function(e){ dragging=true; },
"touchstart": function(e){ dragging=false; }});
$(document).on("click touchend", function(e){
if(!dragging&&plugin.settings.document_click==="collapse"&&! $(e.target).closest(".mega-menu-wrap").length){
plugin.hideAllPanels();
plugin.hideMobileMenu();
}
dragging=false;
});
var 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", function(){
plugin.hideAllPanels();
plugin.hideMobileMenu();
});
$("button.mega-close", $wrap).on("click", 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.bindKeyboardEvents=function(){
const tab_key=9;
const escape_key=27;
const enter_key=13;
const left_arrow_key=37;
const up_arrow_key=38;
const right_arrow_key=39;
const down_arrow_key=40;
const space_key=32;
const $firstFocusable=$menu.find("a.mega-menu-link").first();
const $lastFocusable=$wrap.find("button.mega-close").first();
var isMobileOffCanvasHorizontal=function(){
return plugin.isMobileOffCanvas()&&plugin.settings.mobile_direction==='horizontal';
}
var shouldTrapFocusInCurrentSubMenu=function(){
return isMobileOffCanvasHorizontal()&&(keyCode===up_arrow_key||keyCode===down_arrow_key||keyCode===tab_key);
}
$lastFocusable.on('keydown.megamenu', function(e){
var keyCode=e.keyCode||e.which;
if(plugin.isMobileView()&&plugin.isMobileOffCanvas()&&keyCode===tab_key&&! e.shiftKey){
e.preventDefault();
$firstFocusable.trigger('focus');
}});
$firstFocusable.on('keydown.megamenu', function(e){
var keyCode=e.keyCode||e.which;
if(plugin.isMobileView()&&plugin.isMobileOffCanvas()&&keyCode===tab_key&&e.shiftKey){
e.preventDefault();
$lastFocusable.trigger('focus');
}});
$wrap.on("keyup.megamenu", ".max-mega-menu, .mega-menu-toggle", function(e){
var keyCode=e.keyCode||e.which;
var active_link=$(e.target);
if(keyCode===tab_key){
$wrap.addClass("mega-keyboard-navigation");
plugin.bindClickEvents();
if(plugin.isDesktopView()&&keyCode===tab_key&&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;
}
var keyCode=e.keyCode||e.which;
var active_link=$(e.target);
if(keyCode===space_key&&active_link.is(".mega-menu-link")){
e.preventDefault();
if(active_link.parent().is(items_with_submenus)){
if(active_link.parent().hasClass("mega-toggle-on")&&! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel(active_link);
}else{
plugin.showPanel(active_link);
}}
}
if(keyCode===space_key&&active_link.is("mega-indicator")){
e.preventDefault();
if(active_link.parent().parent().hasClass("mega-toggle-on")&&! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel(active_link.parent());
}else{
plugin.showPanel(active_link.parent());
}}
if(keyCode===escape_key){
var submenu_open=$(".mega-toggle-on", $menu).length!==0;
if(submenu_open){
var focused_menu_item=$menu.find(":focus");
if(focused_menu_item.closest('.mega-menu-flyout.mega-toggle-on').length!==0){
var nearest_parent_of_focused_item_li=focused_menu_item.closest('.mega-toggle-on');
var nearest_parent_of_focused_item_a=$("> a.mega-menu-link", nearest_parent_of_focused_item_li);
plugin.hidePanel(nearest_parent_of_focused_item_a);
nearest_parent_of_focused_item_a.trigger('focus');
}
if(focused_menu_item.closest('.mega-menu-megamenu.mega-toggle-on').length!==0){
var nearest_parent_of_focused_item_li=focused_menu_item.closest('.mega-menu-megamenu.mega-toggle-on');
var nearest_parent_of_focused_item_a=$("> a.mega-menu-link", nearest_parent_of_focused_item_li);
plugin.hidePanel(nearest_parent_of_focused_item_a);
nearest_parent_of_focused_item_a.trigger('focus');
}}
if(plugin.isMobileView()&&! submenu_open){
plugin.hideMobileMenu();
}}
if(keyCode===space_key||keyCode===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(keyCode===enter_key){
if(active_link.is(".mega-indicator")){
if(active_link.closest("li.mega-menu-item").hasClass("mega-toggle-on")&&! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel(active_link.parent());
}else{
plugin.showPanel(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){
if(active_link.parent().hasClass("mega-toggle-on")&&! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed")){
plugin.hidePanel(active_link);
}else{
plugin.showPanel(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()){
var focused_item=$(":focus", $menu);
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;
}
var 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){
var 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');
}}
var shouldGoToNextTopLevelItem=function(){
return(( keyCode===right_arrow_key&&plugin.isDesktopView())||(keyCode===down_arrow_key&&plugin.isMobileView()) )&&$menu.hasClass("mega-menu-horizontal");
}
var shouldGoToPreviousTopLevelItem=function(){
return(( keyCode===left_arrow_key&&plugin.isDesktopView())||(keyCode===up_arrow_key&&plugin.isMobileView()) )&&$menu.hasClass("mega-menu-horizontal");
}
if(shouldGoToNextTopLevelItem()){
e.preventDefault();
var 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=$(":focus", $menu).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=$(":focus", $menu).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(shouldGoToPreviousTopLevelItem()){
e.preventDefault();
var 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=$(":focus", $menu).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=$(":focus", $menu).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(){
var menu_has_focus=$wrap.find(":focus").length > 0;
if(! menu_has_focus){
$wrap.removeClass("mega-keyboard-navigation");
plugin.hideAllPanels();
plugin.hideMobileMenu();
}}, 10);
}});
};
plugin.unbindAllEvents=function(){
$("ul.mega-sub-menu, li.mega-menu-item, li.mega-menu-row, li.mega-menu-column, a.mega-menu-link, .mega-indicator", $menu).off().unbind();
};
plugin.unbindClickEvents=function(){
if($wrap.hasClass('mega-keyboard-navigation')){
return;
}
$("> a.mega-menu-link", items_with_submenus).not(collapse_children_parents).off("click.megamenu touchend.megamenu");
$wrap.data('has-click-events', false);
};
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();
if(plugin.isDesktopView()&&plugin.settings.event==="hover_intent"){
plugin.bindHoverIntentEvents();
}
if(plugin.isDesktopView()&&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){
force=force||false;
if(! $toggle_bar.is(":visible")&&! force){
return;
}
$menu.attr("aria-hidden", "true");
html_body_class_timeout=setTimeout(function(){
$("body").removeClass($menu.attr("id") + "-mobile-open");
$("html").removeClass($menu.attr("id") + "-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($menu.attr("id") + "-mobile-open");
plugin.expandMobileSubMenus();
if(plugin.isMobileOffCanvas()){
$("html").addClass($menu.attr("id") + "-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(){
if($(plugin.settings.mobile_force_width).length&&(plugin.settings.effect_mobile==="slide"||plugin.settings.effect_mobile==="disabled") ){
var submenu_offset=$toggle_bar.offset();
var target_offset=$(plugin.settings.mobile_force_width).offset();
$menu.css({
width: $(plugin.settings.mobile_force_width).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();
}
$(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")){
var 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";
$.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);
}
if($menu.data("view")==="desktop"){
expanding_search.attr('placeholder', '');
}};
plugin.close_search=function(moveFocus=true){
$menu.triggerHandler("mmm:closeSearch");
input.val("");
input.attr('placeholder', '');
input.attr('tabindex', '-1');
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');
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);