1document.addEventListener("DOMContentLoaded", () => { 2 const items = document.querySelectorAll(".item-has-link"); 3 4 items?.forEach((item) => { 5 item.addEventListener("click", () => { 6 const postLink = item.querySelector("a")?.getAttribute("href"); 7 8 if (postLink) window.location.href = postLink; 9 }); 10 }); 11 12 const offconvas = document.querySelector("#offcanvas"); 13 const mobilePanelCloseTrigger = document.querySelector("#offcanvas button"); 14 const navDesktop = document.querySelector("#header [data-device='desktop'] nav"); 15 const menuItems = document.querySelectorAll("#header [data-device='desktop'] nav li"); 16 const hamburgerOpenCloseTrigger = document.querySelector("#header [data-device='mobile'] button[data-toggle-panel='#offcanvas']"); 17 18 let previousIsMobile = true; 19 20 window.addEventListener("resize", () => { 21 const IsMobile = window.innerWidth < 1000; 22 23 if (IsMobile !== previousIsMobile){ 24 previousIsMobile = IsMobile; 25 26 navDesktop?.setAttribute("data-responsive", IsMobile ? "no" : "yes"); 27 28 if (offconvas?.classList.contains("active")) mobilePanelCloseTrigger?.click(); 29 30 menuItems?.forEach((item) => { 31 const isSubmenu = !!item.closest("ul > li > ul"); 32 33 item.classList.remove("ct-active2"); 34 item.classList.toggle("animated-submenu-block", IsMobile ? isSubmenu : !isSubmenu); 35 item.classList.toggle("animated-submenu-inline", IsMobile ? !isSubmenu : isSubmenu); 36 }); 37 } 38 }); 39 40 const MobilePanel = (IsOpening = false) => { 41 navDesktop?.setAttribute("mobile-menu", IsOpening); 42 } 43 44 menuItems?.forEach((item) => { 45 item.addEventListener("click", (event) => { 46 if (window.innerWidth < 1000) { 47 event.preventDefault(); 48 event.stopPropagation(); 49 50 const haveSubmenu = item.querySelector("ul"); 51 52 if (item.classList.contains("ct-active2") || !haveSubmenu) { 53 const link = item.querySelector("a.ct-menu-link"); 54 55 if (link?.href.trim()) window.location.href = link.href; 56 } 57 58 menuItems.forEach((otherItem) => { 59 if (!otherItem.contains(item)) otherItem.classList.remove("ct-active2"); 60 }); 61 62 item.classList.toggle("ct-active2"); 63 item.classList.remove("animated-submenu-block", "animated-submenu-inline"); 64 65 adjustSocialPosition(); 66 } 67 }); 68 }); 69 70 const toggleMobilePanel = () => { 71 const isOpeningOrClosing = !offconvas?.classList.contains("active"); 72 if (!isOpeningOrClosing) document.body.dispatchEvent(new KeyboardEvent("keyup", { key: "Escape", keyCode: 27, code: "Escape", bubbles: true })); 73 MobilePanel(isOpeningOrClosing); 74 }; 75 hamburgerOpenCloseTrigger?.addEventListener("click", toggleMobilePanel); 76 mobilePanelCloseTrigger?.addEventListener("click", toggleMobilePanel); 77 78 document.addEventListener("click", function (event) { 79 const IsClosing = document.body.hasAttribute("data-panel") && !navDesktop?.contains(event.target) 80 && !(document.querySelector(".ct-panel-inner")?.contains(event.target) || document.querySelector("#header [data-device='mobile']")?.contains(event.target)); 81 if (IsClosing) MobilePanel(); 82 }); 83 84 const originalSetTimeout = window.setTimeout; 85 86 window.setTimeout = function(callback, delay) { 87 const clickEventTimeoutStr = callback.toString(); 88 89 if (clickEventTimeoutStr?.includes("select2-container") && clickEventTimeoutStr?.includes("data-panel")) { 90 return; 91 } 92 93 return originalSetTimeout(callback, delay); 94 }; 95 96 document.body.addEventListener("keyup", function (event) { 97 const IsClosing = event.key === "Escape" && document.body.hasAttribute("data-panel"); 98 if (IsClosing) MobilePanel(); 99 }); 100 101 const currentItem = document.querySelector("#header .ct-container .current-menu-item"); 102 currentItem?.classList.remove("current-menu-item"); 103});
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.