Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ignore] refactor query.js for readability
- define file global variables at the beginning
- add comment to fix custom debounce implementation
  • Loading branch information
line-o committed Jun 20, 2021
commit 69c701b98ffd28430e4572d855a43d09bb2d7265
13 changes: 8 additions & 5 deletions src/main/xar-resources/resources/scripts/query.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
$(document).on("ready", function() {
const loginDialog = $("#loginDialog");
let timeout = 0;

loginDialog.modal({
show: false
});

function search() {
const data = $("#fun-query-form").serialize();
Expand Down Expand Up @@ -49,11 +55,6 @@ $(document).on("ready", function() {
});
}

let timeout = 0;
const loginDialog = $("#loginDialog");
loginDialog.modal({
show: false
});
$("form", loginDialog).on("submit", function(ev) {
const params = $(this).serialize();
$.ajax({
Expand All @@ -73,6 +74,8 @@ $(document).on("ready", function() {
$("#f-load-indicator").hide();
$("#query-field").on("keyup", function() {
const val = $(this).val();
// fixme search request is delayed by 300ms
// replace with proper debounce
if (val.length > 3) {
if (timeout)
clearTimeout(timeout);
Expand Down