mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 09:26:37 +08:00
Add timeout to search
This commit is contained in:
parent
1ccabf62b3
commit
03b81400a9
1 changed files with 7 additions and 1 deletions
|
@ -55,9 +55,15 @@ function setDefaultViewState() {
|
||||||
|
|
||||||
// Apply AJAX callbacks onto the search box
|
// Apply AJAX callbacks onto the search box
|
||||||
function applySearchCallback() {
|
function applySearchCallback() {
|
||||||
|
var timeout;
|
||||||
// Submit form on every input in the search box
|
// Submit form on every input in the search box
|
||||||
$('input[name="key"]').off('input').on('input', function() {
|
$('input[name="key"]').off('input').on('input', function() {
|
||||||
$('form.protocols-search-bar').submit();
|
if (timeout)
|
||||||
|
clearTimeout(timeout)
|
||||||
|
|
||||||
|
timeout = setTimeout(function() {
|
||||||
|
$('form.protocols-search-bar').submit();
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Submit form when clicking on sort buttons
|
// Submit form when clicking on sort buttons
|
||||||
|
|
Loading…
Reference in a new issue