2024-03-24 20:53:43 +00:00
|
|
|
const SEARCH_CLASS = 'search-enabled';
|
2019-12-18 21:15:26 +00:00
|
|
|
|
|
|
|
module.exports = function () {
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
$( '#searchIcon' ).on( 'click', function () {
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
2024-03-24 20:53:43 +00:00
|
|
|
const $input = $( '#searchInput' );
|
|
|
|
const $body = $( document.body );
|
2019-12-18 21:15:26 +00:00
|
|
|
|
|
|
|
// eslint-disable-next-line no-jquery/no-sizzle
|
|
|
|
if ( !$input.is( ':visible' ) ) {
|
|
|
|
$body.addClass( SEARCH_CLASS );
|
|
|
|
$input.trigger( 'focus' )
|
|
|
|
.one( 'blur', function () {
|
|
|
|
$body.removeClass( SEARCH_CLASS );
|
|
|
|
} );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
};
|