2020-11-17 21:44:32 +01:00
|
|
|
|
doctype html
|
|
|
|
|
html
|
|
|
|
|
head
|
|
|
|
|
title /r/#{subreddit}
|
|
|
|
|
include includes/head.pug
|
2021-01-27 17:39:12 +01:00
|
|
|
|
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : 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.
|
2021-08-03 08:12:37 +02:00
|
|
|
|
if json.error_data
|
|
|
|
|
p Error: #{JSON.stringify(json.error_data)}
|
2020-11-17 21:44:32 +01:00
|
|
|
|
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
|
2021-03-28 16:55:16 +02:00
|
|
|
|
.reddit-error
|
|
|
|
|
p This subreddit either doesn't exist, or any posts weren't found.
|
2020-12-28 00:16:45 +01:00
|
|
|
|
else
|
|
|
|
|
each link in json.links
|
2021-05-24 20:39:28 +02:00
|
|
|
|
include components/link.pug
|
2020-12-28 00:16:45 +01:00
|
|
|
|
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
|
2021-03-21 21:14:11 +01:00
|
|
|
|
!= unescape(subreddit_about.public_description_html, user_preferences)
|
2020-12-28 00:16:45 +01:00
|
|
|
|
.description
|
2021-03-21 21:14:11 +01:00
|
|
|
|
!= unescape(subreddit_about.description_html, user_preferences)
|
2021-04-11 14:28:41 +02:00
|
|
|
|
if subreddit_about.moderators
|
|
|
|
|
if subreddit_about.moderators.kind === 'UserList'
|
|
|
|
|
if subreddit_about.moderators.data.children.length > 0
|
|
|
|
|
.mod-list
|
|
|
|
|
h4 Moderators
|
|
|
|
|
ul
|
|
|
|
|
each moderator in subreddit_about.moderators.data.children
|
|
|
|
|
li
|
|
|
|
|
a(href="/u/"+ moderator.name +"")
|
|
|
|
|
p(title=""+ moderator.mod_permissions.join(', ') +"") #{moderator.name}
|
|
|
|
|
span.flair #{moderator.author_flair_text}
|
2020-12-28 00:16:45 +01:00
|
|
|
|
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
|