Add video closer buttong
This commit is contained in:
@@ -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");
|
const isVideo = imgEl.dataset.full.endsWith(".mp4") || imgEl.dataset.full.endsWith(".webm") || imgEl.dataset.full.endsWith(".ogg");
|
||||||
|
|
||||||
|
|
||||||
if (isVideo) {
|
if (isVideo) {
|
||||||
const vidEl = imgEl.parentElement.querySelector("video");
|
const vidEl = imgEl.parentElement.querySelector("video");
|
||||||
|
const closeVidBtn = imgEl.parentElement.querySelector(".link-button");
|
||||||
if (vidEl.style.display === "none") {
|
if (vidEl.style.display === "none") {
|
||||||
vidEl.src = "/static/media/posts/full/" + imgEl.dataset.full;
|
vidEl.src = "/static/media/posts/full/" + imgEl.dataset.full;
|
||||||
vidEl.style.display = "";
|
vidEl.style.display = "";
|
||||||
imgEl.style.display = "none";
|
imgEl.style.display = "none";
|
||||||
|
closeVidBtn.style.display = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vidEl.src = "";
|
vidEl.src = "";
|
||||||
vidEl.style.display = "none";
|
vidEl.style.display = "none";
|
||||||
imgEl.style.display = "";
|
imgEl.style.display = "";
|
||||||
|
closeVidBtn.style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ import (
|
|||||||
templ PostOriginal(post database.Post, thread *database.Thread) {
|
templ PostOriginal(post database.Post, thread *database.Thread) {
|
||||||
<article id={ fmt.Sprintf("post-%d", post.Number) } class="post-op">
|
<article id={ fmt.Sprintf("post-%d", post.Number) } class="post-op">
|
||||||
<div>
|
<div>
|
||||||
|
<span
|
||||||
|
class="link-button"
|
||||||
|
onclick="togglePostFile(this)"
|
||||||
|
class="link-button"
|
||||||
|
style=" display: none;"
|
||||||
|
>[close]</span>
|
||||||
File:
|
File:
|
||||||
<a href={ templ.URL("/static/media/posts/full/" + post.MediaPath) } class="post-filename">
|
<a href={ templ.URL("/static/media/posts/full/" + post.MediaPath) } class="post-filename">
|
||||||
{ post.MediaPath }
|
{ post.MediaPath }
|
||||||
@@ -64,6 +70,12 @@ templ PostReply(post database.Post) {
|
|||||||
if post.MediaPath != "" {
|
if post.MediaPath != "" {
|
||||||
<div>
|
<div>
|
||||||
<div style="margin-bottom: 2px;">
|
<div style="margin-bottom: 2px;">
|
||||||
|
<span
|
||||||
|
class="link-button"
|
||||||
|
onclick="togglePostFile(this)"
|
||||||
|
class="link-button"
|
||||||
|
style=" display: none;"
|
||||||
|
>[close]</span>
|
||||||
File:
|
File:
|
||||||
<a href={ templ.URL("/static/media/posts/full/" + post.MediaPath) } class="post-filename">
|
<a href={ templ.URL("/static/media/posts/full/" + post.MediaPath) } class="post-filename">
|
||||||
{ post.MediaPath }
|
{ post.MediaPath }
|
||||||
|
|||||||
Reference in New Issue
Block a user