Skip to content

Commit

Permalink
Fixing issue #21
Browse files Browse the repository at this point in the history
search query isn't sent to the server now until AFTER the list of instances is returned.
  • Loading branch information
marsara9 committed Jul 4, 2023
1 parent 714bccc commit 86ac329
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 44 deletions.
18 changes: 1 addition & 17 deletions ui/main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@


$(document).ready(function() {
$("#submit").click(function() {
onSearch();
});

$("#search").keydown(function(e){
if(e.keyCode == 13) {
onSearch();
}
});

$("#instance-select").on("change", function() {
preferred_instance = this.value;
setCookie("preferred-instance", preferred_instance);
});

getVersion();
populateInstances();

});
29 changes: 2 additions & 27 deletions ui/results/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,31 +192,6 @@ function isImage(url) {
return /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url);
}

$(document).ready(function() {

if (!checkQueryParameters()) {
window.location = "/";
return;
}

$("#submit").click(function() {
onSearch();
});

$("#search").keydown(function(e){
if(e.keyCode == 13) {
onSearch();
}
});


$("#instance-select").on("change", function() {
preferred_instance = this.value;
setCookie("preferred-instance", preferred_instance);
});

getVersion();
populateInstances();

function onReady() {
query(window.location.search);
});
}
32 changes: 32 additions & 0 deletions ui/shared/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,35 @@ function getVersion() {
$("#version").text(result.version);
});
}

function initializeUI() {
$("#submit").click(function() {
onSearch();
});

$("#search").keydown(function(e){
if(e.keyCode == 13) {
onSearch();
}
});

$("#instance-select").on("change", function() {
preferred_instance = this.value;
setCookie("preferred-instance", preferred_instance, 3652);
});
}

function populateInitialFields() {
getVersion();
populateInstances();
}

$(document).ready(function() {
initializeUI();

populateInitialFields();

if(onReady) {
onReady();
}
});

0 comments on commit 86ac329

Please sign in to comment.