2020-11-17 21:44:32 +01:00
|
|
|
|
doctype html
|
|
|
|
|
html
|
|
|
|
|
head
|
|
|
|
|
title /r/#{subreddit}
|
|
|
|
|
include includes/head.pug
|
2020-11-21 13:50:12 +01:00
|
|
|
|
body(class=""+ user_preferences.theme +"")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
include includes/topbar.pug
|
2020-12-28 00:16:45 +01:00
|
|
|
|
-
|
|
|
|
|
let show_nsfw_warning = false;
|
|
|
|
|
if(subreddit_about) {
|
|
|
|
|
if(subreddit_about.over18) {
|
|
|
|
|
if((instance_nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false') {
|
|
|
|
|
show_nsfw_warning = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-17 21:44:32 +01:00
|
|
|
|
if json === null
|
|
|
|
|
h1 Error occured
|
|
|
|
|
if error
|
|
|
|
|
if json.error_data.reason === "private"
|
|
|
|
|
h2 This is a private subreddit.
|
|
|
|
|
p Error: #{JSON.stringify(json.error_data)}
|
|
|
|
|
else
|
2020-12-28 00:16:45 +01:00
|
|
|
|
if show_nsfw_warning === true
|
|
|
|
|
.nsfw-warning
|
|
|
|
|
span 18+
|
|
|
|
|
h2 You must be 18+ to view this community
|
|
|
|
|
p You must be at least eighteen years old to view this content. Are you over eighteen and willing to see adult content?
|
|
|
|
|
a(href="/") No thank you
|
|
|
|
|
a(href="?nsfw_enabled=true") Continue
|
|
|
|
|
p If you continue, <code>nsfw_enabled</code> cookie preference will be automatically set to <code>true</code>.
|
|
|
|
|
else
|
|
|
|
|
header
|
|
|
|
|
a(href="/", class="main")
|
|
|
|
|
h1 teddit
|
|
|
|
|
.bottom
|
|
|
|
|
if !subreddit.includes('+')
|
|
|
|
|
a(href="/r/" + subreddit + "", class="subreddit")
|
|
|
|
|
h2 #{subreddit}
|
|
|
|
|
ul.tabmenu
|
|
|
|
|
li(class=!sortby || sortby == 'hot' ? 'active' : '')
|
|
|
|
|
a(href="/r/" + subreddit) hot
|
|
|
|
|
li(class=sortby === 'new' ? 'active' : '')
|
|
|
|
|
a(href="/r/" + subreddit + "/new") new
|
|
|
|
|
li(class=sortby === 'rising' ? 'active' : '')
|
|
|
|
|
a(href="/r/" + subreddit + "/rising") rising
|
|
|
|
|
li(class=sortby === 'controversial' ? 'active' : '')
|
|
|
|
|
a(href="/r/" + subreddit + "/controversial") controversial
|
|
|
|
|
li(class=sortby === 'top' ? 'active' : '')
|
|
|
|
|
a(href="/r/" + subreddit + "/top") top
|
2021-01-05 02:51:38 +01:00
|
|
|
|
li
|
|
|
|
|
a(href="/r/" + subreddit + "/wiki") wiki
|
2020-12-28 00:16:45 +01:00
|
|
|
|
#links.sr
|
|
|
|
|
if sortby === 'top' || sortby === 'controversial'
|
|
|
|
|
details
|
|
|
|
|
summary
|
|
|
|
|
if past === 'hour'
|
|
|
|
|
span links from: past hour
|
|
|
|
|
if past === 'day'
|
|
|
|
|
span links from: past 24 hours
|
|
|
|
|
if past === 'week'
|
|
|
|
|
span links from: past week
|
|
|
|
|
if past === 'month'
|
|
|
|
|
span links from: past month
|
|
|
|
|
if past === 'year'
|
|
|
|
|
span links from: past year
|
|
|
|
|
if past === 'all'
|
|
|
|
|
span links from: all time
|
|
|
|
|
ul
|
|
|
|
|
li(class=past === 'hour' ? 'active' : '')
|
|
|
|
|
a(href="?t=hour") past hour
|
|
|
|
|
li(class=past === 'day' ? 'active' : '')
|
|
|
|
|
a(href="?t=day") past 24 hours
|
|
|
|
|
li(class=past === 'week' ? 'active' : '')
|
|
|
|
|
a(href="?t=week") past week
|
|
|
|
|
li(class=past === 'month' ? 'active' : '')
|
|
|
|
|
a(href="?t=month") past month
|
|
|
|
|
li(class=past === 'year' ? 'active' : '')
|
|
|
|
|
a(href="?t=year") past year
|
|
|
|
|
li(class=past === 'all' ? 'active' : '')
|
|
|
|
|
a(href="?t=all") all time
|
|
|
|
|
if json.links.length === 0
|
|
|
|
|
p nothing here
|
|
|
|
|
else
|
|
|
|
|
each link in json.links
|
|
|
|
|
.link
|
|
|
|
|
.upvotes
|
|
|
|
|
.arrow
|
|
|
|
|
span #{kFormatter(link.ups)}
|
|
|
|
|
.arrow.down
|
|
|
|
|
.image
|
|
|
|
|
if link.images
|
|
|
|
|
if link.is_self_link
|
|
|
|
|
a(href="" + link.permalink + "")
|
|
|
|
|
img(src="" + link.images.thumb + "", alt="")
|
|
|
|
|
else
|
2020-12-30 22:51:20 +01:00
|
|
|
|
a(href=""+ link.url +"", rel="noopener noreferrer")
|
2020-12-28 00:16:45 +01:00
|
|
|
|
img(src="" + link.images.thumb + "", alt="")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
else
|
|
|
|
|
a(href="" + link.permalink + "")
|
2020-12-30 22:51:20 +01:00
|
|
|
|
.no-image no image
|
2020-12-28 00:16:45 +01:00
|
|
|
|
.entry
|
|
|
|
|
.title
|
|
|
|
|
if link.is_self_link
|
|
|
|
|
a(href="" + link.permalink + "")
|
|
|
|
|
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
|
|
|
|
|
!= link.link_flair
|
|
|
|
|
span (#{link.domain})
|
2020-12-14 15:08:38 +01:00
|
|
|
|
else
|
2020-12-30 22:51:20 +01:00
|
|
|
|
a(href="" + link.url + "", rel="noopener noreferrer")
|
2020-12-28 00:16:45 +01:00
|
|
|
|
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
|
|
|
|
|
!= link.link_flair
|
|
|
|
|
span (#{link.domain})
|
|
|
|
|
.meta
|
|
|
|
|
p.submitted submitted
|
|
|
|
|
span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by
|
|
|
|
|
if link.author === '[deleted]'
|
|
|
|
|
span(class="deleted") [deleted]
|
|
|
|
|
else
|
|
|
|
|
a(href="/u/" + link.author + "")
|
|
|
|
|
| #{link.author}
|
|
|
|
|
!= link.user_flair
|
|
|
|
|
p.to to
|
|
|
|
|
a(href="/r/" + link.subreddit + "")
|
|
|
|
|
| #{link.subreddit}
|
|
|
|
|
if link.stickied
|
|
|
|
|
span(class="green") stickied
|
|
|
|
|
.links
|
|
|
|
|
if link.over_18
|
|
|
|
|
span.tag.nsfw NSFW
|
2021-01-19 17:36:31 +01:00
|
|
|
|
if link.selftext_html
|
|
|
|
|
details
|
|
|
|
|
summary
|
|
|
|
|
.line
|
|
|
|
|
.line
|
|
|
|
|
.line
|
|
|
|
|
.selftext
|
|
|
|
|
!= unescape(link.selftext_html)
|
2021-01-24 12:54:13 +01:00
|
|
|
|
if (link.images && link.images.preview)
|
|
|
|
|
style.
|
|
|
|
|
details.preview-container img {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
height: auto !important;
|
|
|
|
|
max-width: none !important;
|
|
|
|
|
max-height: none !important;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
details.preview-container[open][data-url="#{link.images.preview}"] .preview {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
background-image: url('#{link.images.preview}');
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-size: contain;
|
|
|
|
|
}
|
|
|
|
|
details.preview-container(data-url="" + link.images.preview + "")
|
|
|
|
|
summary
|
|
|
|
|
span ▶
|
|
|
|
|
.preview
|
|
|
|
|
img(src=""+ link.images.thumb +"", alt="")
|
2020-12-28 00:16:45 +01:00
|
|
|
|
a(href="" + link.permalink + "", class="comments")
|
|
|
|
|
| #{link.num_comments} comments
|
|
|
|
|
if json.info.before || json.info.after
|
2021-01-04 12:43:14 +01:00
|
|
|
|
.view-more-links
|
2020-12-28 00:16:45 +01:00
|
|
|
|
if json.info.before && !subreddit_front
|
|
|
|
|
a(href="/r/" + subreddit + "/" + sortby + "?t="+ (past ? past : '') +"&before=" + json.info.before + "") ‹ prev
|
|
|
|
|
if json.info.after
|
|
|
|
|
a(href="/r/" + subreddit + "/" + sortby + "?t=" + (past ? past : '') + "&after=" + json.info.after + "") next ›
|
|
|
|
|
#sidebar
|
|
|
|
|
#search.sr
|
|
|
|
|
form(action="/r/" + subreddit + "/search", method="GET")
|
2020-12-30 22:51:20 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="q") search
|
|
|
|
|
input(type="text", name="q", id="q", placeholder="search")
|
2020-12-28 00:16:45 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="restrict_sr") limit my search to r/#{subreddit}
|
|
|
|
|
input(type="checkbox", name="restrict_sr", id="restrict_sr", checked="checked")
|
|
|
|
|
div
|
|
|
|
|
label(for="nsfw") include NSFW results
|
|
|
|
|
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
|
|
|
|
|
input(type="submit", value="search")
|
|
|
|
|
if subreddit_about
|
2021-01-10 15:03:27 +01:00
|
|
|
|
.subscribe.content
|
2021-01-08 21:39:46 +01:00
|
|
|
|
-
|
|
|
|
|
let subbed_to_this_subreddit = false
|
|
|
|
|
let subbed = []
|
|
|
|
|
if(user_preferences.subbed_subreddits && Array.isArray(user_preferences.subbed_subreddits))
|
|
|
|
|
subbed = user_preferences.subbed_subreddits
|
|
|
|
|
for(let i = 0; i < subbed.length; i++) {
|
|
|
|
|
if(subbed[i] === subreddit)
|
|
|
|
|
subbed_to_this_subreddit = true
|
|
|
|
|
}
|
|
|
|
|
if subbed_to_this_subreddit
|
|
|
|
|
a(href="/unsubscribe/" + subreddit + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe
|
|
|
|
|
else
|
|
|
|
|
a(href="/subscribe/" + subreddit + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe
|
2020-12-28 00:16:45 +01:00
|
|
|
|
if subreddit_about.subscribers
|
|
|
|
|
.content
|
|
|
|
|
p subscribers: #{subreddit_about.subscribers.toLocaleString()}
|
|
|
|
|
p users here right now: #{subreddit_about.active_user_count.toLocaleString()}
|
|
|
|
|
br
|
|
|
|
|
.heading
|
|
|
|
|
p.title #{subreddit_about.title}
|
|
|
|
|
.short-description
|
|
|
|
|
!= unescape(subreddit_about.public_description_html)
|
|
|
|
|
.description
|
|
|
|
|
!= unescape(subreddit_about.description_html)
|
|
|
|
|
else
|
|
|
|
|
if subreddit.includes('+')
|
|
|
|
|
.content
|
|
|
|
|
p These subreddits
|
|
|
|
|
-
|
|
|
|
|
let subreddits = subreddit.split('+')
|
|
|
|
|
ul(class="subreddit-listing")
|
|
|
|
|
each subreddit in subreddits
|
2021-01-08 21:39:46 +01:00
|
|
|
|
-
|
|
|
|
|
let subbed_to_this_subreddit = false
|
2021-01-08 21:49:07 +01:00
|
|
|
|
if(user_preferences.subbed_subreddits) {
|
|
|
|
|
let subbed = user_preferences.subbed_subreddits
|
|
|
|
|
for(let i = 0; i < subbed.length; i++) {
|
|
|
|
|
if(subbed[i] === subreddit)
|
|
|
|
|
subbed_to_this_subreddit = true
|
|
|
|
|
}
|
2021-01-08 21:39:46 +01:00
|
|
|
|
}
|
2020-12-28 00:16:45 +01:00
|
|
|
|
li
|
2021-01-08 21:39:46 +01:00
|
|
|
|
if subbed_to_this_subreddit
|
|
|
|
|
a(href="/unsubscribe/" + subreddit + "?b=/r/" + subreddits + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe
|
|
|
|
|
a(href="/r/" + subreddit + "") #{subreddit}
|
|
|
|
|
else
|
|
|
|
|
a(href="/subscribe/" + subreddit + "?b=/r/" + subreddits + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe
|
|
|
|
|
a(href="/r/" + subreddit + "") #{subreddit}
|
|
|
|
|
- joined_subreddits = subreddits.join("+")
|
|
|
|
|
a(href="/import_subscriptions/" + joined_subreddits + "?b=/r/" + joined_subreddits) subscribe to all of these subreddits
|
2020-12-28 21:45:17 +01:00
|
|
|
|
include includes/footer.pug
|