Skip to content

Commit

Permalink
Improved homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Musheer360 committed Oct 26, 2024
1 parent 8c0e6ed commit f67fa33
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,30 +484,6 @@ <h3>Combine Multiple Parameters</h3>

let params = new URLSearchParams();

// Handle length parameters
const lengthInputs =
container.querySelectorAll(".param-input");
if (lengthInputs.length >= 2) {
// For the range-only endpoint (2 inputs)
if (lengthInputs.length === 2) {
const minLength = lengthInputs[0].value.trim();
const maxLength = lengthInputs[1].value.trim();
if (minLength)
params.append("minLength", minLength);
if (maxLength)
params.append("maxLength", maxLength);
}
// For the combined parameters endpoint (5 inputs)
else if (lengthInputs.length === 5) {
const minLength = lengthInputs[3].value.trim();
const maxLength = lengthInputs[4].value.trim();
if (minLength)
params.append("minLength", minLength);
if (maxLength)
params.append("maxLength", maxLength);
}
}

// Handle count parameter
const countInput =
container.querySelector(".count-input");
Expand All @@ -528,6 +504,19 @@ <h3>Combine Multiple Parameters</h3>
params.append("authors", authorInput.value.trim());
}

// Handle length parameters - simplified logic matching the range section
const lengthInputs = container.querySelectorAll(
".param-input:not(.count-input)",
);
if (lengthInputs.length >= 2) {
const minLength = lengthInputs[0].value.trim();
const maxLength = lengthInputs[1].value.trim();
if (minLength)
params.append("minLength", minLength);
if (maxLength)
params.append("maxLength", maxLength);
}

const endpoint = button.dataset.endpoint;
const url = `${endpoint}${params.toString() ? "?" + params.toString() : ""}`;

Expand Down

0 comments on commit f67fa33

Please sign in to comment.