| 1 | const SEARCH_CLASS = 'search-enabled'; |
| 2 | |
| 3 | module.exports = function () { |
| 4 | // eslint-disable-next-line no-jquery/no-global-selector |
| 5 | $( '#searchIcon' ).on( 'click', () => { |
| 6 | // eslint-disable-next-line no-jquery/no-global-selector |
| 7 | const $input = $( '#searchInput' ); |
| 8 | const $body = $( document.body ); |
| 9 | |
| 10 | // eslint-disable-next-line no-jquery/no-sizzle |
| 11 | if ( !$input.is( ':visible' ) ) { |
| 12 | $body.addClass( SEARCH_CLASS ); |
| 13 | $input.trigger( 'focus' ) |
| 14 | .one( 'blur', () => { |
| 15 | $body.removeClass( SEARCH_CLASS ); |
| 16 | } ); |
| 17 | return false; |
| 18 | } |
| 19 | } ); |
| 20 | }; |