PageSourceSearch

https://pedrodebruyckere.blog/_static/??wp-content/plugins/coblock…/themes/able/js/small-menu.js?m=1719276502

js pedrodebruyckere.blog collected 2026-10-06 04:42:15 UTC 2,600 bytes, 73 lines download raw bytes

1(()=>{const e=document.querySelectorAll(".coblocks-animate");if("IntersectionObserver"in window){const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add(e.target.dataset.coblocksAnimation),t.unobserve(e.target))}))}),{threshold:[.15]});e.forEach((e=>{t.observe(e)}))}else e.forEach((e=>{e.classList.remove("coblocks-animate"),delete e.dataset.coblocksAnimation}))})();;
2/**
3 * Handles toggling the main navigation menu for small screens.
4 */
5jQuery( document ).ready( function( $ ) {
6	var $masthead = $( '#masthead' ),
7	    timeout = false;
8
9	$.fn.smallMenu = function() {
10		$masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
11		$masthead.find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
12
13		$( '.menu-toggle' ).unbind( 'click' ).click( function() {
14			$masthead.find( '.menu' ).toggle();
15			$( this ).toggleClass( 'toggled-on' );
16		} );
17	};
18
19	// Check viewport width on first load.
20	if ( $( window ).width() < 600 )
21		$.fn.smallMenu();
22
23	// Check viewport width when user resizes the browser window.
24	$( window ).resize( function() {
25		var browserWidth = $( window ).width();
26
27		if ( false !== timeout )
28			clearTimeout( timeout );
29
30		timeout = setTimeout( function() {
31			if ( browserWidth < 600 ) {
32				$.fn.smallMenu();
33			} else {
34				$masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
35				$masthead.find( '.site-navigation h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
36				$masthead.find( '.menu' ).removeAttr( 'style' );
37			}
38		}, 200 );
39	} );
40
41	var container = $( '.site-navigation' );
42
43	// Fix child menus for touch devices.
44	function fixMenuTouchTaps( container ) {
45		var touchStartFn,
46		    parentLink = container.find( '.menu-item-has-children > a, .page_item_has_children > a' );
47
48		if ( 'ontouchstart' in window ) {
49			touchStartFn = function( e ) {
50				var menuItem = this.parentNode;
51
52				if ( ! menuItem.classList.contains( 'focus' ) ) {
53					e.preventDefault();
54					for( var i = 0; i < menuItem.parentNode.children.length; ++i ) {
55						if ( menuItem === menuItem.parentNode.children[i] ) {
56							continue;
57						}
58						menuItem.parentNode.children[i].classList.remove( 'focus' );
59					}
60					menuItem.classList.add( 'focus' );
61				} else {
62					menuItem.classList.remove( 'focus' );
63				}
64			};
65
66			for ( var i = 0; i < parentLink.length; ++i ) {
67				parentLink[i].addEventListener( 'touchstart', touchStartFn, false )
68			}
69		}
70	}
71
72	fixMenuTouchTaps( container );
73} );;

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.