Add low-resolution image support for Pokémon data retrieval

This commit is contained in:
vista-man
2025-03-25 16:47:58 +01:00
parent 92910ea839
commit 2fa31886a7
2024 changed files with 19 additions and 6 deletions

View File

@@ -70,7 +70,9 @@
</header>
<section class="pokemon-list">
<div class="container">
<div class="list-wrapper"></div>
<div class="list-wrapper">
<img data-src-low="${pokemon.image_url_low}" data-src="${pokemon.image_url}" alt="${pokemon.name}" />
</div>
</div>
<div id="not-found-message">Pokemon not found</div>
</section>

View File

@@ -75,7 +75,7 @@ function displayPokemons(pokemons) {
<p class="caption-fonts">#${pokemon.id}</p>
</div>
<div class="img-wrap">
<img data-src="${pokemon.image_url}" alt="${pokemon.name}" />
<img data-src-low="${pokemon.image_url_low}" data-src="${pokemon.image_url}" alt="${pokemon.name}" />
</div>
<div class="name-wrap">
<p class="body3-fonts">#${pokemon.name}</p>
@@ -121,12 +121,19 @@ function lazyLoadImages() {
}
function preloadImage(img) {
const srcLow = img.getAttribute('data-src-low');
const src = img.getAttribute('data-src');
if (!src) {
if (!srcLow || !src) {
return;
}
console.log("Preloading image:", src);
img.src = src;
console.log("Preloading low-resolution image:", srcLow);
img.src = srcLow;
const highResImg = new Image();
highResImg.src = src;
highResImg.onload = () => {
console.log("Preloading high-resolution image:", src);
img.src = src;
};
}
searchInput.addEventListener("keyup", handleSearch);

BIN
v2/small-images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
v2/small-images/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
v2/small-images/100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
v2/small-images/1000.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
v2/small-images/1001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
v2/small-images/1002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
v2/small-images/1003.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
v2/small-images/1004.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
v2/small-images/1005.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
v2/small-images/1006.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
v2/small-images/1007.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
v2/small-images/1008.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
v2/small-images/1009.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
v2/small-images/101.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
v2/small-images/1010.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/102.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
v2/small-images/103.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
v2/small-images/104.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
v2/small-images/105.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
v2/small-images/106.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
v2/small-images/107.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
v2/small-images/108.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
v2/small-images/109.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
v2/small-images/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
v2/small-images/110.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/111.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
v2/small-images/112.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
v2/small-images/113.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/114.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
v2/small-images/115.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
v2/small-images/116.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/117.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
v2/small-images/118.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
v2/small-images/119.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
v2/small-images/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
v2/small-images/120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
v2/small-images/121.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
v2/small-images/122.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
v2/small-images/123.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
v2/small-images/124.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
v2/small-images/125.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
v2/small-images/126.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
v2/small-images/127.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
v2/small-images/128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
v2/small-images/129.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
v2/small-images/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
v2/small-images/130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
v2/small-images/131.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
v2/small-images/132.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
v2/small-images/133.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/134.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
v2/small-images/135.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/136.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
v2/small-images/137.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
v2/small-images/138.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
v2/small-images/139.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
v2/small-images/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
v2/small-images/140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
v2/small-images/141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
v2/small-images/142.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
v2/small-images/143.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
v2/small-images/144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
v2/small-images/145.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
v2/small-images/146.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
v2/small-images/147.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
v2/small-images/148.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
v2/small-images/149.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
v2/small-images/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
v2/small-images/150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/151.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
v2/small-images/152.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
v2/small-images/153.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
v2/small-images/154.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/155.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/156.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
v2/small-images/157.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/158.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
v2/small-images/159.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
v2/small-images/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
v2/small-images/160.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
v2/small-images/161.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
v2/small-images/162.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
v2/small-images/163.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
v2/small-images/164.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
v2/small-images/165.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
v2/small-images/166.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
v2/small-images/167.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
v2/small-images/168.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/169.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
v2/small-images/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
v2/small-images/170.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
v2/small-images/171.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
v2/small-images/172.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
v2/small-images/173.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
v2/small-images/174.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
v2/small-images/175.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
v2/small-images/176.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
v2/small-images/177.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Some files were not shown because too many files have changed in this diff Show More