42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
const taped = Array.from(document.body.getElementsByClassName("taped"));
|
|
for (let i = 0; i < taped.length; i++) {
|
|
const val0 = Math.floor(15 * Math.random());
|
|
const val1 = Math.floor(15 * Math.random());
|
|
taped[i].style.setProperty(
|
|
"--washi-url-0",
|
|
`url(/assets/images/washi/${val0}.png)`,
|
|
);
|
|
taped[i].style.setProperty(
|
|
"--washi-url-1",
|
|
`url(/assets/images/washi/${val1}.png)`,
|
|
);
|
|
}
|
|
|
|
const gallery = Array.from(document.body.getElementsByClassName("gallery-3"));
|
|
for (let i = 0; i < gallery.length; i++) {
|
|
const children = Array.from(gallery[i].children);
|
|
for (let i = 0; i < children.length; i++) {
|
|
const child = children[i];
|
|
const val0 = Math.floor(15 * Math.random());
|
|
const val1 = Math.floor(15 * Math.random());
|
|
child.style.setProperty(
|
|
"--washi-url-0",
|
|
`url(/assets/images/washi/${val0}.png)`,
|
|
);
|
|
child.style.setProperty(
|
|
"--washi-url-1",
|
|
`url(/assets/images/washi/${val1}.png)`,
|
|
);
|
|
}
|
|
}
|
|
|
|
const content = Array.from(document.getElementsByClassName("content"))[0];
|
|
const imgs = Array.from(content.getElementsByTagName("img"));
|
|
for (let i = 0; i < imgs.length; i++) {
|
|
const img = imgs[i];
|
|
const anchor = document.createElement("a");
|
|
anchor.href = img.src;
|
|
img.parentNode.insertBefore(anchor, img);
|
|
anchor.appendChild(img);
|
|
}
|