HTMLify
looking up chibis
Views: 112 | Author: amar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Looking Up Chibi Archive</title> <style> body{ margin:0; background:#111; color:white; font-family:Arial,sans-serif; } header{ text-align:center; padding:20px; } h1{ margin:0; } #search{ width:min(500px,90%); padding:12px; font-size:16px; border:none; border-radius:10px; } .gallery{ display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:15px; padding:20px; } .card{ background:#1b1b1b; border-radius:12px; overflow:hidden; transition:.2s; } .card:hover{ transform:scale(1.03); } .card img{ width:100%; display:block; aspect-ratio:1/1; object-fit:contain; background:#222; } .name{ padding:10px; text-align:center; word-break:break-word; font-size:13px; } </style> </head> <body> <header> <h1>Looking Up Chibi Archive</h1> <p id="count">Loading...</p> <input id="search" placeholder="Search character..."> </header> <div class="gallery" id="gallery"></div> <script> const JSON_URL = "https://htmlify.me/amar/chibilookingup.json"; let allImages = []; fetch(JSON_URL) .then(r => r.json()) .then(data => { allImages = data; document.getElementById("count").textContent = `${data.length} images`; render(data); }); function render(images){ const gallery = document.getElementById("gallery"); gallery.innerHTML = images.map(url => { const filename = decodeURIComponent( url.split("/").pop() ); return ` <div class="card"> <a href="${url}" target="_blank"> <img loading="lazy" src="${url}"> </a> <div class="name">${filename}</div> </div>`; }).join(""); } document.getElementById("search") .addEventListener("input", e => { const term = e.target.value.toLowerCase(); const filtered = allImages.filter(url => url.toLowerCase().includes(term) ); render(filtered); }); </script> </body> </html> |