Refined search hot key

This commit is contained in:
Hillel Coren 2016-02-19 11:41:03 +02:00
parent 1529b59235
commit dd9805e5b4

View File

@ -260,8 +260,9 @@
function showSearch() { function showSearch() {
$('#search').typeahead('setQuery', ''); $('#search').typeahead('setQuery', '');
$('#search-form').show();
$('#navbar-options').hide(); $('#navbar-options').hide();
$('#search-form').show();
if (window.hasOwnProperty('searchData')) { if (window.hasOwnProperty('searchData')) {
$('#search').focus(); $('#search').focus();
} else { } else {
@ -299,7 +300,7 @@
$(".alert-hide").fadeOut(); $(".alert-hide").fadeOut();
}, 3000); }, 3000);
$('#search').blur(function(){ $('#search').blur(function(event){
hideSearch(); hideSearch();
}); });
@ -354,6 +355,7 @@
// Focus the search input if the user clicks forward slash // Focus the search input if the user clicks forward slash
$('body').keypress(function(event) { $('body').keypress(function(event) {
if (event.which == 47) { if (event.which == 47) {
event.preventDefault();
showSearch(); showSearch();
} }
}); });