mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/searchSuggestReveal.js
Fomafix effd4fe133 Use eslint rule "no-var": "error" and replace all var
Change-Id: I67acf88e1b8de55054248d7cf8ca622d5772ea6f
2024-03-29 07:40:22 +00:00

21 lines
571 B
JavaScript

const SEARCH_CLASS = 'search-enabled';
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
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', function () {
$body.removeClass( SEARCH_CLASS );
} );
return false;
}
} );
};