teddit-reddit-frontend-alte.../views/subreddit.pug

176 lines
8.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

doctype html
html
head
title /r/#{subreddit}
meta(property='og:title', content='/r/' + subreddit)
if subreddit_about
meta(property='og:description', content='' + unescape(subreddit_about.public_description_html, user_preferences))
include includes/meta_default.pug
include includes/head.pug
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
-
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;
}
}
}
if json === null
h1 Error occured
if error
if json.error_data.reason === "private"
h2 This is a private subreddit.
if json.error_data
p Error: #{JSON.stringify(json.error_data)}
else
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
li
a(href="/r/" + subreddit + "/wiki") wiki
#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
.reddit-error
p This subreddit either doesn't exist, or any posts weren't found.
else
each link in json.links
include components/link.pug
if json.info.before || json.info.after
.view-more-links
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")
div
label(for="q") search
input(type="text", name="q", id="q", placeholder="search")
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
.subscribe.content
-
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
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, user_preferences)
.description
!= unescape(subreddit_about.description_html, user_preferences)
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}
else
if subreddit.includes('+')
.content
p These subreddits
-
let subreddits = subreddit.split('+')
ul(class="subreddit-listing")
each subreddit in subreddits
-
let subbed_to_this_subreddit = false
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
}
}
li
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
include includes/footer.pug