diff --git a/assets/js/scripts.min.js b/assets/js/scripts.min.js index 9437b85..709400f 100644 --- a/assets/js/scripts.min.js +++ b/assets/js/scripts.min.js @@ -364,7 +364,16 @@ function yabsModalView(hostname, id) { }); } -$('#searchInput').keyup(function() { +//https://stackoverflow.com/a/1909508 +function delay(fn, ms) { + let timer = 0 + return function(...args) { + clearTimeout(timer) + timer = setTimeout(fn.bind(this, ...args), ms || 0) + } +} + +$('#searchInput').keyup(delay(function (e) { var search_term = this.value; $('#searchDivBody').empty(); $.ajax({ @@ -375,4 +384,4 @@ $('#searchInput').keyup(function() { $('#searchDivBody').append(result); } }); -}); \ No newline at end of file +}, 500)); \ No newline at end of file