From aacb05aee2b6b053c10ecd3e4927aeb9f73006bd Mon Sep 17 00:00:00 2001 From: Norbert Tretkowski Date: Sat, 20 Jan 2024 15:19:31 +0100 Subject: [PATCH] Add support for displaying video attachments based on https://github.com/rstockm/mastowall/pull/10 --- script.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 2fa9d2c..4b690db 100644 --- a/script.js +++ b/script.js @@ -125,7 +125,11 @@ const displayPost = function(post) {

${replaceEmojies(DOMPurify.sanitize(post.account.display_name), post.account.emojis)} @${DOMPurify.sanitize(post.account.acct)}

- ${post.media_attachments[0] ? `` : ''} + ${post.media_attachments[0] ? + (post.media_attachments[0].url.endsWith('.mp4') ? + `` : + ``) : + ''}

${replaceEmojies(DOMPurify.sanitize(post.content), post.emojis)}

${post.spoiler_text ? `

${DOMPurify.sanitize(post.spoiler_text)}

` : ''}

${timeAgo(secondsAgo(new Date(post.created_at)))}

@@ -203,7 +207,12 @@ const updateCarousel = function(slides, posts) {
700 ? `style="font-size: ${strip(postContent).length > 1000 ? `0.5`:`0.9`}em;"`: ``}>${postContent}
- ${post.media_attachments[0] ? `
` : ''} + ${post.media_attachments[0] ? + (post.media_attachments[0].url.endsWith('.mp4') ? + `
` : + `
`) : + ''} +