mirror of
https://github.com/wah-su/mstickers.git
synced 2025-05-07 13:29:35 +05:00
REFACTOR: Generate Static Pages instead of ?id query param for sticker pack
This commit is contained in:
parent
5cb32a8681
commit
dfcddfc0cd
21 changed files with 2074 additions and 473 deletions
22
static/RenderImages.js
Normal file
22
static/RenderImages.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const images = document.querySelectorAll("[data-image-id]");
|
||||
|
||||
images.forEach((image) => {
|
||||
|
||||
const spinner = document.querySelector(`[data-spinner-id="${image.getAttribute("data-image-id")}"]`)
|
||||
console.log(image)
|
||||
console.log(spinner)
|
||||
|
||||
if (image.height > 0) {
|
||||
image.classList.remove("hidden");
|
||||
spinner.classList.add("hidden");
|
||||
return
|
||||
}
|
||||
|
||||
image.addEventListener("load", () => {
|
||||
console.log("image " + image.getAttribute("data-image-id") + " loaded");
|
||||
image.classList.remove("hidden");
|
||||
spinner.classList.add("hidden");
|
||||
image.removeEventListener("load", this);
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue