|
@@ -156,6 +156,12 @@ const onUpdate = (event) => {
|
|
|
const pokemonName = document.getElementById("pokemon-name")?.value?.toLowerCase() ?? "";
|
|
|
const colorInput = "#" + (document.getElementById("color-input")?.value?.replace("#", "") ?? "FFFFFF");
|
|
|
|
|
|
+ // Clear pokemon search
|
|
|
+ if (pokemonName.length === 0) {
|
|
|
+ const searchList = document.getElementById("search-list");
|
|
|
+ searchList.innerHTML = '';
|
|
|
+ }
|
|
|
+
|
|
|
// Check if parameters have changed
|
|
|
const newParams = paramsChanged(includeX, normQY, closeCoeff, useRGB, numPoke, colorInput);
|
|
|
|
|
@@ -225,10 +231,10 @@ const onUpdate = (event) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Lookup by name
|
|
|
- const searchList = document.getElementById("search-list");
|
|
|
- searchList.innerHTML = '';
|
|
|
- if (pokemonName.length > 0 && (lastPkmnSearch !== pokemonName || newParams)) {
|
|
|
+ // Lookup by name
|
|
|
+ if (lastPkmnSearch !== pokemonName || newParams) {
|
|
|
+ const searchList = document.getElementById("search-list");
|
|
|
+ searchList.innerHTML = '';
|
|
|
pokemonLookup
|
|
|
.search(pokemonName, { limit: 10 })
|
|
|
// If scoring is impossible, totalScorer will just be identity
|