PageSourceSearch

http://www.pingvindykk.no/wp-content/themes/spacious/js/navigation.js?ver=6.1.14

js pingvindykk.no collected 2026-10-01 13:02:24 UTC 2,302 bytes, 75 lines download raw bytes

1/**
2 * navigation.js
3 *
4 * Handles toggling the navigation menu for small screens.
5 */
6( function() {
7	var container, button, menu;
8
9	container = document.getElementById( 'site-navigation' );
10	if ( ! container ) {
11		return;
12	}
13
14	button = container.getElementsByTagName( 'h3' )[0];
15	if ( 'undefined' === typeof button ) {
16		return;
17	}
18
19	menu = container.getElementsByTagName( 'ul' )[0];
20
21	// Hide menu toggle button if menu is empty and return early.
22	if ( 'undefined' === typeof menu ) {
23		button.style.display = 'none';
24		return;
25	}
26
27	if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
28		menu.className += ' nav-menu';
29	}
30
31	button.onclick = function() {
32		if ( -1 !== container.className.indexOf( 'main-small-navigation' ) ) {
33			container.className = container.className.replace( 'main-small-navigation', 'main-navigation' );
34		} else {
35			container.className = container.className.replace( 'main-navigation', 'main-small-navigation' );
36		}
37	};
38} )();
39
40// Show Submenu on click on touch enabled deviced
41( function () {
42    var container;
43    container = document.getElementById( 'site-navigation' );
44
45    /**
46     * Toggles `focus` class to allow submenu access on tablets.
47     */
48    ( function( container ) {
49        var touchStartFn, i,
50            parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
51
52        if ( 'ontouchstart' in window ) {
53            touchStartFn = function( e ) {
54                var menuItem = this.parentNode, i;
55
56                if ( ! menuItem.classList.contains( 'focus' ) ) {
57                    e.preventDefault();
58                    for ( i = 0; i < menuItem.parentNode.children.length; ++i ) {
59                        if ( menuItem === menuItem.parentNode.children[i] ) {
60                            continue;
61                        }
62                        menuItem.parentNode.children[i].classList.remove( 'focus' );
63                    }
64                    menuItem.classList.add( 'focus' );
65                } else {
66                    menuItem.classList.remove( 'focus' );
67                }
68            };
69
70            for ( i = 0; i < parentLink.length; ++i ) {
71                parentLink[i].addEventListener( 'touchstart', touchStartFn, false );
72            }
73        }
74    }( container ) );
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.