|
@@ -1,4 +1,15 @@
|
|
-const getSprite = pokemon => `https://img.pokemondb.net/sprites/sword-shield/icon/${pokemon}.png`
|
|
|
|
|
|
+const stripForm = ["flabebe", "floette", "florges", "vivillon", "basculin", "furfrou", "magearna"];
|
|
|
|
+
|
|
|
|
+const getSprite = pokemon => {
|
|
|
|
+ pokemon = pokemon
|
|
|
|
+ .replace("-alola", "-alolan")
|
|
|
|
+ .replace("-galar", "-galarian")
|
|
|
|
+ .replace("darmanitan-galarian", "darmanitan-galarian-standard");
|
|
|
|
+ if (stripForm.find(s => pokemon.includes(s))) {
|
|
|
|
+ pokemon = pokemon.replace(/-.*$/, "");
|
|
|
|
+ }
|
|
|
|
+ return `https://img.pokemondb.net/sprites/sword-shield/icon/${pokemon}.png`;
|
|
|
|
+}
|
|
|
|
|
|
const titleCase = s => s.charAt(0).toUpperCase() + s.substr(1);
|
|
const titleCase = s => s.charAt(0).toUpperCase() + s.substr(1);
|
|
|
|
|
|
@@ -112,7 +123,8 @@ const onUpdate = () => {
|
|
// lookup by pokemon too
|
|
// lookup by pokemon too
|
|
const searchList = document.getElementById("search-list");
|
|
const searchList = document.getElementById("search-list");
|
|
searchList.innerHTML = '';
|
|
searchList.innerHTML = '';
|
|
- pokemonLookup.search(pokemonName, { limit: 10 })
|
|
|
|
|
|
+ pokemonLookup
|
|
|
|
+ .search(pokemonName, { limit: 15 })
|
|
.map(({ item }) => ({ ...item, score: totalScorer(item) }))
|
|
.map(({ item }) => ({ ...item, score: totalScorer(item) }))
|
|
.forEach(item => {
|
|
.forEach(item => {
|
|
const li = document.createElement("li");
|
|
const li = document.createElement("li");
|