blob: 8fde1ce50a2040b7c6b6a5c1e073410e9597561b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
include ../mixins/comment
include ../mixins/header
include ../mixins/head
include ../mixins/postUtils
include ../utils
- var post = data.post
- var comments = data.comments
doctype html
html
+head(post.title)
script.
function toggleDetails(details_id) {
var detailsElement = document.getElementById(details_id);
if (detailsElement) {
detailsElement.open = !detailsElement.open;
}
}
body
main#content
+header(user)
div.hero
h3.sub-title
a(href=`/r/${post.subreddit}`) ← r/#{post.subreddit}
div.info-container
- var domain = (new URL(post.url)).hostname
p
| #{fmtnum(post.ups)} ↑
| · by u/#{post.author}
| ·
| #{timeDifference(Date.now(), post.created * 1000)}
| ·
if domain !== 'www.reddit.com'
a(href=`${post.url}`) submission url ↗
| ·
a(href=`https://reddit.com${post.permalink}`) reddit ↗
h2.post-title
!= post.title
if isPostGallery(post)
div.gallery
each item in postGalleryItems(post)
div.gallery-item
div.gallery-item-idx
| #{`${item.idx}/${item.total}`}
a(href=`/media/${item.url}`)
img(src=item.url loading="lazy")
else if isPostImage(post)
a(href=`/media/${post.url}`)
img(src=post.url).post-media
else if isPostVideo(post)
- var url = post.secure_media.reddit_video.dash_url
video(controls data-dashjs-player src=`${url}`).post-media
else if isPostLink(post)
a(href=post.url)
| #{post.url}
if post.selftext_html
div.self-text
!= post.selftext_html
hr
div.comments-container
- var total = comments.length
each child, index in comments
- var next_idx = index + 1
- var prev_idx = index - 1
- var next_com = next_idx < total ? comments[next_idx] : null
- var prev_com = prev_idx >= 0 ? comments[prev_idx] : null
- var next_id = next_com ? next_com.data.id : null
- var prev_id = prev_com ? prev_com.data.id : null
+comment(child, true, post.id, next_id, prev_id)
|