PageSourceSearch

https://cmief.ca/wp-content/themes/adnetframework/js/header.js

js cmief.ca collected 2026-10-04 02:39:57 UTC 3,382 bytes, 102 lines download raw bytes

1window.addEventListener("load", () => {
2
3	/*
4	header - mobile
5	*/
6	let modal = document.getElementById("modal-1"); // navigation modal
7	let modalContent = document.getElementById("modal-1-content"); // the modal's content
8
9	/* logo
10	let mobileLogoLink = document.createElement("a"); // create a link node
11	mobileLogoLink.href = "/"; // link to home
12	mobileLogoLink.rel = "home" // rel
13	mobileLogoLink.style.setProperty("width", "100%"); // make it visible
14
15	let mobileLogo = document.createElement("img"); // create an image node
16	mobileLogo.src = "https://adnet-child-themes.s3.ca-central-1.amazonaws.com/media/2023/11/logo_black.svg"; // logo
17	mobileLogo.classList.add("mobile-logo"); // add a custom class for css styling
18	mobileLogo.style.setProperty("display", "none"); // hide by default
19
20	mobileLogoLink.appendChild(mobileLogo); // append logo to link node
21	modalContent.appendChild(mobileLogoLink); // append link to modal
22	*/
23
24	// submenus
25	function handleSubmenuToggle(menuItems) {
26
27		menuItems.forEach(menuItem => {
28				let submenuContainers = menuItem.querySelectorAll(":scope > .wp-block-navigation__submenu-container");
29				menuItem.addEventListener("click", function (event) {
30				event.stopPropagation();
31				submenuContainers.forEach(submenu => {
32						submenu.classList.toggle("is-submenu-open");
33				});
34				submenuContainers.forEach(submenu => {
35						let submenuParents = submenu.querySelectorAll(":scope > .wp-block-navigation-item.has-child");
36						handleSubmenuToggle(submenuParents);
37				});
38				});
39		});
40	}
41	
42	let submenuParents = document.querySelectorAll(".wp-block-navigation__container > .wp-block-navigation-item.has-child");
43	handleSubmenuToggle(submenuParents);
44	
45	/*
46	sticky
47	*/
48
49	// primary
50	if (document.querySelector(".headerPrimary") ?? false) {
51
52		let headerPrimary = document.getElementsByClassName("headerPrimary");
53		let headerPrimaryImage = document.querySelector('.wp-block-site-logo a img');
54
55		window.addEventListener("scroll", () => {
56
57			if(headerPrimary ?? false) {
58
59				let headerPrimaryTop = headerPrimary[0].offsetTop;
60	
61				if (window.scrollY > headerPrimaryTop ) {
62	
63					headerPrimary[0].classList.add("sticky");
64					// headerImage.src = 'https://adnet-child-themes.s3.ca-central-1.amazonaws.com/media/2023/11/logo_black.svg';
65		
66				} else {
67		
68					headerPrimary[0].classList.remove("sticky");
69					// headerImage.src = 'https://adnet-child-themes.s3.ca-central-1.amazonaws.com/media/2023/11/logo.svg';
70				}
71	
72			}
73		});	
74	}
75
76	// secondary
77	if (document.querySelector(".headerSecondary") ?? false) {
78
79		let headerSecondary = document.getElementsByClassName("headerSecondary");
80		let headerSecondaryImage = document.querySelector('.wp-block-site-logo a img');
81
82		window.addEventListener("scroll", () => {
83
84			let headerSecondaryTop = headerSecondary[0].offsetTop;
85
86			if(headerSecondary ?? false) {
87	
88				if (window.scrollY > headerSecondaryTop ) {
89	
90					headerSecondary[0].classList.add("sticky");
91					// headerImage.src = 'https://adnet-child-themes.s3.ca-central-1.amazonaws.com/media/2023/11/logo_black.svg';
92		
93				} else {
94		
95					headerSecondary[0].classList.remove("sticky");
96					// headerImage.src = 'https://adnet-child-themes.s3.ca-central-1.amazonaws.com/media/2023/11/logo.svg';
97				}
98	
99			}
100		});	
101	}
102});

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.