mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/searchSuggestReveal.js
Ed Sanders a6ab8d6da3 Prefer arrow callbacks (ESLint autofix)
Change-Id: I52b2feacd6216e99e04f193ba963e897b3e1a771
2024-06-04 08:01:54 -07:00

21 lines
559 B
JavaScript

const SEARCH_CLASS = 'search-enabled';
module.exports = function () {
// eslint-disable-next-line no-jquery/no-global-selector
$( '#searchIcon' ).on( 'click', () => {
// eslint-disable-next-line no-jquery/no-global-selector
const $input = $( '#searchInput' );
const $body = $( document.body );
// eslint-disable-next-line no-jquery/no-sizzle
if ( !$input.is( ':visible' ) ) {
$body.addClass( SEARCH_CLASS );
$input.trigger( 'focus' )
.one( 'blur', () => {
$body.removeClass( SEARCH_CLASS );
} );
return false;
}
} );
};