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:
parent
ed7cbf1d2b
commit
9c0eaac6b8
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user