From be9c9fa8c9bb54d8f28e6d308ca81ff2fbb86c15 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Fri, 3 Nov 2023 17:27:05 -0400 Subject: [PATCH] Fix website --- web/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/index.js b/web/index.js index 3247d99..11c0be4 100644 --- a/web/index.js +++ b/web/index.js @@ -14,7 +14,7 @@ fetch(`${OFFIMG_PATH}/info.json`) INFO_TAG.appendChild(item); } - d.images.sort((a, b) => new Date(b.date) - new Date(a.date)); + d.images.sort((a, b) => new Date(b.post.date) - new Date(a.post.date)); IMAGES_TAG.innerHTML = ""; for (let i of d.images) { let image = document.createElement("div"); @@ -22,7 +22,7 @@ fetch(`${OFFIMG_PATH}/info.json`) { let img = document.createElement("img"); - img.src = `${OFFIMG_PATH}/${i.id}.bmp`; + img.src = `${OFFIMG_PATH}/${i.uuid}.bmp`; img.alt = i.alt; image.appendChild(img); } @@ -32,23 +32,24 @@ fetch(`${OFFIMG_PATH}/info.json`) foot.setAttribute("foot", ""); let info = document.createElement("div"); - info.innerHTML = `${new Date(i.date).toLocaleDateString( + info.innerHTML = `${new Date(i.post.date).toLocaleDateString( "en-US" )} • `; let post = document.createElement("a"); - post.href = `https://forum.swissmicros.com/viewtopic.php?t=${i.post}`; - post.innerHTML = `Post ${i.post}`; + post.href = `https://forum.swissmicros.com/viewtopic.php?t=${i.post.post}`; + post.innerHTML = `Post ${i.post.post}`; post.target = "_blank"; post.rel = "noopener noreferrer"; info.appendChild(post); - info.innerHTML += ` • ${i.alt}`; + if (i.alt) info.innerHTML += ` • ${i.alt}`; let download = document.createElement("a"); download.href = `${OFFIMG_PATH}/${i.id}.bmp`; download.innerHTML = `⇓`; - download.download = `${i.alt}${i.alt.endsWith(".bmp") ? "" : ".bmp"}`; + if (i.alt) download.download = `${i.alt}${i.alt.endsWith(".bmp") ? "" : ".bmp"}`; + else download.download = `${i.id}.bmp`; foot.appendChild(info); foot.appendChild(download);