mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:24:31 -04: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);
|
localStorage.setItem('auth_provider', provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.loadedSearchData = false;
|
||||||
function showSearch() {
|
function showSearch() {
|
||||||
$('#search').typeahead('val', '');
|
$('#search').typeahead('val', '');
|
||||||
$('#navbar-options').hide();
|
$('#navbar-options').hide();
|
||||||
$('#search-form').show();
|
$('#search-form').show();
|
||||||
|
|
||||||
if (window.hasOwnProperty('loadedSearchData')) {
|
|
||||||
$('#search').focus();
|
$('#search').focus();
|
||||||
} else {
|
|
||||||
|
if (!window.loadedSearchData) {
|
||||||
trackEvent('/activity', '/search');
|
trackEvent('/activity', '/search');
|
||||||
$.get('{{ URL::route('getSearchData') }}', function(data) {
|
$.get('{{ URL::route('getSearchData') }}', function(data) {
|
||||||
window.loadedSearchData = true;
|
|
||||||
|
|
||||||
$('#search').typeahead({
|
$('#search').typeahead({
|
||||||
hint: true,
|
hint: true,
|
||||||
highlight: true,
|
highlight: true,
|
||||||
@ -307,6 +305,7 @@
|
|||||||
).on('typeahead:selected', function(element, datum, name) {
|
).on('typeahead:selected', function(element, datum, name) {
|
||||||
window.location = datum.url;
|
window.location = datum.url;
|
||||||
}).focus();
|
}).focus();
|
||||||
|
window.loadedSearchData = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +321,9 @@
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
$('#search').blur(function(event){
|
$('#search').blur(function(event){
|
||||||
|
if (window.loadedSearchData) {
|
||||||
hideSearch();
|
hideSearch();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isStorageSupported()) {
|
if (isStorageSupported()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user