diff options
author | Akshay <[email protected]> | 2024-10-29 20:56:27 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2024-10-29 20:56:54 +0000 |
commit | 33e89cce40a62af327635f4cb32da54c3149e812 (patch) | |
tree | fe85506caa2fd9a84fb50c4ce2fb63621f97d8a0 /src/mixins | |
parent | 93b2f948382d4d50c76b0773fab4c44913a1b2f7 (diff) |
improvements to media preview, and galleries
Diffstat (limited to 'src/mixins')
-rw-r--r-- | src/mixins/post.pug | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/mixins/post.pug b/src/mixins/post.pug index cbe2365..fc765ab 100644 --- a/src/mixins/post.pug +++ b/src/mixins/post.pug | |||
@@ -15,12 +15,40 @@ mixin post(p) | |||
15 | div.info-item | 15 | div.info-item |
16 | a(href=`/comments/${p.id}`) #{fmtnum (p.num_comments)} #{fmttxt(p.num_comments, 'comment')} | 16 | a(href=`/comments/${p.id}`) #{fmtnum (p.num_comments)} #{fmttxt(p.num_comments, 'comment')} |
17 | div.media-preview | 17 | div.media-preview |
18 | if p.post_hint == "image" || p.post_hint == "link" | 18 | if p.is_gallery && p.is_gallery == true |
19 | if p.gallery_data | ||
20 | if p.gallery_data.items | ||
21 | - var item = p.gallery_data.items[0] | ||
22 | - var url = `https://i.redd.it/${item.media_id}.jpg` | ||
23 | img(src=url width='100px' height='100px' onclick=`toggleDetails('${p.id}')`) | ||
24 | else if p.post_hint == "image" || p.post_hint == "link" | ||
19 | if p.thumbnail && p.thumbnail != "self" || p.thumbnail != "default" | 25 | if p.thumbnail && p.thumbnail != "self" || p.thumbnail != "default" |
20 | a(href=p.url) | 26 | img(src=p.thumbnail width='100px' height='100px' onclick=`toggleDetails('${p.id}')`) |
21 | img(src=p.thumbnail width='100px' height='100px') | ||
22 | else if p.post_hint == "hosted:video" | 27 | else if p.post_hint == "hosted:video" |
23 | - var url = p.secure_media.reddit_video.dash_url | 28 | - var url = p.secure_media.reddit_video.dash_url |
24 | a(href=url) | 29 | video(src=url data-dashjs-player width='100px' height='100px' onclick=`toggleDetails('${p.id}')`) |
25 | video(src=url controls data-dashjs-player="" width='100px' height='100px') | 30 | |
31 | if p.is_gallery && p.is_gallery == true | ||
32 | if p.gallery_data | ||
33 | if p.gallery_data.items | ||
34 | details(id=`${p.id}`) | ||
35 | summary expand gallery | ||
36 | each item in p.gallery_data.items | ||
37 | - var url = `https://i.redd.it/${item.media_id}.jpg` | ||
38 | a(href=`/media/${url}`) | ||
39 | img(src=url).post-media | ||
40 | button(onclick=`toggleDetails('${p.id}')`) close | ||
41 | if (p.post_hint == "image" || p.post_hint == "link") && p.thumbnail && p.thumbnail != "self" && p.thumbnail != "default" | ||
42 | details(id=`${p.id}`) | ||
43 | summary expand image | ||
44 | a(href=`/media/${p.url}`) | ||
45 | img(src=p.url).post-media | ||
46 | button(onclick=`toggleDetails('${p.id}')`) close | ||
47 | else if p.post_hint == "hosted:video" | ||
48 | details(id=`${p.id}`) | ||
49 | summary expand video | ||
50 | - var url = p.secure_media.reddit_video.dash_url | ||
51 | a(href=url) | ||
52 | video(src=url controls data-dashjs-player).post-media | ||
53 | button(onclick=`toggleDetails('${p.id}')`) close | ||
26 | 54 | ||