PageSourceSearch

https://librivox.org/js/catalog/small-menu.js

js librivox.org collected 2026-09-27 21:08:27 UTC 1,175 bytes, 36 lines download raw bytes

1jQuery( document ).ready( function( $ ) {
2	var $masthead = $( '.site-header' ),
3	    timeout = false;
4
5	$.fn.smallMenu = function() {
6		$masthead.find( '.sub-menu' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
7		$masthead.find( '.sub-menu h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
8
9		$( '.menu-toggle' ).unbind( 'click' ).click( function() {
10			$masthead.find( '.sub-menu-list' ).toggle();
11			$( this ).toggleClass( 'toggled-on' );
12		} );
13	};
14
15	// Check viewport width on first load.
16	if ( $( window ).width() < 660 )
17		$.fn.smallMenu();
18
19	// Check viewport width when user resizes the browser window.
20	$( window ).resize( function() {
21		var browserWidth = $( window ).width();
22
23		if ( false !== timeout )
24			clearTimeout( timeout );
25
26		timeout = setTimeout( function() {
27			if ( browserWidth < 660 ) {
28				$.fn.smallMenu();
29			} else {
30				$masthead.find( '.sub-menu' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
31				$masthead.find( '.sub-menu h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
32				$masthead.find( '.sub-menu-list' ).removeAttr( 'style' );
33			}
34		}, 200 );
35	} );
36} );

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.