HTMLify
Sticker Wall
Views: 189 | Author: sticker-archive
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <script> fetch("./stickers.json") .then(res => res.json()) .then(data => { // shuffle for (let i = data.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [data[i], data[j]] = [data[j], data[i]]; } // adding data.forEach(name => { const a = document.createElement("a"); a.setAttribute("href", "stickers/" + name); a.setAttribute("target", "_blank"); const img = document.createElement("img"); img.src = "stickers/" + name; img.loading = "lazy"; img.decoding = "async"; a.appendChild(img); document.body.appendChild(a); }); }); </script> |