replace png with webp

This commit is contained in:
vista-man
2025-03-31 03:02:33 +02:00
parent 9acbc04ae1
commit 470608f6fd
4044 changed files with 53 additions and 0 deletions

View File

@@ -78,9 +78,21 @@
}
}
function preloadImages(pokemons) {
const head = document.querySelector("head");
pokemons.forEach((pokemon) => {
const link = document.createElement("link");
link.rel = "preload";
link.as = "image";
link.href = pokemon.image_url;
head.appendChild(link);
});
}
function displayPokemons(pokemons) {
console.log("Displaying Pokémon data:", pokemons);
listWrapper.innerHTML = "";
preloadImages(pokemons); // Preload images before displaying them
pokemons.forEach((pokemon) => {
const listItem = document.createElement("div");