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);
if(window.NodeList&&! NodeList.prototype.forEach){
NodeList.prototype.forEach=function(callback, thisArg){
thisArg=thisArg||window;
for(var i=0; i < this.length; i++){
callback.call(thisArg, this[ i ], i, this);
}};}
window.alxMediaMenu={
init: function(args){
var self=this,
navs=document.querySelectorAll(args.selector);
if(! navs.length){
return;
}
navs.forEach(function(nav){
var menuToggler=nav.querySelector('.menu-toggle');
if(! nav.querySelector('ul')&&nav.querySelector('.menu-toggle') ){
nav.querySelector('.menu-toggle').style.display='none';
}
if(! nav.classList.contains('nav-menu') ){
nav.classList.add('nav-menu');
}
self.toggleHoverEventListeners(nav);
nav.querySelectorAll('a,button').forEach(function(link){
link.addEventListener('focus', window.alxMediaMenu.toggleFocus, true);
link.addEventListener('blur', window.alxMediaMenu.toggleFocus, true);
});
menuToggler.addEventListener('click', function(){
if(nav.classList.contains('toggled') ){
menuToggler.setAttribute('aria-expanded', 'false');
nav.classList.remove('toggled');
}else{
menuToggler.setAttribute('aria-expanded', 'true');
nav.classList.add('toggled');
}});
document.addEventListener('click', function(event){
if(! nav.contains(event.target) ){
nav.classList.remove('toggled');
nav.querySelectorAll('button.active,.sub-menu.active').forEach(function(el){
el.classList.remove('active');
});
menuToggler.setAttribute('aria-expanded', 'false');
}});
});
window.alxMediaMenu.toggleMobile(args.selector, args.breakpoint);
window.addEventListener('resize', function(){
if(! window.resizeDebouncedTimeout){
window.resizeDebouncedTimeout=setTimeout(function(){
window.resizeDebouncedTimeout=null;
window.alxMediaMenu.toggleMobile(args.selector, args.breakpoint);
}, 250);
}});
document.querySelectorAll(args.selector).forEach(function(el){
window.alxMediaMenu.toggleFocusTouch(el);
});
},
toggleItem: function(el){
var parentLi=this.helper.firstAncestorMatch(el, 'li'),
parentUl=this.helper.firstAncestorMatch(el, 'ul'),
ul=parentLi.querySelector('ul.sub-menu');
parentLi.classList.remove('hover');
ul.setAttribute('tabindex', '-1');
this.helper.toggleClass(ul, 'active');
this.helper.toggleClass(el, 'active');
parentUl.querySelectorAll('ul.sub-menu').forEach(function(subMenu){
var subMenuButton;
if(! parentLi.contains(subMenu) ){
subMenu.classList.remove('active');
subMenuButton=subMenu.parentNode.querySelector('button.active');
if(subMenuButton){
subMenuButton.classList.remove('active');
}}
});
},
toggleMobile: function(selector, breakpoint){
var self=this,
screenWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,
navs=document.body.querySelectorAll(selector),
isMobile;
breakpoint=breakpoint||720;
isMobile=breakpoint > screenWidth;
if(isMobile){
navs.forEach(function(nav){
if(! nav.classList.contains('mobile') ){
nav.classList.add('mobile');
self.toggleHoverEventListeners(nav);
}});
}else{
navs.forEach(function(nav){
if(nav.classList.contains('mobile') ){
nav.classList.remove('mobile');
self.toggleHoverEventListeners(nav);
}});
}},
liMouseEnterEvent: function(){
this.classList.add('hover');
},
liMouseLeaveEvent: function(){
this.classList.remove('hover');
},
toggleHoverEventListeners: function(nav){
if(nav.classList.contains('mobile') ){
this.removeHoverEventListeners(nav);
}else{
this.addHoverEventListeners(nav);
}},
addHoverEventListeners: function(nav){
nav.querySelectorAll('li').forEach(function(li){
li.addEventListener('mouseenter', window.alxMediaMenu.liMouseEnterEvent);
li.addEventListener('mouseleave', window.alxMediaMenu.liMouseLeaveEvent);
});
},
removeHoverEventListeners: function(nav){
nav.querySelectorAll('li').forEach(function(li){
li.removeEventListener('mouseenter', window.alxMediaMenu.liMouseEnterEvent);
li.removeEventListener('mouseleave', window.alxMediaMenu.liMouseLeaveEvent);
});
},
toggleFocus: function(){
var self=this;
while(-1===self.className.indexOf('nav-menu') ){
if('li'===self.tagName.toLowerCase()){
if(-1!==self.className.indexOf('focus') ){
self.className=self.className.replace(' focus', '');
}else{
self.className +=' focus';
}}
self=self.parentElement;
}},
toggleFocusTouch: function(el){
var touchStartFn,
parentLinks=el.querySelectorAll('.menu-item-has-children > a, .page_item_has_children > a');
if('ontouchstart' in window){
touchStartFn=function(e){
var menuItem=this.parentNode;
if(! menuItem.classList.contains('focus') ){
e.preventDefault();
menuItem.parentNode.children.forEach(function(child){
if(menuItem!==child){
child.classList.remove('focus');
}});
menuItem.classList.add('focus');
}else{
menuItem.classList.remove('focus');
}};
parentLinks.forEach(function(parentLink){
parentLink.addEventListener('touchstart', touchStartFn, false);
});
}},
helper: {
toggleClass: function(el, className){
if(el.classList.contains(className) ){
el.classList.remove(className);
}else{
el.classList.add(className);
}},
firstAncestorMatch: function(el, selector){
if(el.parentNode.matches(selector) ){
return el.parentNode;
}
return this.firstAncestorMatch(el.parentNode, selector);
}}
};
window.alxMediaMenu.init({
selector: '.main-navigation.nav-menu',
breakpoint: 720
});