PageSourceSearch

https://thenortholmepractice.co.uk/lib/js/menutoggle.js?v=18.27

js thenortholmepractice.co.uk collected 2026-10-05 23:50:20 UTC 2,801 bytes, 75 lines download raw bytes

1(function()
2 {
3
4 setTimeout(() =>
5 {
6
7
8document.querySelectorAll('.dropdown-toggle').forEach((dp) => {
9       dp.addEventListener('click', (e) => {
10
11           e.stopPropagation();
12
13           let siblingElement;
14           let clickedElement;
15
16           if (e.target.tagName === 'SPAN') {
17               const parentElement = e.target.parentElement;
18               siblingElement = parentElement.nextElementSibling;
19               clickedElement = e.target.parentElement;
20           } else if (e.target.tagName === 'A') {
21               siblingElement = e.target.nextElementSibling;
22               clickedElement = e.target;
23           } else {
24               console.log('Clicked element is neither SPAN nor A:', e.target.tagName);
25               return;
26           }
27
28           if (!siblingElement || !siblingElement.classList.contains('dropdown-menu')) {
29               console.log('Sibling element is not a dropdown menu.');
30               return;
31           }
32
33           // Remove 'show' class from all dropdown toggles and their dropdown menus
34           document.querySelectorAll('.dropdown-toggle').forEach((toggle) => {
35               if (toggle !== e.target) {
36                   toggle.classList.remove('show');
37                   const dropdownMenu = toggle.nextElementSibling;
38                   if (dropdownMenu && dropdownMenu.classList.contains('dropdown-menu')) {
39                       dropdownMenu.classList.remove('show');
40                   }
41               }
42           });
43
44           // Add 'show' class to the target sibling element if it doesn't already have it
45           if (!siblingElement.classList.contains('show') && clickedElement.getAttribute('aria-expanded')) {
46               siblingElement.classList.add('show');
47           }
48       });
49   });
50
51   // Add an event listener to the document to close dropdowns when clicking outside
52   document.addEventListener('click', () => {
53       document.querySelectorAll('.dropdown-menu.show').forEach((dropdownMenu) => {
54           dropdownMenu.classList.remove('show');
55       });
56   });
57
58// Checking if a dropdown should be closed but remained opened
59 setInterval(() =>
60     {
61         document.querySelectorAll('a[aria-expanded="false"]').forEach((a) => {  a.nextElementSibling.classList.remove("show");  });
62         document.querySelectorAll('a[aria-expanded="false"]').forEach((a) => {  a.nextElementSibling.style = "" ;          });
63         document.querySelectorAll('a[aria-expanded="true"]').forEach((a) =>
64            {
65                  if(!a.nextElementSibling.classList.contains("show"))
66                  {
67                     a.setAttribute('aria-expanded','false');
68                  }
69            });
70     },50)
71
72
73},300)
74
75}())

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.