PageSourceSearch

https://cwicly.com/wp-content/plugins/cwicly/assets/js/cc-menu-new.min.js?ver=1.4.1.8

js cwicly.com collected 2026-09-25 14:19:54 UTC 14,963 bytes, 1 lines download raw bytes

1class CCMenuHor{constructor(e,t){this.$el=e,this.type=t,this.currentIndex=0,this.subMenuIndex=[],this.hrefs=e.querySelectorAll("a"),this.mainMenus=e.querySelectorAll(":scope > li > a"),this.mainMenusLength=this.mainMenus.length,this.allLis=e.querySelectorAll("li"),this.events(),this.init()}init(){this.hrefs.forEach(e=>{e.setAttribute("tabindex","-1")}),this.mainMenus.forEach((e,t)=>{0===t&&e.setAttribute("tabindex","0")})}events(){this.allLis.forEach(e=>{e.addEventListener("mouseover",this.handleMouseOver.bind(this,e)),e.addEventListener("mouseout",this.handleMouseOut.bind(this,e))}),this.allLis.forEach(e=>{e.addEventListener("click",this.handleClick.bind(this,e))}),this.$el.addEventListener("keydown",this.handleKey.bind(this))}handleClick(e,t){-1!==e.querySelector("a").href.indexOf("#")&&"function"==typeof cc_closeAllModals&&cc_closeAllModals()}handleMouseOver(e,t){t.target||t.currentTarget;let n=e.querySelector("a");e.classList.add("active"),"false"==n.getAttribute("aria-expanded")&&n.setAttribute("aria-expanded","true"),this.resetTabIndex(),this.hrefs[0].setAttribute("tabindex","0"),this.currentIndex=0,this.subMenuIndex.length&&(this.resetDropdowns(e),this.subMenuIndex=[])}handleMouseOut(e,t){t.target||t.currentTarget;let n=e.querySelector("a");e.classList.remove("active"),"true"==n.getAttribute("aria-expanded")&&n.setAttribute("aria-expanded","false")}handleKey(e){const t=event.key||event.keyCode;let n=ccKeyPress(e);e.target||e.currentTarget;if(!(e.altKey||e.ctrlKey||e.metaKey))switch(n){case"TabShift":0===this.currentIndex?(this.resetDropdowns(),this.subMenuIndex=[],this.resetTabIndex(),this.currentIndex=0,this.hrefs[this.currentIndex].setAttribute("tabindex","0")):this.subMenuIndex.length?0===this.subMenuIndex[this.subMenuIndex.length-1]?1===this.subMenuIndex.length?(this.resetDropdowns(),this.subMenuIndex=[],this.gotoMainIndex(this.currentIndex,!0),ccPreventEvent(e)):this.moveLeft(e):this.moveUp(e):this.moveLeft(e);break;case"Tab":if(this.currentIndex===this.mainMenusLength-1);else if(this.subMenuIndex.length){const t=this.getSubMenuElementsNumber(e);this.subMenuIndex[this.subMenuIndex.length-1]===t-1?this.moveRight(e,"tab"):this.moveDown(e)}else this.moveRight(e,"tab");break;case"Space":ccPreventEvent(e),this.openDropdown(e,!1,!0);break;case"ArrowRight":ccPreventEvent(e),this.moveRight(e);break;case"ArrowLeft":ccPreventEvent(e),this.moveLeft(e);break;case"ArrowDown":ccPreventEvent(e),this.moveDown(e);break;case"ArrowUp":ccPreventEvent(e),this.moveUp(e);break;case"Home":this.goHome(e),ccPreventEvent(e);break;case"End":this.goEnd(e),ccPreventEvent(e);break;case"Character":this.gotoCharacter(e,t),ccPreventEvent(e);break;case"Escape":1===this.subMenuIndex.length?(this.resetDropdowns(),this.subMenuIndex=[],this.resetTabIndex(),this.hrefs[this.currentIndex].setAttribute("tabindex","0"),this.gotoMainIndex(this.currentIndex)):this.subMenuIndex.length>1&&this.gotoSubMenu(e),ccPreventEvent(e);break;default:return}}moveRight(e,t){if(this.subMenuIndex.length)if(1===this.subMenuIndex.length){this.checkHasSubMenu(e.target||e.currentTarget)?this.openDropdown(e):(this.resetDropdowns(),this.subMenuIndex=[],this.gotoMainIndex(this.currentIndex+1,"tab"!==t)),ccPreventEvent(e)}else{this.checkHasSubMenu(e.target||e.currentTarget)?this.openDropdown(e):(this.resetDropdowns(),this.subMenuIndex=[],this.gotoMainIndex(this.currentIndex+1,"tab"!==t)),ccPreventEvent(e)}else this.gotoMainIndex(this.currentIndex+1),ccPreventEvent(e)}moveLeft(e){this.subMenuIndex.length?1===this.subMenuIndex.length?(this.resetDropdowns(),this.subMenuIndex=[],this.gotoMainIndex(this.currentIndex-1,!0),ccPreventEvent(e)):(this.gotoSubMenu(e),ccPreventEvent(e)):(this.gotoMainIndex(this.currentIndex-1),ccPreventEvent(e))}moveDown(e){this.subMenuIndex.length?(this.gotoSubIndex(e,"down"),ccPreventEvent(e)):(this.openDropdown(e),ccPreventEvent(e))}moveUp(e){this.subMenuIndex.length?(this.gotoSubIndex(e,"up"),ccPreventEvent(e)):(this.openDropdown(e,!0),ccPreventEvent(e))}openDropdown(e,t,n){let s=e.target||e.currentTarget,r=s.parentElement.querySelector("ul");if(r){let e,n;if(t?(n=r.querySelectorAll(":scope > li > a"),e=n&&n[n.length-1]):e=r.querySelector("a"),e){s.parentElement.classList.add("active"),"false"==s.getAttribute("aria-expanded")&&s.setAttribute("aria-expanded","true"),this.resetTabIndex(),e.setAttribute("tabindex","0"),setTimeout(()=>{this.subMenuIndex.push(t?n.length-1:0),e.focus()},80)}}else n&&s.click()}checkHasSubMenu(e){return!!e.parentElement.querySelector("ul")}gotoMainIndex(e,t){if(e==this.mainMenusLength?e=0:e<0&&(e=this.mainMenusLength-1),this.resetTabIndex(),this.mainMenus[e].focus(),this.resetDropdowns(),t){this.mainMenus[e].parentElement.classList.add("active"),"false"==this.mainMenus[e].getAttribute("aria-expanded")&&this.mainMenus[e].setAttribute("aria-expanded","true")}this.mainMenus[e].setAttribute("tabindex","0"),this.currentIndex=e}gotoSubIndex(e,t){let n=(e.target||e.currentTarget).parentElement.closest("ul");if("down"==t)if(n.children[this.subMenuIndex[this.subMenuIndex.length-1]+1]){let e=n.children[this.subMenuIndex[this.subMenuIndex.length-1]+1].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=this.subMenuIndex[this.subMenuIndex.length-1]+1}else{let e=n.children[0].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=0}else if("up"==t)if(n.children[this.subMenuIndex[this.subMenuIndex.length-1]-1]){let e=n.children[this.subMenuIndex[this.subMenuIndex.length-1]-1].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=this.subMenuIndex[this.subMenuIndex.length-1]-1}else{let e=n.children[n.children.length-1].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=n.children.length-1}else if("home"===t){let e=n.children[0].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=0}else if("end"===t){let e=n.children[n.children.length-1].querySelector("a");this.resetTabIndex(),e.setAttribute("tabindex","0"),e.focus(),this.subMenuIndex[this.subMenuIndex.length-1]=n.children.length-1}}gotoSubMenu(e){let t=(e.target||e.currentTarget).parentElement.closest("ul"),n=t.parentElement.querySelector("a"),s=t.parentElement.closest("ul").parentElement;this.resetTabIndex(),n.setAttribute("tabindex","0"),n.focus(),this.subMenuIndex.pop(),this.resetDropdowns(s)}
1resetTabIndex(){this.hrefs.forEach((e,t)=>{e.setAttribute("tabindex","-1")})}resetDropdowns(e){this.hrefs.forEach((t,n)=>{let s=t.parentElement;e&&s.contains(e)||s.classList.remove("active")})}goHome(e){this.subMenuIndex.length?(this.gotoSubIndex(e,"home"),ccPreventEvent(e)):(this.gotoMainIndex(0),ccPreventEvent(e))}goEnd(e){this.subMenuIndex.length?(this.gotoSubIndex(e,"end"),ccPreventEvent(e)):(this.gotoMainIndex(this.mainMenusLength-1),ccPreventEvent(e))}gotoCharacter(e,t){let n=e.target||e.currentTarget,s=n.parentElement.closest("ul").querySelectorAll(":scope > li > a");if(this.subMenuIndex.length){const r=this.searchCharacter(s,t,n);r>-1&&(this.resetTabIndex(),s[r].setAttribute("tabindex","0"),s[r].focus(),this.subMenuIndex[this.subMenuIndex.length-1]=r,ccPreventEvent(e))}else{const s=this.searchCharacter(this.mainMenus,t,n);s>-1&&(this.resetTabIndex(),this.mainMenus[s].setAttribute("tabindex","0"),this.mainMenus[s].focus(),this.currentIndex=s,ccPreventEvent(e))}}searchCharacter(e,t,n){var s,r,i=-1;let a=t.toLowerCase();for((s=[...e].indexOf(n)+1)>=e.length&&(s=0),r=s;r<e.length;r++)if(a===e[r].textContent.trim()[0].toLowerCase()){i=r;break}if(-1===i)for(r=0;r<s;r++)if(a===e[r].textContent.trim()[0].toLowerCase()){i=r;break}if(i>-1)return i}getSubMenuElementsNumber(e){return(e.target||e.currentTarget).parentElement.closest("ul").children.length}}class CCMenuVer{constructor(e,t){this.$el=e,this.type=t,this.currentIndex=0,this.subMenuIndex=[],this.treeItems=[...e.querySelectorAll('[role="treeitem"]')],this.hrefs=e.querySelectorAll("a"),this.mainMenus=e.querySelectorAll(":scope > li > a"),this.mainMenusLength=this.mainMenus.length,this.allLis=e.querySelectorAll("li"),this.events(),this.init()}init(){this.mainMenus.forEach((e,t)=>{0===t?e.setAttribute("tabindex","0"):e.setAttribute("tabindex","-1")}),"hor"===this.type?this.$el.setAttribute("role","menubar"):"ver"===this.type&&this.$el.setAttribute("role","tree")}events(){"ver"===this.type&&this.allLis.forEach(e=>{e.addEventListener("click",this.handleClick.bind(this,e))}),this.$el.addEventListener("keydown",this.handleKey.bind(this)),document.addEventListener("keydown",this.handleOutside.bind(this))}handleClick(e,t){t.target||t.currentTarget;let n=e.querySelector("a");const s=e.querySelector(":scope > .cc-menu-dropdown");if(!e.classList.contains("active")&&e.childElementCount>1)ccPreventEvent(t),e.classList.add("active"),"false"==n.getAttribute("aria-expanded")&&n.setAttribute("aria-expanded","true"),s&&slideDown(s,500);else if(e.childElementCount>1)ccPreventEvent(t),e.classList.remove("active"),"true"==n.getAttribute("aria-expanded")&&n.setAttribute("aria-expanded","false"),s&&slideUp(s,500);else if("_blank"===n.getAttribute("target"));else{ccPreventEvent(t);const n=e.getElementsByTagName("a");n.length&&n[0].href&&-1!==n[0].href.indexOf("#")&&"function"==typeof cc_closeAllModals&&cc_closeAllModals(),window.location=n[0].href}}handleOutside(e){e.key||e.keyCode;let t=ccKeyPress(e);e.target||e.currentTarget;e.target||e.currentTarget;if(!(e.altKey||e.ctrlKey||e.metaKey))switch(t){case"TabShift":setTimeout(()=>{if(document.activeElement.previousElementSibling===this.$el.parentElement){let e=this.getVisibleTreeitems();this.setTabIndex(e[e.length-1])}},0);break;case"Tab":setTimeout(()=>{document.activeElement.nextElementSibling===this.$el.parentElement&&this.setTabIndex(this.treeItems[0])},0)}}handleKey(e){const t=e.key||e.keyCode;let n=ccKeyPress(e);e.target||e.currentTarget;const s=e.target||e.currentTarget;if(!(e.altKey||e.ctrlKey||e.metaKey))switch(n){case"TabShift":"tabshift"!=this.setFocusToPreviousTreeitem(e,!0)&&ccPreventEvent(e);break;case"Tab":"tab"!=this.setFocusToNextTreeitem(e,"tab")&&ccPreventEvent(e);break;case"Space":case"Enter":ccPreventEvent(e),this.isExpandable(e)?this.isExpanded(e)?window.location=s.href:this.expandTreeitem(e):window.location=s.href;break;case"ArrowRight":ccPreventEvent(e),this.isExpandable(e)&&(this.isExpanded(e)?this.setFocusToNextTreeitem(e):this.expandTreeitem(e));break;case"ArrowLeft":ccPreventEvent(e),this.isExpandable(e)&&this.isExpanded(e)?this.collapseTreeitem(e):this.isInSubtree(e)&&this.setFocusToParentTreeitem(e);break;case"ArrowDown":ccPreventEvent(e),this.setFocusToNextTreeitem(e);break;case"ArrowUp":ccPreventEvent(e),this.setFocusToPreviousTreeitem(e);break;case"Home":this.setFocusToTreeitem(this.treeItems[0]),ccPreventEvent(e);break;case"End":let r=this.getVisibleTreeitems();this.setFocusToTreeitem(r[r.length-1]),ccPreventEvent(e);break;case"Character":this.setFocusByFirstCharacter(e,t),ccPreventEvent(e);break;case"Asterisk":this.expandAllSiblingTreeitems(e),ccPreventEvent(e);break;default:return}}getVisibleTreeitems(){let e=[];
1return this.treeItems.forEach(t=>{this.isVisible(t)&&e.push(t)}),e}isVisible(e){return!(this.isInSubtree(e)&&(!(e=this.getParentTreeitem(e))||"false"===e.getAttribute("aria-expanded")))}setFocusToTreeitem(e){this.setTabIndex(e),e.focus()}isInSubtree(e){return!(!e.parentNode||!e.parentNode.parentNode)&&"group"===e.parentNode.parentNode.getAttribute("role")}isExpandable(e){return(e.target||e.currentTarget).hasAttribute("aria-expanded")}isExpanded(e){return"true"===(e.target||e.currentTarget).getAttribute("aria-expanded")}expandTreeitem(e){const t=e.target||e.currentTarget;if(t.getAttribute("aria-owns")){var n=document.getElementById(t.getAttribute("aria-owns"));n&&"false"==t.getAttribute("aria-expanded")&&(n.parentElement.classList.add("active"),t.setAttribute("aria-expanded","true"),slideDown(n,500))}}collapseTreeitem(e){const t=e.target||e.currentTarget;if(t.getAttribute("aria-owns")){var n=document.getElementById(t.getAttribute("aria-owns"));n&&"true"==t.getAttribute("aria-expanded")&&(n.parentElement.classList.remove("active"),t.setAttribute("aria-expanded","false"),slide
1Up(n,500))}}setFocusToParentTreeitem(e){const t=e.target||e.currentTarget;if(this.isInSubtree(t)){var n=t.parentNode.parentNode.previousElementSibling;this.setFocusToTreeitem(n)}}expandAllSiblingTreeitems(e){var t=(e.target||e.currentTarget).parentNode.parentNode;if(t)for(var n=t.querySelectorAll(":scope > li > a[aria-expanded]"),s=0;s<n.length;s++){var r=document.getElementById(n[s].getAttribute("aria-owns"));r&&"false"==n[s].getAttribute("aria-expanded")&&(r.parentElement.classList.add("active"),n[s].setAttribute("aria-expanded","true"),slideDown(r,500))}}setTabIndex(e){this.treeItems.forEach(e=>e.tabIndex=-1),e.tabIndex=0}getParentTreeitem(e){var t=e.parentNode;return!!(t&&(t=t.parentNode)&&(t=t.previousElementSibling)&&"treeitem"===t.getAttribute("role"))&&t}setFocusToPreviousTreeitem(e,t){const n=e.target||e.currentTarget;let s=this.getVisibleTreeitems(),r=!1;for(var i=0;i<s.length;i++){var a=s[i];if(a===n)break;r=a}if(r)ccPreventEvent(e),this.setFocusToTreeitem(r);else if(t)return"tabshift"}setFocusToNextTreeitem(e,t){const n=e.target||e.currentTarget;for(var s=this.getVisibleTreeitems(),r=!1,i=s.length-1;i>=0;i--){var a=s[i];if(a===n)break;r=a}if(r)this.setFocusToTreeitem(r);else if("tab"===t)return"tab"}setFocusByFirstCharacter(e,t){const n=e.target||e.currentTarget;var s,r,i=-1,a=this.getVisibleTreeitems();for(t=t.toLowerCase(),(s=a.indexOf(n)+1)>=a.length&&(s=0),r=s;r<a.length;r++)if(t===a[r].textContent.trim()[0].toLowerCase()){i=r;break}if(-1===i)for(r=0;r<s;r++)if(t===a[r].textContent.trim()[0].toLowerCase()){i=r;break}i>-1&&this.setFocusToTreeitem(a[i])}}function ccKeyPress(e){try{const t=e.key||e.keyCode,n={Enter:"Enter"===t||13===t,Space:" "===t||"Spacebar"===t||32===t,Escape:"Escape"===t||"Esc"===t||27===t,ArrowUp:"ArrowUp"===t||"Up"===t||38===t,ArrowRight:"ArrowRight"===t||"Right"===t||39===t,ArrowDown:"ArrowDown"===t||"Down"===t||40===t,ArrowLeft:"ArrowLeft"===t||"Left"===t||37===t,Home:"Home"===t||36===t,End:"End"===t||35===t,Character:isNaN(t)&&!!t.match(/^[a-zA-Z]{1}$/),TabShift:"Tab"===t&&e.shiftKey||e.shiftKey&&9===t,Tab:"Tab"===t||9===t,Asterisk:"*"===t||56===t};return Object.keys(n).find(e=>!0===n[e])||""}catch(e){return""}}function ccPreventEvent(e){e.preventDefault(),e.stopPropagation()}window.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".cc-menu.hor");e&&e.forEach(e=>{window[`cc-menu-${e.id}`]=new CCMenuHor(e,"hor")});const t=document.querySelectorAll(".cc-menu.ver");t&&t.forEach(e=>{window[`cc-menu-${e.id}`]=new CCMenuVer(e,"ver")})});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.