PageSourceSearch

https://ytn.fi/app/themes/ytn-block-theme/assets/scripts/mobileNav.js

js ytn.fi collected 2026-10-02 11:53:08 UTC 1,505 bytes, 37 lines download raw bytes

1export function handleMobileNav() {
2  const toggleButton = document.querySelector('.wp-block-navigation__responsive-container-open');
3  const navContainer = document.querySelector('.wp-block-navigation__responsive-container');
4
5  if (toggleButton && navContainer) {
6    toggleButton.addEventListener('click', () => {
7      navContainer.classList.toggle('is-menu-open');
8      navContainer.classList.toggle('has-modal-open');
9    });
10  }
11  if (window.innerWidth <= 599) {
12    document.querySelectorAll('button.wp-block-navigation__submenu-icon.wp-block-navigation-submenu__toggle').forEach(button => {
13      const svg = button.querySelector('svg');
14      if (svg) svg.remove();
15    });
16  }
17
18  document.querySelectorAll('.wp-block-navigation-item.has-child > a.wp-block-navigation-item__content').forEach(link => {
19    const toggle = document.createElement('span');
20    toggle.className = 'mobile-submenu-toggle';
21    toggle.textContent = '▼';
22    link.appendChild(toggle);
23  });
24
25  document.addEventListener('click', e => {
26    if (e.target.classList.contains('mobile-submenu-toggle')) {
27      e.preventDefault();
28  
29      const parentItem = e.target.closest('.wp-block-navigation-item.wp-block-navigation-submenu');
30      const submenuContainer = parentItem?.querySelector('.wp-block-navigation__submenu-container.wp-block-navigation-submenu');
31  
32      if (submenuContainer) {
33        submenuContainer.style.display = submenuContainer.style.display === 'block' ? 'none' : 'block';
34      }
35    }
36  });
37}

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.