mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/searchSuggestReveal.js
jdlrobson db29aa53bd Make MobileFrontend dependency a soft one
This extends the work in Ie29a1eb7746d56f7d8c99b74e5e3c213c30fdcf2

Bug: T171000
Change-Id: Ib125e1bdaace1893804892909c27a9f328445835
2020-01-17 14:02:23 -08:00

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;
}
} );
};