mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-22 10:33:24 +00:00
a6ab8d6da3
Change-Id: I52b2feacd6216e99e04f193ba963e897b3e1a771
21 lines
559 B
JavaScript
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;
|
|
}
|
|
} );
|
|
};
|