1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-20 17:41:55 +02:00

Better club search bar

This commit is contained in:
Yohann D'ANELLO
2020-06-21 22:27:32 +02:00
parent b46854e479
commit ac5041f3ec
4 changed files with 51 additions and 41 deletions

View File

@ -25,6 +25,8 @@
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
var timer_on = false;
var timer;
function reloadTable() {
let pattern = searchbar_obj.val();
@ -33,17 +35,19 @@
return;
$("#user_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
}
searchbar_obj.keyup(reloadTable);
searchbar_obj.keyup(function() {
if (timer_on)
clearTimeout(timer);
timer_on = true;
setTimeout(reloadTable, 0);
});
function init() {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
timer_on = false;
});
}