website/music/index.md

35 lines
1.4 KiB
Markdown
Raw Normal View History

2024-09-07 00:21:21 -05:00
# music
Music is a huge passion of mine. I prefer listening to albums in full from
start to finish in order. My favorite albums are usually experimental, unique,
or have a particular theme they explore
2024-09-06 01:33:57 -05:00
<script id="albums">
const thisScript = document.getElementById("albums");
fetch("/music/albums.json")
.then((response) => response.json())
.then((json) => {
let html = "";
2024-09-06 20:19:54 -05:00
for (const category in json) {
let albums = json[category];
html = html.concat(`<h2>${category}</h2><section>`);
for (let i = 0; i < albums.length; i++) {
let album = albums[i];
let link = "/res/albums/" + album.link + ".webp";
let name = album.name;
let artist = album.artist;
let template = `<figure>
<img src="${link}">
<figcaption>
<b>${name}</b><br/><em>${artist}</em>
</figcaption>
</figure>`;
html = html.concat(template);
}
html = html.concat("</section>")
2024-09-06 01:33:57 -05:00
}
2024-09-06 20:19:54 -05:00
let section = document.createElement("div");
2024-09-06 01:33:57 -05:00
section.innerHTML = html;
thisScript.replaceWith(section); // lol
});
</script>
2024-09-07 00:21:21 -05:00
<figure-grid src="/music/albums.json"></figure-grid>