1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Enable entering search text before results are loaded

This commit is contained in:
Hillel Coren 2016-03-14 10:25:08 +02:00
parent ed7cbf1d2b
commit 9c0eaac6b8

View File

@ -258,18 +258,16 @@
localStorage.setItem('auth_provider', provider);
}
window.loadedSearchData = false;
function showSearch() {
$('#search').typeahead('val', '');
$('#navbar-options').hide();
$('#search-form').show();
if (window.hasOwnProperty('loadedSearchData')) {
$('#search').focus();
} else {
$('#search').focus();
if (!window.loadedSearchData) {
trackEvent('/activity', '/search');
$.get('{{ URL::route('getSearchData') }}', function(data) {
window.loadedSearchData = true;
$('#search').typeahead({
hint: true,
highlight: true,
@ -307,6 +305,7 @@
).on('typeahead:selected', function(element, datum, name) {
window.location = datum.url;
}).focus();
window.loadedSearchData = true;
});
}
}
@ -322,7 +321,9 @@
}, 3000);
$('#search').blur(function(event){
hideSearch();
if (window.loadedSearchData) {
hideSearch();
}
});
if (isStorageSupported()) {