From dff02621742483ddf14ee4bbc6b8555b8a67298f Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 31 Oct 2024 19:35:52 +0000 Subject: more fixes for galleries --- src/mixins/post.pug | 24 +++++++++++------------- src/public/styles.css | 7 +++++++ src/views/comments.pug | 8 +++++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/mixins/post.pug b/src/mixins/post.pug index 006193f..8a66d53 100644 --- a/src/mixins/post.pug +++ b/src/mixins/post.pug @@ -7,6 +7,16 @@ mixin post(p) a(href=`/comments/${p.id}`) != p.title span.domain (#{p.domain}) + div.info-container + p + | ↑ #{fmtnum(p.ups)} + |  ·  + a(href=`/comments/${p.id}`) #{fmtnum (p.num_comments)} replies + |  ·  + a(href=`/r/${p.subreddit}`) r/#{p.subreddit} + span.post-author + |  ·  + by u/#{p.author} div.media-preview if p.is_gallery && p.is_gallery == true if p.gallery_data @@ -20,17 +30,6 @@ mixin post(p) else if p.post_hint == "hosted:video" - var url = p.secure_media.reddit_video.dash_url video(src=url data-dashjs-player width='100px' height='100px' onclick=`toggleDetails('${p.id}')`) - div.info-container - p - | ↑ #{fmtnum(p.ups)} - |  ·  - | 💬  - a(href=`/comments/${p.id}`) #{fmtnum (p.num_comments)} - |  ·  - a(href=`/r/${p.subreddit}`) r/#{p.subreddit} - span.post-author - |  ·  - by u/#{p.author} if p.is_gallery && p.is_gallery == true if p.gallery_data @@ -52,7 +51,6 @@ mixin post(p) details(id=`${p.id}`) summary expand video - var url = p.secure_media.reddit_video.dash_url - a(href=url) - video(src=url controls data-dashjs-player).post-media + video(src=url controls data-dashjs-player).post-media button(onclick=`toggleDetails('${p.id}')`) close diff --git a/src/public/styles.css b/src/public/styles.css index f619dcc..7a27e82 100644 --- a/src/public/styles.css +++ b/src/public/styles.css @@ -235,3 +235,10 @@ summary { .footer { padding-bottom: 40px; } + +a { + white-space: normal; + word-wrap: break-word; + overflow-wrap: break-word; +} + diff --git a/src/views/comments.pug b/src/views/comments.pug index 0898a9c..e335cae 100644 --- a/src/views/comments.pug +++ b/src/views/comments.pug @@ -14,7 +14,13 @@ html h4 r/#{post.subreddit} h2 #{post.title} - if post.post_hint == 'image' + if post.is_gallery && post.is_gallery == true + if post.gallery_data + if post.gallery_data.items + each item in post.gallery_data.items + - var url = `https://i.redd.it/${item.media_id}.jpg` + img(src=url).post-media + if (post.post_hint == "image" || post.post_hint == "link") && post.thumbnail && post.thumbnail != "self" && post.thumbnail != "default" img(src=post.url).post-media else if post.post_hint == 'hosted:video' - var url = post.secure_media.reddit_video.dash_url -- cgit v1.2.3