mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 01:06:31 +00:00
21 lines
562 B
JavaScript
21 lines
562 B
JavaScript
|
var 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
|
||
|
var $input = $( '#searchInput' ),
|
||
|
$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;
|
||
|
}
|
||
|
} );
|
||
|
};
|