diff --git a/web/static/thread.js b/web/static/thread.js index ae8c4c7..36f3172 100644 --- a/web/static/thread.js +++ b/web/static/thread.js @@ -36,21 +36,24 @@ function insertHeaderReplies() { } } -function togglePostFile(imgEl) { +function togglePostFile(el) { + const imgEl = el.parentElement.parentElement.querySelector("img"); const isVideo = imgEl.dataset.full.endsWith(".mp4") || imgEl.dataset.full.endsWith(".webm") || imgEl.dataset.full.endsWith(".ogg"); - if (isVideo) { const vidEl = imgEl.parentElement.querySelector("video"); + const closeVidBtn = imgEl.parentElement.querySelector(".link-button"); if (vidEl.style.display === "none") { vidEl.src = "/static/media/posts/full/" + imgEl.dataset.full; vidEl.style.display = ""; imgEl.style.display = "none"; + closeVidBtn.style.display = ""; } else { vidEl.src = ""; vidEl.style.display = "none"; imgEl.style.display = ""; + closeVidBtn.style.display = "none"; } } else { diff --git a/web/views/thread.templ b/web/views/thread.templ index a2f7063..661f694 100644 --- a/web/views/thread.templ +++ b/web/views/thread.templ @@ -11,6 +11,12 @@ import ( templ PostOriginal(post database.Post, thread *database.Thread) {
+ [close] File: { post.MediaPath } @@ -64,6 +70,12 @@ templ PostReply(post database.Post) { if post.MediaPath != "" {
+ [close] File: { post.MediaPath }