1/* global screen_reader_text */ 2( function( $ ) { 3 4 /** 5 * A function to add classes to body depending on window width. 6 */ 7 function body_class() { 8 9 window_width = $( window ).width(); 10 $( 'body' ).removeClass( 'small-screen medium-screen large-screen' ); 11 if ( window_width >= 1020 ) { 12 $( 'body' ).addClass( 'small-screen medium-screen large-screen' ); 13 } else if ( window_width >= 768 ) { 14 $( 'body' ).addClass( 'small-screen medium-screen' ); 15 } else if ( window_width >= 600 ) { 16 $( 'body' ).addClass( 'small-screen' ); 17 } 18 19 } 20 21 $( window ).load( function() { 22 23 body_class(); 24 25 /* Add dropdown toggle to Custom Menus Widget items */ 26 $( '.widget_nav_menu ul:not([id^="menu-social"]) .page_item_has_children > a, .widget_nav_menu ul:not([id^="menu-social"]) .menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screen_reader_text.expand + '</button>' ); 27 28 /* Toggle child menu items */ 29 $( '.dropdown-toggle' ).click( function( e ) { 30 e.preventDefault(); 31 $( this ).toggleClass( 'toggle-on' ); 32 $( this ).prev( 'a' ).toggleClass( 'toggle-on' ); 33 $( this ).next( '.children, .sub-menu' ).toggleClass( 'toggle-on' ); 34 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 35 $( this ).html( $( this ).html() === screen_reader_text.expand ? screen_reader_text.collapse : screen_reader_text.expand ) 36 } ); 37 38 } ).resize( body_class ); 39 40} )( jQuery );
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.